亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mac.c

?? zigbee 2004協(xié)議棧
?? C
?? 第 1 頁 / 共 4 頁
字號:
  phy_pib.currentTxFrm--;
  *phy_pib.currentTxFrm = LRWPAN_NWK_MAGICNUM_B0;
#endif

  phy_pib.currentTxFrm--;
  *phy_pib.currentTxFrm = mac_pib.macCapInfo;

  phy_pib.currentTxFrm--;
  *phy_pib.currentTxFrm = LRWPAN_MACCMD_ASSOC_REQ;

  phy_pib.currentTxFlen = LRWPAN_MACCMD_ASSOC_REQ_PAYLOAD_LEN;

}

#ifndef LRWPAN_COORDINATOR
//parse the association response
static void macParseAssocResponse(void){
  BYTE *ptr;
  SADDR saddr;

  //first, ensure that the payload length is correct
  //the +1 is because the offset takes into account the lenght byte at the start of the packet
  if ( (*(a_mac_rx_data.orgpkt->data)-a_mac_rx_data.pload_offset-PACKET_FOOTER_SIZE +1)
      != LRWPAN_MACCMD_ASSOC_RSP_PAYLOAD_LEN ) {
        DEBUG_STRING( DBG_INFO, "MAC: Failed to join, illegal assoc response\n");
        return; //wrong length
      }
  ptr = a_mac_rx_data.orgpkt->data + a_mac_rx_data.pload_offset;
  //check the status first which is last byte of the payload
  if (LRWPAN_GET_ASSOC_STATUS(*(ptr+LRWPAN_MACCMD_ASSOC_RSP_PAYLOAD_LEN-1)) != LRWPAN_ASSOC_STATUS_SUCCESS) {
    //failed to join
    DEBUG_STRING( DBG_INFO, "MAC: Failed to join, remote node rejected us.\n");
    return;
  }
  ptr++; //skip command byte

  //successful join, get my short SADDR
  saddr = (BYTE) *ptr;
  ptr++;
  saddr += (((UINT16) *ptr) << 8);
  macSetShortAddr(saddr);
  ptr++;

  //our PANID is our parent's panid.
  mac_pib.macPANID = a_mac_rx_data.SrcPANID;
  halSetRadioPANID(a_mac_rx_data.SrcPANID);

#ifndef IEEE_802_COMPLY
  //the short address of the parent are extra bytes in this payload
  mac_pib.macCoordShortAddress = (BYTE) *ptr;
  ptr++;
  mac_pib.macCoordShortAddress += (((UINT16) *ptr) << 8);
  ptr++;
  //get the depth of parent, our depth is 1+ that of our parent
  mac_pib.depth = *ptr + 1;
#else

#ifndef LRWPAN_FORCE_ASSOCIATION_TARGET
  //if we are not using forced association, then the beacon response
  //we got had the short address that we used for the association request,
  //so the short address of the beacon responder is our parent
  mac_pib.macCoordShortAddress = mac_pib.bcnSADDR;
  //beacon response also has the depth of our parent, so our depth is 1+ this
  mac_pib.depth = mac_pib.bcnDepth+1;
#endif


#endif

  //copy the SRC long address as my coordinator long address
  mac_pib.macCoordExtendedAddress.bytes[0] = a_mac_rx_data.SrcAddr.laddr.bytes[0];
  mac_pib.macCoordExtendedAddress.bytes[1] = a_mac_rx_data.SrcAddr.laddr.bytes[1];
  mac_pib.macCoordExtendedAddress.bytes[2] = a_mac_rx_data.SrcAddr.laddr.bytes[2];
  mac_pib.macCoordExtendedAddress.bytes[3] = a_mac_rx_data.SrcAddr.laddr.bytes[3];
  mac_pib.macCoordExtendedAddress.bytes[4] = a_mac_rx_data.SrcAddr.laddr.bytes[4];
  mac_pib.macCoordExtendedAddress.bytes[5] = a_mac_rx_data.SrcAddr.laddr.bytes[5];
  mac_pib.macCoordExtendedAddress.bytes[6] = a_mac_rx_data.SrcAddr.laddr.bytes[6];
  mac_pib.macCoordExtendedAddress.bytes[7] = a_mac_rx_data.SrcAddr.laddr.bytes[7];



  //indicate that the association was successful
  mac_pib.flags.bits.macIsAssociated = 1;
  mac_pib.flags.bits.ackPending = 0;  //only one outstanding association req, clear the ack bit
  DEBUG_STRING(DBG_INFO,"MAC:Received good association response!\n");

}
#endif


#ifndef  LRWPAN_COORDINATOR
//Parse the coordinator realignment (Orphan response)
static void macParseOrphanResponse(void){
  BYTE *ptr;
  UINT16 tmp;


  //first, ensure that the payload length is correct
  //the +1 is because the offset takes into account the lenght byte at the start of the packet
  if ( (*(a_mac_rx_data.orgpkt->data)-a_mac_rx_data.pload_offset-PACKET_FOOTER_SIZE +1)
      != LRWPAN_MACCMD_COORD_REALIGN_PAYLOAD_LEN ) {
        DEBUG_STRING( DBG_INFO, "MAC: illegal Coord Alignment packet\n");
        return; //wrong length
      }
  ptr = a_mac_rx_data.orgpkt->data + a_mac_rx_data.pload_offset;

  DEBUG_STRING(DBG_INFO, "Received Coord Realign (Orphan response)\n");
  mac_pib.flags.bits.GotOrphanResponse = 1;
  mac_pib.flags.bits.macIsAssociated = 1;  //we are associated with somebody!
   mac_pib.flags.bits.ackPending = 0;

  ptr++; //skip command byte

  //get the PANID
  tmp = (BYTE) *ptr;
  ptr++;
  tmp += (((UINT16) *ptr) << 8);
  ptr++;
  macSetPANID(tmp);

  //get the coordinator short address
  mac_pib.macCoordShortAddress = (BYTE) *ptr;
  ptr++;
  mac_pib.macCoordShortAddress += (((UINT16) *ptr) << 8);
  ptr++;

  tmp =(BYTE) *ptr; //get the channel
  ptr++;

  macSetChannel(tmp);  //set the channel

#ifndef LRWPAN_COORDINATOR

  //copy the SRC long address as my coordinator long address
  mac_pib.macCoordExtendedAddress.bytes[0] = a_mac_rx_data.SrcAddr.laddr.bytes[0];
  mac_pib.macCoordExtendedAddress.bytes[1] = a_mac_rx_data.SrcAddr.laddr.bytes[1];
  mac_pib.macCoordExtendedAddress.bytes[2] = a_mac_rx_data.SrcAddr.laddr.bytes[2];
  mac_pib.macCoordExtendedAddress.bytes[3] = a_mac_rx_data.SrcAddr.laddr.bytes[3];
  mac_pib.macCoordExtendedAddress.bytes[4] = a_mac_rx_data.SrcAddr.laddr.bytes[4];
  mac_pib.macCoordExtendedAddress.bytes[5] = a_mac_rx_data.SrcAddr.laddr.bytes[5];
  mac_pib.macCoordExtendedAddress.bytes[6] = a_mac_rx_data.SrcAddr.laddr.bytes[6];
  mac_pib.macCoordExtendedAddress.bytes[7] = a_mac_rx_data.SrcAddr.laddr.bytes[7];


#endif

#ifdef LRWPAN_RFD
  //get our short address
  tmp = (BYTE) *ptr;
  ptr++;
  tmp += (((UINT16) *ptr) << 8);
  ptr++;
  macSetShortAddr(tmp);
#else
  //this is a router
   //get our short ADDR

   tmp = (BYTE) *ptr;
   ptr++;
   tmp += (((UINT16) *ptr) << 8);
   ptr++;

   if (tmp != macGetShortAddr()) {
	   //our short address has changed!
	   //everything may have changed,
	   //clear neighbor table, and address map
	   ntInitAddressMap();
	   ntInitTable();
  }
  macSetShortAddr(tmp);
#endif

}

#endif



static void macFormatOrphanNotify(void){
phy_pib.currentTxFrm = &tmpTxBuff[LRWPAN_MAX_FRAME_SIZE-1];
  *phy_pib.currentTxFrm = LRWPAN_MACCMD_ORPHAN;
   phy_pib.currentTxFlen = 1;
}



#ifdef LRWPAN_FFD

static void macFormatCoordRealign(SADDR orphan_saddr){
  //format and send the realignment packet
  //first is the orphans short address
  phy_pib.currentTxFrm = &tmpTxBuff[LRWPAN_MAX_FRAME_SIZE-1];
  *phy_pib.currentTxFrm = (BYTE) (orphan_saddr >>8);

  --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = (BYTE) (orphan_saddr);

  //logical channel
  --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = phy_pib.phyCurrentChannel;

   //our short addresss
 --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = (BYTE) (macGetShortAddr()>>8);

  --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = (BYTE) (macGetShortAddr());

  //our PANID

--phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = (BYTE) (mac_pib.macPANID>>8);

  --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = (BYTE) (mac_pib.macPANID);


  --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = LRWPAN_MACCMD_COORD_REALIGN;


  phy_pib.currentTxFlen = LRWPAN_MACCMD_COORD_REALIGN_PAYLOAD_LEN;
}




static void macFormatAssociationResponse(void){
  NAYBORENTRY *ntptr;
  UINT16 new_saddr;
  BYTE tmp, capinfo;


  new_saddr = 0xFFFF;
  tmp = LRWPAN_ASSOC_STATUS_DENIED;  //default status

  //check reasons to reject first
  //check payload length
  if ( (*(a_mac_rx_data.orgpkt->data)-a_mac_rx_data.pload_offset-PACKET_FOOTER_SIZE+1 )
      != LRWPAN_MACCMD_ASSOC_REQ_PAYLOAD_LEN) {
        //invalid payload length
        DEBUG_STRING(DBG_INFO,"MAC:Invalid association request, rejecting node!\n");
        goto macFormatAssociationResponse_dopkt;
      }

#ifndef IEEE_802_COMPLY
  {
    BYTE *ptr;
    //Check Magic Number
    ptr = a_mac_rx_data.orgpkt->data + a_mac_rx_data.pload_offset;
    if (*(ptr+2) != LRWPAN_NWK_MAGICNUM_B0){
      goto macFormatAssociationResponse_dopkt;
    }
    if (*(ptr+3) != LRWPAN_NWK_MAGICNUM_B1){
      goto macFormatAssociationResponse_dopkt;
    }
    if (*(ptr+4) != LRWPAN_NWK_MAGICNUM_B2){
      goto macFormatAssociationResponse_dopkt;
    }
    if (*(ptr+5) != LRWPAN_NWK_MAGICNUM_B3){
      goto macFormatAssociationResponse_dopkt;
    }
  }
#endif

  //now, see if this node is in the table
  ntptr = ntFindByLADDR(&a_mac_rx_data.SrcAddr.laddr);
  if (ntptr) {
	   new_saddr = mac_addr_tbl[ntptr->map_index].saddr;
           tmp = LRWPAN_ASSOC_STATUS_SUCCESS;
           goto macFormatAssociationResponse_dopkt;
  }
  //node is not in table. Look at capability info byte and see if we
  //have room for this node type
  capinfo = *(a_mac_rx_data.orgpkt->data + a_mac_rx_data.pload_offset + 1);

  //node is not in table. Do final check with user
  if (!usrJoinVerifyCallback(&a_mac_rx_data.SrcAddr.laddr, capinfo)) {
    tmp = LRWPAN_ASSOC_STATUS_DENIED;
    goto macFormatAssociationResponse_dopkt;
  }


  if ( ((LRWPAN_GET_CAPINFO_DEVTYPE(capinfo)) && (mac_pib.ChildRouters == LRWPAN_MAX_ROUTERS_PER_PARENT))
      ||
        (!(LRWPAN_GET_CAPINFO_DEVTYPE(capinfo)) && (mac_pib.ChildRFDs == LRWPAN_MAX_NON_ROUTER_CHILDREN)))
    //no room left
  {
    //no room
    tmp = LRWPAN_ASSOC_STATUS_NOROOM;
    goto macFormatAssociationResponse_dopkt;

  }

  //not in table, Add this node
  new_saddr = ntAddNeighbor(&a_mac_rx_data.SrcAddr.laddr.bytes[0],capinfo);
  if (new_saddr == LRWPAN_BCAST_SADDR) {
	  //this is an error indication, adding neighbor failed
      tmp = LRWPAN_ASSOC_STATUS_NOROOM;
	  goto macFormatAssociationResponse_dopkt;
  }
  DEBUG_STRING(DBG_INFO,"MAC:Sending good association response!\n");
  tmp = LRWPAN_ASSOC_STATUS_SUCCESS;
  usrJoinNotifyCallback(&a_mac_rx_data.SrcAddr.laddr);

macFormatAssociationResponse_dopkt:

   if (tmp ==  LRWPAN_ASSOC_STATUS_SUCCESS) {
        DEBUG_STRING(DBG_INFO,"MAC:Sending good association response!\n");
   } else {
     DEBUG_STRING(DBG_INFO,"MAC:Rejecting assoc request: ");
     DEBUG_UINT8(DBG_INFO,tmp);
     DEBUG_STRING(DBG_INFO,"\n");
    }

  //format and send the packet
  //status byte
  phy_pib.currentTxFrm = &tmpTxBuff[LRWPAN_MAX_FRAME_SIZE-1];
  *phy_pib.currentTxFrm = tmp;

#ifndef IEEE_802_COMPLY
   //put our depth, short address so that the RFD will know both
  //the radius, short and long addresses even if Beacon request has not been done
   --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = mac_pib.depth;

  --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = (BYTE) (macGetShortAddr()>>8);

  --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = (BYTE) (macGetShortAddr());
#endif
  //new short address for the RFD
  --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = (BYTE) (new_saddr>>8);

  --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = (BYTE) (new_saddr);

  //CMD

  --phy_pib.currentTxFrm;
  *phy_pib.currentTxFrm = LRWPAN_MACCMD_ASSOC_RSP;

  phy_pib.currentTxFlen = LRWPAN_MACCMD_ASSOC_RSP_PAYLOAD_LEN;

}

#endif


//check for DATA packets
//For RFD, just check if this packet came from parent
//For Routers, if this uses SHORT addressing, then check
//to see if this is associated with us

static BOOL macCheckDataRejection(void){

	BYTE AddrMode,i;

	
	//if not associated, reject
#ifndef LRWPAN_COORDINATOR
	if (!mac_pib.flags.bits.macIsAssociated) {
		DEBUG_STRING(DBG_INFO, "MAC: Rejecting data pkt as we are not associated\n");
		return(FALSE);
	}
#endif
    AddrMode = LRWPAN_GET_DST_ADDR(a_mac_rx_data.fcfmsb);

	if (AddrMode == LRWPAN_ADDRMODE_LADDR) {
		//this packet send directly to our long address. accept it.
		return(TRUE);
	}

	//check the parent
	AddrMode = LRWPAN_GET_SRC_ADDR(a_mac_rx_data.fcfmsb);
	if (AddrMode == LRWPAN_ADDRMODE_SADDR) {
		//check parent short address
		if (a_mac_rx_data.SrcAddr.saddr == mac_pib.macCoordShortAddress)
			return(TRUE);
	} else if (AddrMode == LRWPAN_ADDRMODE_LADDR){
		//check parent long address.
		for (i=0;i<8;i++) {
			if (a_mac_rx_data.SrcAddr.laddr.bytes[i] !=
				mac_pib.macCoordExtendedAddress.bytes[i])
				break;
		}
		if (i==8) return(TRUE); //have a match
	}
#ifdef LRWPAN_RFD
	DEBUG_STRING(DBG_INFO, "MAC: Rejecting data pkt from unassociated node\n");
	return(FALSE);
#else
	//ok, for FFDs, check the neighbor table
	if (AddrMode == LRWPAN_ADDRMODE_SADDR){
		if (ntFindBySADDR (a_mac_rx_data.SrcAddr.saddr) !=(NAYBORENTRY *) NULL)
			return(TRUE);
	}else if (AddrMode == LRWPAN_ADDRMODE_LADDR){
        if (ntFindByLADDR (&a_mac_rx_data.SrcAddr.laddr))
			return(TRUE);
	}
    DEBUG_STRING(DBG_INFO, "MAC: Rejecting data pkt from unassociated node\n");
	return(FALSE);
#endif
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产精品一区二区夜夜嗨| 欧美三级电影网站| 亚洲综合一区在线| 国产精品三级电影| 国产日本欧美一区二区| 精品播放一区二区| 久久精品一区蜜桃臀影院| 久久综合九色综合97婷婷女人| 日韩欧美在线网站| 欧美日韩国产影片| 欧美一区二区三区四区高清| 欧美久久高跟鞋激| 日韩美女视频在线| 日韩三级视频在线观看| 精品国产三级a在线观看| 欧美一区欧美二区| 精品国产麻豆免费人成网站| 日韩精品在线网站| 久久精品无码一区二区三区| 久久久不卡网国产精品二区| 欧美日韩大陆一区二区| 欧美日韩一区二区在线观看| 日本高清不卡视频| 在线精品视频一区二区三四| 91极品美女在线| 欧美在线观看一二区| 欧美精选在线播放| 欧美电影免费观看高清完整版| 久久伊人中文字幕| 精品免费国产二区三区| 久久精品一级爱片| 国产日韩欧美麻豆| 中文字幕一区二区不卡| 亚洲精品免费播放| 五月婷婷综合激情| 狠狠色狠狠色综合系列| 国产mv日韩mv欧美| 久久99精品国产91久久来源| 国产精品一二三四| gogogo免费视频观看亚洲一| 欧美在线小视频| 精品久久一区二区三区| 久久精品男人的天堂| 亚洲精品国产精华液| 日韩中文字幕不卡| 成人午夜激情影院| 欧美少妇性性性| 久久五月婷婷丁香社区| 中文字幕亚洲区| 青青草原综合久久大伊人精品 | 91丝袜美腿高跟国产极品老师 | 欧美日韩dvd在线观看| 欧美刺激午夜性久久久久久久| 久久综合九色综合久久久精品综合 | 精品国产91亚洲一区二区三区婷婷| 欧美激情中文字幕一区二区| 亚洲欧洲另类国产综合| 一区二区三区在线观看动漫| 日本成人在线视频网站| 亚洲成人1区2区| 国产在线精品一区二区| 一本色道**综合亚洲精品蜜桃冫| 精品国产亚洲在线| 成人欧美一区二区三区视频网页| 蜜臀a∨国产成人精品| 成人综合在线观看| 欧美日韩国产123区| 久久婷婷国产综合国色天香| 五月天视频一区| 成人午夜免费视频| 久久综合九色综合欧美98| 亚洲一区二区欧美日韩| 成人动漫一区二区在线| 91精品国产综合久久香蕉的特点| 中文字幕一区二区三区不卡 | 亚洲蜜臀av乱码久久精品| 日本91福利区| av中文字幕不卡| 精品日韩欧美一区二区| 亚洲图片欧美色图| 成人丝袜高跟foot| 欧美大白屁股肥臀xxxxxx| 亚洲人成网站在线| 国产精品66部| 日韩欧美一卡二卡| 天堂一区二区在线免费观看| 成人av片在线观看| 国产欧美一区二区在线| 日本不卡免费在线视频| 3d成人动漫网站| 亚洲精品自拍动漫在线| 99视频有精品| 国产区在线观看成人精品| 久久97超碰国产精品超碰| av亚洲精华国产精华| 国产欧美日韩另类一区| 日韩av不卡一区二区| 欧美日韩精品高清| 国产精品美女久久福利网站| 国产成人免费av在线| 色婷婷综合久色| 亚洲色图20p| 精品一区二区日韩| 精品国产青草久久久久福利| 91精品国产综合久久久久| 久久久无码精品亚洲日韩按摩| 视频一区在线视频| 99国产麻豆精品| 国产精品乱码一区二区三区软件 | 一区二区三区四区在线免费观看| 99久久久免费精品国产一区二区| 久久久综合激的五月天| 国产精品主播直播| 久久久久久久久久电影| 国产成人午夜精品5599| 久久综合狠狠综合久久综合88| 精品在线观看视频| 精品国产乱码久久| 福利电影一区二区三区| 久久久久国产成人精品亚洲午夜| 美女视频网站久久| 日韩视频一区二区三区| 亚州成人在线电影| 日韩一区二区三区免费看 | 久久久精品2019中文字幕之3| 久久99久久久欧美国产| 欧美va亚洲va香蕉在线| 久久99国产精品免费| 精品国产乱码久久久久久老虎 | 国产精品久久久久一区| 成人免费三级在线| 国产色91在线| 99久久久精品| 一二三四社区欧美黄| 在线日韩一区二区| 亚洲不卡av一区二区三区| 日韩一区二区三区在线| 另类小说综合欧美亚洲| 国产欧美一区二区精品秋霞影院 | 欧美性猛交xxxx乱大交退制版| 亚洲人123区| 91精品国产一区二区三区| 久草精品在线观看| 成人欧美一区二区三区1314 | 91九色最新地址| 日韩av电影免费观看高清完整版在线观看| 91精品黄色片免费大全| 成人在线综合网| 中文字幕一区二区三区精华液| 欧美日韩国产电影| 蜜臂av日日欢夜夜爽一区| 久久久久久**毛片大全| 色综合久久久久久久久久久| 日日夜夜免费精品| 国产欧美日韩不卡免费| 色噜噜狠狠一区二区三区果冻| 毛片一区二区三区| 亚洲国产精品99久久久久久久久| 久久国产三级精品| 欧美精三区欧美精三区| 国产精品一区二区视频| 亚洲另类春色国产| 精品成人在线观看| 色综合夜色一区| 美女在线视频一区| 亚洲欧洲日产国产综合网| 日韩精品中文字幕一区二区三区| 国产成人免费在线视频| 日韩成人午夜电影| 久久久一区二区三区| 91精品国产综合久久久久久久| 大胆欧美人体老妇| 午夜电影一区二区| 综合久久久久综合| 精品国产污网站| 欧美精品三级在线观看| 丁香激情综合五月| 久久99热狠狠色一区二区| 亚洲综合一区二区| 亚洲视频香蕉人妖| 欧美不卡一区二区| 69堂精品视频| 91麻豆国产在线观看| 高潮精品一区videoshd| 日本伊人色综合网| 亚洲成人免费在线观看| 国产欧美久久久精品影院| 在线播放中文一区| 欧美天天综合网| 成人福利视频网站| 男人操女人的视频在线观看欧美| 国产精品久久久久影视| 欧美变态tickle挠乳网站| 欧美色区777第一页| 成人激情av网| 国产成人精品亚洲777人妖| 日本免费在线视频不卡一不卡二| 亚洲精品伦理在线| 中文字幕av一区二区三区| 日韩一区二区不卡|