⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dot11smeibsslib.c

📁 PNE 3.3 wlan source code, running at more than vxworks6.x version
💻 C
📖 第 1 页 / 共 5 页
字号:
            }                /* Zero out the KSL entry for the IBSS, indicating that we are the         creator of the IBSS */        pDot11->sme->type.ibss.pKslIbss = pKsl;        /* Submit a link event indicating that we need to create our own IBSS,        there isn't one existing already */        dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_CREATE_IBSS);        }    /* Free the KSL lock */    if (pDot11->sme->ksl.unlock(pDot11) != OK)            {            DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                      ("dot11SmeIbssJoinReqProcess: Cannot free KSL lock\n",                       0,0,0,0,0,0));            dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);            return ERROR;            }    return OK;    }/***************************************************************************** dot11SmeIbssJoinIbssProcess - Handles a JOIN_IBSS event*** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeIbssJoinIbssProcess    (    DOT11_FW * pDot11                   /* Ptr to DOT11 framework root obj */    )    {    DOT11_IBSS_OBJ * pIbss;    DOT11_KSL_ENTRY * pKsl;    pIbss = &pDot11->sme->type.ibss;    DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,              ("dot11SmeIbssJoinIbss: Started\n",               0,0,0,0,0,0));    /* Get the lock on the KSL so that it cannot change while we're adopting     it's information */    if (pDot11->sme->ksl.lock(pDot11) != OK)            {            DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                      ("dot11SmeIbssJoinIbssProcess: Cannot get KSL lock\n",                       0,0,0,0,0,0));            dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);            return ERROR;            }    /* Sanity check: we can't join an IBSS if we don't have a KSL entry for    the nearest station on that IBSS */    if ((pKsl = pIbss->pKslIbss) == NULL)        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeIbssJoinIbssProcess: No KSL entry for IBSS\n",                   0,0,0,0,0,0));        pDot11->sme->ksl.unlock(pDot11);        dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);        return ERROR;        }        /* Now, adopt the IBSS parameters of the other station */    pDot11->sme->beaconInterval = pKsl->type.ibss.beaconInterval;    pIbss->atimWindow = pKsl->type.ibss.atimWindow;    bcopy((char *)pKsl->type.ibss.bssid, (char *)DOT11_DEFAULT_BSS->bssid,           DOT11_ADDR_LEN);        /* Free the KSL lock */    if (pDot11->sme->ksl.unlock(pDot11) != OK)            {            DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                      ("dot11SmeIbssJoinIbssProcess: Cannot free KSL lock\n",                       0,0,0,0,0,0));            dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);            return ERROR;            }    /* Set the BSSID, but just enter zero as the AID and the TIM offset, since    those fields are not applicable to IBSS */    pDot11->hdd->bssidSet(pDot11, DOT11_DEFAULT_BSS->bssid, 0,0);    /* Form up the new beacon.  If this is the first IBSS we've joined since     starting IBSS mode, then beacon update will create a beacon. */    if (dot11SmeIbssBeaconUpdate(pDot11) != OK)        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeIbssJoinIbssProcess: Cannot create beacon!\n",                   0,0,0,0,0,0));        dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);        return ERROR;        }               /* Set the state to syncronizing */    taskLock();    pIbss->state = DOT11_IBSS_STATE_SYNC;    taskUnlock();    /* Check if we are already synchronized (a beacon was received from this    station while scanning) and send the sync request. */    if (pIbss->syncBeacon)        {        DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,                  ("dot11SmeIbssJoinIbssProcess: AutoSync!\n",                   0,0,0,0,0,0));        dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_SYNC_IBSS);                }            /* If we weren't syncronized, just hold on.  The next beacon that is     received on this bssid will be syncronized to, and the event issued. */    return OK;    }/***************************************************************************** dot11SmeIbssCreateIbssProcess - Handles a CREATE_IBSS event*** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeIbssCreateIbssProcess    (    DOT11_FW * pDot11                   /* Ptr to DOT11 framework root obj */    )    {    DOT11_IBSS_OBJ * pIbss;        pIbss = &pDot11->sme->type.ibss;    DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,              ("dot11SmeIbssCreateIbss: Started for BSSID "                DOT11_MAC_ADDR_STR "\n",                DOT11_MAC_ADDR(DOT11_DEFAULT_BSS->bssid)));    if ((DOT11_DEFAULT_BSS->bssid[0] | DOT11_DEFAULT_BSS->bssid[1] | DOT11_DEFAULT_BSS->bssid[2] |          DOT11_DEFAULT_BSS->bssid[3] | DOT11_DEFAULT_BSS->bssid[4] | DOT11_DEFAULT_BSS->bssid[5]) == 0)        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeIbssCreateIbss: Invalid BSSID "                    DOT11_MAC_ADDR_STR "\n",                    DOT11_MAC_ADDR(DOT11_DEFAULT_BSS->bssid)));        dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);        return ERROR;        }    /* Set the BSSID, but just enter zero as the AID and the TIM offset, since    those fields are not applicable to IBSS */    pDot11->hdd->bssidSet(pDot11, DOT11_DEFAULT_BSS->bssid, 0,0);    /* Form up the new beacon.  If this is the first IBSS we've joined since     starting IBSS mode, then beacon update will create a beacon. */    if ((dot11SmeIbssBeaconUpdate(pDot11) != OK) ||         (dot11SmeIbssBeaconStart(pDot11, DOT11_IBSS_BEACON_START_IMMED) != OK))        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeIbssCreateIbssProcess: Cannot create beacon!\n",                   0,0,0,0,0,0));        dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);        return ERROR;        }        taskLock();    pIbss->state = DOT11_IBSS_STATE_CONNECTED;    taskUnlock();    return OK;    }/***************************************************************************** dot11SmeIbssSyncIbssProcess - Handles the SYNC_IBSS event** This routine synchronizes to an existing IBSS.  It can be called during* a JOIN_IBSS or at any point while connected if the state machine senses that* we have lost synchronization.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeIbssSyncIbssProcess    (    DOT11_FW * pDot11                   /* Ptr to DOT11 framework root obj */    )    {    DOT11_IBSS_OBJ * pIbss;             /* Ptr to IBSS specific data */    DOT11_KSL_ENTRY * pKsl;             /* Ptr to IBSS KSL entry */    INT32 lastBeacon;                   /* time (in tu) of next beacon */    DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,              ("dot11SmeIbssSyncIbssProcess: Started!\n",               0,0,0,0,0,0));    pIbss = &pDot11->sme->type.ibss;    /* Sanity check: we can't sync with an IBSS if we don't have a KSL entry    for a station on that IBSS */    if ((pKsl = pIbss->pKslIbss) == NULL)        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeIbssSyncIbssProcess: No KSL entry for IBSS\n",                   0,0,0,0,0,0));        dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);        return ERROR;        }    /* Get the lock on the KSL so that it cannot change while we're adopting     it's information */    if (pDot11->sme->ksl.lock(pDot11) != OK)            {            DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                      ("dot11SmeIbssSyncIbssProcess: Cannot get KSL lock\n",                       0,0,0,0,0,0));            dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);            return ERROR;            }    /* calculate the time until the next beacon */    lastBeacon = DOT11_TSF_TO_TU(pKsl->type.ibss.ourTsf);        /* Free the KSL lock */    if (pDot11->sme->ksl.unlock(pDot11) != OK)            {            DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                      ("dot11SmeIbssSyncIbssProcess: Cannot free KSL lock\n",                       0,0,0,0,0,0));            dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);            return ERROR;            }    /* Actually start beacons, synchronized with the other device's */    if (dot11SmeIbssBeaconStart(pDot11, lastBeacon) != OK)        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeIbssSyncIbssProcess: Cannot get KSL lock\n",                   0,0,0,0,0,0));        dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);        return ERROR;                   }    taskLock();    pIbss->state = DOT11_IBSS_STATE_CONNECTED;    taskUnlock();    return OK;    }/***************************************************************************** dot11SmeIbssDataReceive - Handles incoming data packets, passes to DPE** This is a wrapper routine on ingress packets in an IBSS.  The immediate* transmitter of the packets is looked up in the KSL, and if no entry exists,* an entry is created.  This is necessary to support a WEP key-mapping table* as well as advanced encryption algorithms where each station needs a * unique KSL entry.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeIbssDataReceive    (    DOT11_FW * pDot11,                  /* Ptr to DOT11 framework root obj */    M_BLK_ID pMblk,                   /* ClBlk with received packet */    UINT32 rate,                        /* Rate pkt was received at */    UINT8 ssi                           /* SSI of received packet */    )    {    DOT11_IBSS_OBJ * pIbss;             /* Ptr to IBSS specific data */    UINT8 * pCluster;                   /* Cluster containing rx pkt */    DOT11_HEADER * pHeader;             /* 802.11 header */    DOT11_KSL_ENTRY * pKsl;             /* Location in KSL of the source */    pIbss = &pDot11->sme->type.ibss;    pCluster = (UINT8 *)pMblk->mBlkHdr.mData;    pHeader = (DOT11_HEADER *)pCluster;    DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,              ("dot11SmeIbssDataReceive: Started\n",               0,0,0,0,0,0));        /* Double check that this packet belongs to the current BSSID */    if (bcmp((char *)DOT11_DEFAULT_BSS->bssid, (char *)pHeader->addr3,              DOT11_ADDR_LEN) != 0)        {        DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,                  ("dot11SmeIbssDataReceive: Discarding packet from other "                   "BSSID" DOT11_MAC_ADDR_STR "\n",                    DOT11_MAC_ADDR(pHeader->addr3)));        netMblkClChainFree(pMblk);        return ERROR;        }        /* See if there is a KSL entry, or create one if not */    if ((pKsl = dot11SmeIbssKslUpdate(pDot11, pHeader)) == NULL)        {        /* Error message would have been handled at upper layer */        netMblkClChainFree(pMblk);        return ERROR;        }    return pDot11->dpe->endReceive(pDot11, pMblk, rate, ssi);    }/***************************************************************************** dot11SmeIbssBeaconReceive - Handles incoming probe resp and beacon pkts** This routine is called for incoming probe response and beacon packets.  It* stores ** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeIbssBeaconReceive    (    DOT11_FW * pDot11,                  /* Ptr to DOT11 framework root obj */    M_BLK_ID pMblk,                   /* ClBlk with received packet */    UINT32 rate,                        /* Rate pkt was received at */    UINT8 ssi                           /* SSI of received packet */    )    {    DOT11_IBSS_OBJ * pIbss;             /* Ptr to IBSS data */    UINT8 * pCluster;                   /* Cluster containing rx pkt */    UINT8 * pBug;                       /* Crawls through packet */    DOT11_HEADER * pHeader;             /* 802.11 header */    DOT11_KSL_ENTRY * pKsl;             /* KSL entry for source station */    BOOL newKsl;    UINT32 length;    /* These are pointers to elements used to form the KSl entry */    DOT11_IE_SSID * pSsid;              /* Pointer to SSID IE */    DOT11_IE_GENERIC * pIe;             /* Generic IE for parsing IE */        pIbss = &pDot11->sme->type.ibss;    DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,              ("dot11SmeIbssBeaconReceive: Started\n",               0,0,0,0,0,0));    pCluster = (UINT8 *)pMblk->mBlkHdr.mData;    pHeader = (DOT11_HEADER *)pCluster;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -