VirtualBox

Ignore:
Timestamp:
Feb 13, 2009 2:59:48 PM (16 years ago)
Author:
vboxsync
Message:

#2957: Renamed TAP to NetAdapter in source code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetAdapter-darwin.cpp

    r16739 r16740  
    4545#include <sys/param.h>
    4646
    47 #define VBOXTAP_MAX_INSTANCES  8
    48 #define VBOXTAP_MAX_FAMILIES   4
    49 #define VBOXTAP_NAME           "vboxnet"
    50 #define VBOXTAP_MTU            1500
    51 #define VBOXTAP_DETACH_TIMEOUT 500
    52 
    53 #define VBOXTAP_FROM_IFACE(iface) ((PVBOXTAP) ifnet_softc(iface))
     47#define VBOXNETADA_MAX_INSTANCES  8
     48#define VBOXNETADA_MAX_FAMILIES   4
     49#define VBOXNETADA_NAME           "vboxnet"
     50#define VBOXNETADA_MTU            1500
     51#define VBOXNETADA_DETACH_TIMEOUT 500
     52
     53#define VBOXNETADA_FROM_IFACE(iface) ((PVBOXNETADA) ifnet_softc(iface))
    5454
    5555/**
    56  * Void TAPs mark vacant slots in TAP array. Valid TAPs are busy slots.
     56 * Void NETADAs mark vacant slots in NETADA array. Valid NETADAs are busy slots.
    5757 * As soon as slot is being modified its state changes to transitional.
    58  * TAPs in transitional state must only be accessed by the thread that
     58 * NETADAs in transitional state must only be accessed by the thread that
    5959 * put it to this state.
    6060 */
    61 enum VBoxTapState
    62 {
    63     VBOXTAP_ST_VOID,
    64     VBOXTAP_ST_TRANSITIONAL,
    65     VBOXTAP_ST_VALID
     61enum VBoxNetAdaState
     62{
     63    VBOXNETADA_ST_VOID,
     64    VBOXNETADA_ST_TRANSITIONAL,
     65    VBOXNETADA_ST_VALID
    6666};
    67 typedef enum VBoxTapState VBOXTAPSTATE;
    68 
    69 struct VBoxTap
     67typedef enum VBoxNetAdaState VBOXNETADASTATE;
     68
     69struct VBoxNetAda
    7070{
    7171    /** Mutex protecting access to enmState. */
    7272    RTSEMFASTMUTEX    hStateMtx;
    73     /** Denotes availability of this TAP. */
    74     VBOXTAPSTATE      enmState;
    75     /** Corresponds to the digit at the end of TAP name. */
     73    /** Denotes availability of this NETADA. */
     74    VBOXNETADASTATE      enmState;
     75    /** Corresponds to the digit at the end of NETADA name. */
    7676    uint8_t           uUnit;
    7777    /** Event to signal detachment of interface. */
     
    8080    ifnet_t           pIface;
    8181    /* todo: MAC address? */
    82     /** Protocol families attached to this TAP. */
    83     protocol_family_t aAttachedFamilies[VBOXTAP_MAX_FAMILIES];
     82    /** Protocol families attached to this NETADA. */
     83    protocol_family_t aAttachedFamilies[VBOXNETADA_MAX_FAMILIES];
    8484};
    85 typedef struct VBoxTap VBOXTAP;
    86 typedef VBOXTAP *PVBOXTAP;
    87 
    88 VBOXTAP g_aTaps[VBOXTAP_MAX_INSTANCES];
    89 
    90 DECLINLINE(bool) vboxTAPIsValid(PVBOXTAP pTap)
    91 {
    92     return pTap->enmState == VBOXTAP_ST_VALID;
    93 }
    94 
    95 DECLINLINE(bool) vboxTAPIsVoid(PVBOXTAP pTap)
    96 {
    97     return pTap->enmState == VBOXTAP_ST_VOID;
    98 }
    99 
    100 static void vboxTAPComposeMACAddress(PVBOXTAP pTap, PCRTMAC pCustomMac, struct sockaddr_dl *pMac)
     85typedef struct VBoxNetAda VBOXNETADA;
     86typedef VBOXNETADA *PVBOXNETADA;
     87
     88VBOXNETADA g_aAdapters[VBOXNETADA_MAX_INSTANCES];
     89
     90DECLINLINE(bool) vboxNetAdaIsValid(PVBOXNETADA pAda)
     91{
     92    return pAda->enmState == VBOXNETADA_ST_VALID;
     93}
     94
     95DECLINLINE(bool) vboxNetAdaIsVoid(PVBOXNETADA pAda)
     96{
     97    return pAda->enmState == VBOXNETADA_ST_VOID;
     98}
     99
     100static void vboxNetAdaComposeMACAddress(PVBOXNETADA pAda, PCRTMAC pCustomMac, struct sockaddr_dl *pMac)
    101101{
    102102    pMac->sdl_len = sizeof(*pMac);
     
    110110    {
    111111        memcpy(LLADDR(pMac), "\0vbox0", pMac->sdl_alen);
    112         LLADDR(pMac)[ETHER_ADDR_LEN - 1] += pTap->uUnit;
    113     }
    114 }
    115 
    116 static void vboxTAPComposeUUID(PVBOXTAP pTap, PRTUUID pUuid)
     112        LLADDR(pMac)[ETHER_ADDR_LEN - 1] += pAda->uUnit;
     113    }
     114}
     115
     116static void vboxNetAdaComposeUUID(PVBOXNETADA pAda, PRTUUID pUuid)
    117117{
    118118    /* Generate UUID from name and MAC address. */
     
    121121    pUuid->Gen.u8ClockSeqHiAndReserved = (pUuid->Gen.u8ClockSeqHiAndReserved & 0x3f) | 0x80;
    122122    pUuid->Gen.u16TimeHiAndVersion = (pUuid->Gen.u16TimeHiAndVersion & 0x0fff) | 0x4000;
    123     pUuid->Gen.u8ClockSeqLow = pTap->uUnit;
     123    pUuid->Gen.u8ClockSeqLow = pAda->uUnit;
    124124    memcpy(pUuid->Gen.au8Node, "\0vbox0", sizeof(pUuid->Gen.au8Node));
    125     pUuid->Gen.au8Node[sizeof(pUuid->Gen.au8Node) - 1] += pTap->uUnit;
    126 }
    127 
    128 
    129 static errno_t vboxTAPOutput(ifnet_t pIface, mbuf_t pMBuf)
     125    pUuid->Gen.au8Node[sizeof(pUuid->Gen.au8Node) - 1] += pAda->uUnit;
     126}
     127
     128
     129static errno_t vboxNetAdaOutput(ifnet_t pIface, mbuf_t pMBuf)
    130130{
    131131    mbuf_freem_list(pMBuf);
     
    133133}
    134134
    135 static void vboxTAPAttachFamily(PVBOXTAP pTap, protocol_family_t Family)
     135static void vboxNetAdaAttachFamily(PVBOXNETADA pAda, protocol_family_t Family)
    136136{
    137137    u_int32_t i;
    138     for (i = 0; i < VBOXTAP_MAX_FAMILIES; i++)
    139         if (pTap->aAttachedFamilies[i] == 0)
     138    for (i = 0; i < VBOXNETADA_MAX_FAMILIES; i++)
     139        if (pAda->aAttachedFamilies[i] == 0)
    140140        {
    141             pTap->aAttachedFamilies[i] = Family;
     141            pAda->aAttachedFamilies[i] = Family;
    142142            break;
    143143        }
    144144}
    145145
    146 static void vboxTAPDetachFamily(PVBOXTAP pTap, protocol_family_t Family)
     146static void vboxNetAdaDetachFamily(PVBOXNETADA pAda, protocol_family_t Family)
    147147{
    148148    u_int32_t i;
    149     for (i = 0; i < VBOXTAP_MAX_FAMILIES; i++)
    150         if (pTap->aAttachedFamilies[i] == Family)
    151             pTap->aAttachedFamilies[i] = 0;
    152 }
    153 
    154 static errno_t vboxTAPAddProto(ifnet_t pIface, protocol_family_t Family, const struct ifnet_demux_desc *pDemuxDesc, u_int32_t nDesc)
    155 {
    156     PVBOXTAP pTap = VBOXTAP_FROM_IFACE(pIface);
    157     Assert(pTap);
    158     vboxTAPAttachFamily(pTap, Family);
    159     LogFlow(("vboxTAPAddProto: Family=%d.\n", Family));
     149    for (i = 0; i < VBOXNETADA_MAX_FAMILIES; i++)
     150        if (pAda->aAttachedFamilies[i] == Family)
     151            pAda->aAttachedFamilies[i] = 0;
     152}
     153
     154static errno_t vboxNetAdaAddProto(ifnet_t pIface, protocol_family_t Family, const struct ifnet_demux_desc *pDemuxDesc, u_int32_t nDesc)
     155{
     156    PVBOXNETADA pAda = VBOXNETADA_FROM_IFACE(pIface);
     157    Assert(pAda);
     158    vboxNetAdaAttachFamily(pAda, Family);
     159    LogFlow(("vboxNetAdaAddProto: Family=%d.\n", Family));
    160160    return ether_add_proto(pIface, Family, pDemuxDesc, nDesc);
    161161}
    162162
    163 static errno_t vboxTAPDelProto(ifnet_t pIface, protocol_family_t Family)
    164 {
    165     PVBOXTAP pTap = VBOXTAP_FROM_IFACE(pIface);
    166     Assert(pTap);
    167     LogFlow(("vboxTAPDelProto: Family=%d.\n", Family));
    168     vboxTAPDetachFamily(pTap, Family);
     163static errno_t vboxNetAdaDelProto(ifnet_t pIface, protocol_family_t Family)
     164{
     165    PVBOXNETADA pAda = VBOXNETADA_FROM_IFACE(pIface);
     166    Assert(pAda);
     167    LogFlow(("vboxNetAdaDelProto: Family=%d.\n", Family));
     168    vboxNetAdaDetachFamily(pAda, Family);
    169169    return ether_del_proto(pIface, Family);
    170170}
    171171
    172 static void vboxTAPDetach(ifnet_t pIface)
    173 {
    174     PVBOXTAP pTap = VBOXTAP_FROM_IFACE(pIface);
    175     Assert(pTap);
    176     Log(("vboxTAPDetach: Signaling detach to vboxTAPUnregisterDevice.\n"));
    177     /* Let vboxTAPUnregisterDevice know that the interface has been detached. */
    178     RTSemEventSignal(pTap->hEvtDetached);
    179 }
    180 
    181 
    182 static int vboxTAPRegisterDevice(PVBOXTAP pTap, const struct sockaddr_dl *pMACAddress)
     172static void vboxNetAdaDetach(ifnet_t pIface)
     173{
     174    PVBOXNETADA pAda = VBOXNETADA_FROM_IFACE(pIface);
     175    Assert(pAda);
     176    Log(("vboxNetAdaDetach: Signaling detach to vboxNetAdaUnregisterDevice.\n"));
     177    /* Let vboxNetAdaUnregisterDevice know that the interface has been detached. */
     178    RTSemEventSignal(pAda->hEvtDetached);
     179}
     180
     181
     182static int vboxNetAdaRegisterDevice(PVBOXNETADA pAda, const struct sockaddr_dl *pMACAddress)
    183183{
    184184    struct ifnet_init_params Params;
    185185    RTUUID uuid;
    186186   
    187     vboxTAPComposeUUID(pTap, &uuid);
     187    vboxNetAdaComposeUUID(pAda, &uuid);
    188188    Params.uniqueid = uuid.au8;
    189189    Params.uniqueid_len = sizeof(uuid);
    190     Params.name = VBOXTAP_NAME;
    191     Params.unit = pTap->uUnit;
     190    Params.name = VBOXNETADA_NAME;
     191    Params.unit = pAda->uUnit;
    192192    Params.family = IFNET_FAMILY_ETHERNET;
    193193    Params.type = IFT_ETHER;
    194     Params.output = vboxTAPOutput;
     194    Params.output = vboxNetAdaOutput;
    195195    Params.demux = ether_demux;
    196     Params.add_proto = vboxTAPAddProto;
    197     Params.del_proto = vboxTAPDelProto;
     196    Params.add_proto = vboxNetAdaAddProto;
     197    Params.del_proto = vboxNetAdaDelProto;
    198198    Params.check_multi = ether_check_multi;
    199199    Params.framer = ether_frameout;
    200     Params.softc = pTap;
     200    Params.softc = pAda;
    201201    Params.ioctl = ether_ioctl;
    202202    Params.set_bpf_tap = NULL;
    203     Params.detach = vboxTAPDetach;
     203    Params.detach = vboxNetAdaDetach;
    204204    Params.event = NULL;
    205205    Params.broadcast_addr = "\xFF\xFF\xFF\xFF\xFF\xFF";
    206206    Params.broadcast_len = ETHER_ADDR_LEN;
    207207
    208     errno_t err = ifnet_allocate(&Params, &pTap->pIface);
     208    errno_t err = ifnet_allocate(&Params, &pAda->pIface);
    209209    if (!err)
    210210    {
    211         err = ifnet_attach(pTap->pIface, pMACAddress);
     211        err = ifnet_attach(pAda->pIface, pMACAddress);
    212212        if (!err)
    213213        {
    214             err = ifnet_set_flags(pTap->pIface, IFF_RUNNING | IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST, 0xFFFF);
     214            err = ifnet_set_flags(pAda->pIface, IFF_RUNNING | IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST, 0xFFFF);
    215215            if (!err)
    216216            {
    217                 ifnet_set_mtu(pTap->pIface, VBOXTAP_MTU);
     217                ifnet_set_mtu(pAda->pIface, VBOXNETADA_MTU);
    218218                return VINF_SUCCESS;
    219219            }
    220220            else
    221                 Log(("vboxTAPRegisterDevice: Failed to set flags (err=%d).\n", err));
    222             ifnet_detach(pTap->pIface);
     221                Log(("vboxNetAdaRegisterDevice: Failed to set flags (err=%d).\n", err));
     222            ifnet_detach(pAda->pIface);
    223223        }
    224224        else
    225             Log(("vboxTAPRegisterDevice: Failed to attach to interface (err=%d).\n", err));
    226         ifnet_release(pTap->pIface);
     225            Log(("vboxNetAdaRegisterDevice: Failed to attach to interface (err=%d).\n", err));
     226        ifnet_release(pAda->pIface);
    227227    }
    228228    else
    229         Log(("vboxTAPRegisterDevice: Failed to allocate interface (err=%d).\n", err));
     229        Log(("vboxNetAdaRegisterDevice: Failed to allocate interface (err=%d).\n", err));
    230230
    231231    return RTErrConvertFromErrno(err);
    232232}
    233233
    234 static int vboxTAPUnregisterDevice(PVBOXTAP pTap)
     234static int vboxNetAdaUnregisterDevice(PVBOXNETADA pAda)
    235235{
    236236    u_int32_t i;
    237237    /* Bring down the interface */
    238238    int rc = VINF_SUCCESS;
    239     errno_t err = ifnet_set_flags(pTap->pIface, 0, IFF_UP | IFF_RUNNING);
     239    errno_t err = ifnet_set_flags(pAda->pIface, 0, IFF_UP | IFF_RUNNING);
    240240    if (err)
    241         Log(("vboxTAPUnregisterDevice: Failed to bring down interface "
     241        Log(("vboxNetAdaUnregisterDevice: Failed to bring down interface "
    242242             "(err=%d).\n", err));
    243243    /* Detach all protocols. */
    244     for (i = 0; i < VBOXTAP_MAX_FAMILIES; i++)
    245         if (pTap->aAttachedFamilies[i])
    246             ifnet_detach_protocol(pTap->pIface, pTap->aAttachedFamilies[i]);
     244    for (i = 0; i < VBOXNETADA_MAX_FAMILIES; i++)
     245        if (pAda->aAttachedFamilies[i])
     246            ifnet_detach_protocol(pAda->pIface, pAda->aAttachedFamilies[i]);
    247247    /*
    248248     * We acquire the lock twice: before and after ifnet_detach.
     
    250250     * is released in detach callback.
    251251     */
    252     err = ifnet_detach(pTap->pIface);
     252    err = ifnet_detach(pAda->pIface);
    253253    if (err)
    254         Log(("vboxTAPUnregisterDevice: Failed to detach interface "
     254        Log(("vboxNetAdaUnregisterDevice: Failed to detach interface "
    255255             "(err=%d).\n", err));
    256     Log2(("vboxTAPUnregisterDevice: Trying to acquire lock second time.\n"));
    257     rc = RTSemEventWait(pTap->hEvtDetached, VBOXTAP_DETACH_TIMEOUT);
     256    Log2(("vboxNetAdaUnregisterDevice: Trying to acquire lock second time.\n"));
     257    rc = RTSemEventWait(pAda->hEvtDetached, VBOXNETADA_DETACH_TIMEOUT);
    258258    if (rc == VERR_TIMEOUT)
    259         LogRel(("VBoxTAP: Failed to detach interface %s%d\n.",
    260                 VBOXTAP_NAME, pTap->uUnit));
    261     err = ifnet_release(pTap->pIface);
     259        LogRel(("VBoxNETADA: Failed to detach interface %s%d\n.",
     260                VBOXNETADA_NAME, pAda->uUnit));
     261    err = ifnet_release(pAda->pIface);
    262262    if (err)
    263         Log(("vboxTAPUnregisterDevice: Failed to release interface (err=%d).\n", err));
     263        Log(("vboxNetAdaUnregisterDevice: Failed to release interface (err=%d).\n", err));
    264264   
    265265    return rc;
    266266}
    267267
    268 int vboxTAPCreate (PVBOXTAP *ppTap, PCRTMAC pMac)
     268int vboxNetAdaCreate (PVBOXNETADA *ppAda, PCRTMAC pMac)
    269269{
    270270    int rc;
    271271    unsigned i;
    272272
    273     for (i = 0; i < RT_ELEMENTS(g_aTaps); i++)
    274     {
    275         PVBOXTAP pTap = &g_aTaps[i];
    276         RTSemFastMutexRequest(pTap->hStateMtx);
    277         if (vboxTAPIsVoid(pTap))
     273    for (i = 0; i < RT_ELEMENTS(g_aAdapters); i++)
     274    {
     275        PVBOXNETADA pAda = &g_aAdapters[i];
     276        RTSemFastMutexRequest(pAda->hStateMtx);
     277        if (vboxNetAdaIsVoid(pAda))
    278278        {
    279             pTap->enmState = VBOXTAP_ST_TRANSITIONAL;
    280             RTSemFastMutexRelease(pTap->hStateMtx);
     279            pAda->enmState = VBOXNETADA_ST_TRANSITIONAL;
     280            RTSemFastMutexRelease(pAda->hStateMtx);
    281281            /* Found an empty slot -- use it. */
    282282            struct sockaddr_dl mac;
    283             Assert(pTap->hEvtDetached == NIL_RTSEMEVENT);
    284             rc = RTSemEventCreate(&pTap->hEvtDetached);
     283            Assert(pAda->hEvtDetached == NIL_RTSEMEVENT);
     284            rc = RTSemEventCreate(&pAda->hEvtDetached);
    285285            if (RT_FAILURE(rc))
    286286                return rc;
    287             pTap->uUnit = i;
    288                 vboxTAPComposeMACAddress(pTap, pMac, &mac);
    289             rc = vboxTAPRegisterDevice(pTap, &mac);
    290             *ppTap = pTap;
    291             RTSemFastMutexRequest(pTap->hStateMtx);
    292             pTap->enmState = VBOXTAP_ST_VALID;
    293             RTSemFastMutexRelease(pTap->hStateMtx);
     287            pAda->uUnit = i;
     288                vboxNetAdaComposeMACAddress(pAda, pMac, &mac);
     289            rc = vboxNetAdaRegisterDevice(pAda, &mac);
     290            *ppAda = pAda;
     291            RTSemFastMutexRequest(pAda->hStateMtx);
     292            pAda->enmState = VBOXNETADA_ST_VALID;
     293            RTSemFastMutexRelease(pAda->hStateMtx);
    294294            return rc;
    295295        }
    296         RTSemFastMutexRelease(pTap->hStateMtx);
    297     }
    298 
    299     /* All slots in TAP array are busy. */
     296        RTSemFastMutexRelease(pAda->hStateMtx);
     297    }
     298
     299    /* All slots in NETADA array are busy. */
    300300    return VERR_OUT_OF_RESOURCES;
    301301}
    302302
    303 int vboxTAPDestroy (PVBOXTAP pTap)
     303int vboxNetAdaDestroy (PVBOXNETADA pAda)
    304304{
    305305    int rc;
    306306
    307     RTSemFastMutexRequest(pTap->hStateMtx);
    308     if (!vboxTAPIsValid(pTap))
    309     {
    310         RTSemFastMutexRelease(pTap->hStateMtx);
     307    RTSemFastMutexRequest(pAda->hStateMtx);
     308    if (!vboxNetAdaIsValid(pAda))
     309    {
     310        RTSemFastMutexRelease(pAda->hStateMtx);
    311311        return VERR_INVALID_PARAMETER;
    312312    }
    313     pTap->enmState = VBOXTAP_ST_TRANSITIONAL;
    314     RTSemFastMutexRelease(pTap->hStateMtx);
    315 
    316     rc = vboxTAPUnregisterDevice(pTap);
     313    pAda->enmState = VBOXNETADA_ST_TRANSITIONAL;
     314    RTSemFastMutexRelease(pAda->hStateMtx);
     315
     316    rc = vboxNetAdaUnregisterDevice(pAda);
    317317    if (RT_FAILURE(rc))
    318         Log(("vboxTAPDestroy: Failed to unregister device (rc=%Rrc).\n", rc));
    319 
    320     RTSemEventDestroy(pTap->hEvtDetached);
    321     pTap->hEvtDetached = NIL_RTSEMEVENT;
    322 
    323     RTSemFastMutexRequest(pTap->hStateMtx);
    324     pTap->enmState = VBOXTAP_ST_VOID;
    325     RTSemFastMutexRelease(pTap->hStateMtx);
     318        Log(("vboxNetAdaDestroy: Failed to unregister device (rc=%Rrc).\n", rc));
     319
     320    RTSemEventDestroy(pAda->hEvtDetached);
     321    pAda->hEvtDetached = NIL_RTSEMEVENT;
     322
     323    RTSemFastMutexRequest(pAda->hStateMtx);
     324    pAda->enmState = VBOXNETADA_ST_VOID;
     325    RTSemFastMutexRelease(pAda->hStateMtx);
    326326
    327327    return rc;
    328328}
    329329
    330 int vboxTAPModuleStart(void)
    331 {
    332     memset(&g_aTaps, 0, sizeof(g_aTaps));
    333     for (unsigned i = 0; i < RT_ELEMENTS(g_aTaps); i++)
    334     {
    335         int rc = RTSemFastMutexCreate(&g_aTaps[i].hStateMtx);
     330int vboxNetAdaModuleStart(void)
     331{
     332    memset(&g_aAdapters, 0, sizeof(g_aAdapters));
     333    for (unsigned i = 0; i < RT_ELEMENTS(g_aAdapters); i++)
     334    {
     335        int rc = RTSemFastMutexCreate(&g_aAdapters[i].hStateMtx);
    336336        if (RT_FAILURE(rc))
    337337        {
    338             Log(("VBoxTAP: Failed to create fast mutex (rc=%Rrc).\n", rc));
     338            Log(("VBoxNetAdapter: Failed to create fast mutex (rc=%Rrc).\n", rc));
    339339            return rc;
    340340        }
     
    344344}
    345345
    346 int vboxTAPModuleStop(void)
     346int vboxNetAdaModuleStop(void)
    347347{
    348348    int rc;
    349349    unsigned i;
    350350
    351     for (i = 0; i < RT_ELEMENTS(g_aTaps); i++)
    352     {
    353         vboxTAPDestroy(&g_aTaps[i]);
    354         rc = RTSemFastMutexDestroy(g_aTaps[i].hStateMtx);
     351    for (i = 0; i < RT_ELEMENTS(g_aAdapters); i++)
     352    {
     353        vboxNetAdaDestroy(&g_aAdapters[i]);
     354        rc = RTSemFastMutexDestroy(g_aAdapters[i].hStateMtx);
    355355        if (RT_FAILURE(rc))
    356             Log(("VBoxTAP: Failed to destroy fast mutex (rc=%Rrc).\n", rc));
     356            Log(("VBoxNetAdapter: Failed to destroy fast mutex (rc=%Rrc).\n", rc));
    357357    }
    358358
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette