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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ip_frag.c

?? freescale k40/k60 freertos-lwip例程
?? C
?? 第 1 頁 / 共 2 頁
字號:
      iprh_prev->next_pbuf = new_p;      if (iprh_prev->end != iprh->start) {        valid = 0;      }    } else {#if IP_REASS_CHECK_OVERLAP      LWIP_ASSERT("no previous fragment, this must be the first fragment!",        ipr->p == NULL);#endif /* IP_REASS_CHECK_OVERLAP */      /* this is the first fragment we ever received for this ip datagram */      ipr->p = new_p;    }  }  /* At this point, the validation part begins: */  /* If we already received the last fragment */  if ((ipr->flags & IP_REASS_FLAG_LASTFRAG) != 0) {    /* and had no wholes so far */    if (valid) {      /* then check if the rest of the fragments is here */      /* Check if the queue starts with the first datagram */      if (((struct ip_reass_helper*)ipr->p->payload)->start != 0) {        valid = 0;      } else {        /* and check that there are no wholes after this datagram */        iprh_prev = iprh;        q = iprh->next_pbuf;        while (q != NULL) {          iprh = (struct ip_reass_helper*)q->payload;          if (iprh_prev->end != iprh->start) {            valid = 0;            break;          }          iprh_prev = iprh;          q = iprh->next_pbuf;        }        /* if still valid, all fragments are received         * (because to the MF==0 already arrived */        if (valid) {          LWIP_ASSERT("sanity check", ipr->p != NULL);          LWIP_ASSERT("sanity check",            ((struct ip_reass_helper*)ipr->p->payload) != iprh);          LWIP_ASSERT("validate_datagram:next_pbuf!=NULL",            iprh->next_pbuf == NULL);          LWIP_ASSERT("validate_datagram:datagram end!=datagram len",            iprh->end == ipr->datagram_len);        }      }    }    /* If valid is 0 here, there are some fragments missing in the middle     * (since MF == 0 has already arrived). Such datagrams simply time out if     * no more fragments are received... */    return valid;  }  /* If we come here, not all fragments were received, yet! */  return 0; /* not yet valid! */#if IP_REASS_CHECK_OVERLAPfreepbuf:  ip_reass_pbufcount -= pbuf_clen(new_p);  pbuf_free(new_p);  return 0;#endif /* IP_REASS_CHECK_OVERLAP */}/** * Reassembles incoming IP fragments into an IP datagram. * * @param p points to a pbuf chain of the fragment * @return NULL if reassembly is incomplete, ? otherwise */struct pbuf *ip_reass(struct pbuf *p){  struct pbuf *r;  struct ip_hdr *fraghdr;  struct ip_reassdata *ipr;  struct ip_reass_helper *iprh;  u16_t offset, len;  u8_t clen;  struct ip_reassdata *ipr_prev = NULL;  IPFRAG_STATS_INC(ip_frag.recv);  snmp_inc_ipreasmreqds();  fraghdr = (struct ip_hdr*)p->payload;  if ((IPH_HL(fraghdr) * 4) != IP_HLEN) {    LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass: IP options currently not supported!\n"));    IPFRAG_STATS_INC(ip_frag.err);    goto nullreturn;  }  offset = (ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) * 8;  len = ntohs(IPH_LEN(fraghdr)) - IPH_HL(fraghdr) * 4;  /* Check if we are allowed to enqueue more datagrams. */  clen = pbuf_clen(p);  if ((ip_reass_pbufcount + clen) > IP_REASS_MAX_PBUFS) {#if IP_REASS_FREE_OLDEST    if (!ip_reass_remove_oldest_datagram(fraghdr, clen) ||        ((ip_reass_pbufcount + clen) > IP_REASS_MAX_PBUFS))#endif /* IP_REASS_FREE_OLDEST */    {      /* No datagram could be freed and still too many pbufs enqueued */      LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass: Overflow condition: pbufct=%d, clen=%d, MAX=%d\n",        ip_reass_pbufcount, clen, IP_REASS_MAX_PBUFS));      IPFRAG_STATS_INC(ip_frag.memerr);      /* @todo: send ICMP time exceeded here? */      /* drop this pbuf */      goto nullreturn;    }  }  /* Look for the datagram the fragment belongs to in the current datagram queue,   * remembering the previous in the queue for later dequeueing. */  for (ipr = reassdatagrams; ipr != NULL; ipr = ipr->next) {    /* Check if the incoming fragment matches the one currently present       in the reassembly buffer. If so, we proceed with copying the       fragment into the buffer. */    if (IP_ADDRESSES_AND_ID_MATCH(&ipr->iphdr, fraghdr)) {      LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: matching previous fragment ID=%"X16_F"\n",        ntohs(IPH_ID(fraghdr))));      IPFRAG_STATS_INC(ip_frag.cachehit);      break;    }    ipr_prev = ipr;  }  if (ipr == NULL) {  /* Enqueue a new datagram into the datagram queue */    ipr = ip_reass_enqueue_new_datagram(fraghdr, clen);    /* Bail if unable to enqueue */    if(ipr == NULL) {      goto nullreturn;    }  } else {    if (((ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) == 0) &&       ((ntohs(IPH_OFFSET(&ipr->iphdr)) & IP_OFFMASK) != 0)) {      /* ipr->iphdr is not the header from the first fragment, but fraghdr is       * -> copy fraghdr into ipr->iphdr since we want to have the header       * of the first fragment (for ICMP time exceeded and later, for copying       * all options, if supported)*/      SMEMCPY(&ipr->iphdr, fraghdr, IP_HLEN);    }  }  /* Track the current number of pbufs current 'in-flight', in order to limit   the number of fragments that may be enqueued at any one time */  ip_reass_pbufcount += clen;  /* At this point, we have either created a new entry or pointing    * to an existing one */  /* check for 'no more fragments', and update queue entry*/  if ((ntohs(IPH_OFFSET(fraghdr)) & IP_MF) == 0) {    ipr->flags |= IP_REASS_FLAG_LASTFRAG;    ipr->datagram_len = offset + len;    LWIP_DEBUGF(IP_REASS_DEBUG,     ("ip_reass: last fragment seen, total len %"S16_F"\n",      ipr->datagram_len));  }  /* find the right place to insert this pbuf */  /* @todo: trim pbufs if fragments are overlapping */  if (ip_reass_chain_frag_into_datagram_and_validate(ipr, p)) {    /* the totally last fragment (flag more fragments = 0) was received at least     * once AND all fragments are received */    ipr->datagram_len += IP_HLEN;    /* save the second pbuf before copying the header over the pointer */    r = ((struct ip_reass_helper*)ipr->p->payload)->next_pbuf;    /* copy the original ip header back to the first pbuf */    fraghdr = (struct ip_hdr*)(ipr->p->payload);    SMEMCPY(fraghdr, &ipr->iphdr, IP_HLEN);    IPH_LEN_SET(fraghdr, htons(ipr->datagram_len));    IPH_OFFSET_SET(fraghdr, 0);    IPH_CHKSUM_SET(fraghdr, 0);    /* @todo: do we need to set calculate the correct checksum? */    IPH_CHKSUM_SET(fraghdr, inet_chksum(fraghdr, IP_HLEN));    p = ipr->p;    /* chain together the pbufs contained within the reass_data list. */    while(r != NULL) {      iprh = (struct ip_reass_helper*)r->payload;      /* hide the ip header for every succeding fragment */      pbuf_header(r, -IP_HLEN);      pbuf_cat(p, r);      r = iprh->next_pbuf;    }    /* release the sources allocate for the fragment queue entry */    ip_reass_dequeue_datagram(ipr, ipr_prev);    /* and adjust the number of pbufs currently queued for reassembly. */    ip_reass_pbufcount -= pbuf_clen(p);    /* Return the pbuf chain */    return p;  }  /* the datagram is not (yet?) reassembled completely */  LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass_pbufcount: %d out\n", ip_reass_pbufcount));  return NULL;nullreturn:  LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass: nullreturn\n"));  IPFRAG_STATS_INC(ip_frag.drop);  pbuf_free(p);  return NULL;}#endif /* IP_REASSEMBLY */#if IP_FRAG#if IP_FRAG_USES_STATIC_BUFstatic u8_t buf[LWIP_MEM_ALIGN_SIZE(IP_FRAG_MAX_MTU + MEM_ALIGNMENT - 1)];#endif /* IP_FRAG_USES_STATIC_BUF *//** * Fragment an IP datagram if too large for the netif. * * Chop the datagram in MTU sized chunks and send them in order * by using a fixed size static memory buffer (PBUF_REF) or * point PBUF_REFs into p (depending on IP_FRAG_USES_STATIC_BUF). * * @param p ip packet to send * @param netif the netif on which to send * @param dest destination ip address to which to send * * @return ERR_OK if sent successfully, err_t otherwise */err_t ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest){  struct pbuf *rambuf;#if IP_FRAG_USES_STATIC_BUF  struct pbuf *header;#else  struct pbuf *newpbuf;  struct ip_hdr *original_iphdr;#endif  struct ip_hdr *iphdr;  u16_t nfb;  u16_t left, cop;  u16_t mtu = netif->mtu;  u16_t ofo, omf;  u16_t last;  u16_t poff = IP_HLEN;  u16_t tmp;#if !IP_FRAG_USES_STATIC_BUF  u16_t newpbuflen = 0;  u16_t left_to_copy;#endif  /* Get a RAM based MTU sized pbuf */#if IP_FRAG_USES_STATIC_BUF  /* When using a static buffer, we use a PBUF_REF, which we will   * use to reference the packet (without link header).   * Layer and length is irrelevant.   */  rambuf = pbuf_alloc(PBUF_LINK, 0, PBUF_REF);  if (rambuf == NULL) {    LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_frag: pbuf_alloc(PBUF_LINK, 0, PBUF_REF) failed\n"));    return ERR_MEM;  }  rambuf->tot_len = rambuf->len = mtu;  rambuf->payload = LWIP_MEM_ALIGN((void *)buf);  /* Copy the IP header in it */  iphdr = rambuf->payload;  SMEMCPY(iphdr, p->payload, IP_HLEN);#else /* IP_FRAG_USES_STATIC_BUF */  original_iphdr = p->payload;  iphdr = original_iphdr;#endif /* IP_FRAG_USES_STATIC_BUF */  /* Save original offset */  tmp = ntohs(IPH_OFFSET(iphdr));  ofo = tmp & IP_OFFMASK;  omf = tmp & IP_MF;  left = p->tot_len - IP_HLEN;  nfb = (mtu - IP_HLEN) / 8;  while (left) {    last = (left <= mtu - IP_HLEN);    /* Set new offset and MF flag */    tmp = omf | (IP_OFFMASK & (ofo));    if (!last)      tmp = tmp | IP_MF;    /* Fill this fragment */    cop = last ? left : nfb * 8;#if IP_FRAG_USES_STATIC_BUF    poff += pbuf_copy_partial(p, (u8_t*)iphdr + IP_HLEN, cop, poff);#else /* IP_FRAG_USES_STATIC_BUF */    /* When not using a static buffer, create a chain of pbufs.     * The first will be a PBUF_RAM holding the link and IP header.     * The rest will be PBUF_REFs mirroring the pbuf chain to be fragged,     * but limited to the size of an mtu.     */    rambuf = pbuf_alloc(PBUF_LINK, IP_HLEN, PBUF_RAM);    if (rambuf == NULL) {      return ERR_MEM;    }    LWIP_ASSERT("this needs a pbuf in one piece!",                (p->len >= (IP_HLEN)));    SMEMCPY(rambuf->payload, original_iphdr, IP_HLEN);    iphdr = rambuf->payload;    /* Can just adjust p directly for needed offset. */    p->payload = (u8_t *)p->payload + poff;    p->len -= poff;    left_to_copy = cop;    while (left_to_copy) {      newpbuflen = (left_to_copy < p->len) ? left_to_copy : p->len;      /* Is this pbuf already empty? */      if (!newpbuflen) {        p = p->next;        continue;      }      newpbuf = pbuf_alloc(PBUF_RAW, 0, PBUF_REF);      if (newpbuf == NULL) {        pbuf_free(rambuf);        return ERR_MEM;      }      /* Mirror this pbuf, although we might not need all of it. */      newpbuf->payload = p->payload;      newpbuf->len = newpbuf->tot_len = newpbuflen;      /* Add it to end of rambuf's chain, but using pbuf_cat, not pbuf_chain       * so that it is removed when pbuf_dechain is later called on rambuf.       */      pbuf_cat(rambuf, newpbuf);      left_to_copy -= newpbuflen;      if (left_to_copy)        p = p->next;    }    poff = newpbuflen;#endif /* IP_FRAG_USES_STATIC_BUF */    /* Correct header */    IPH_OFFSET_SET(iphdr, htons(tmp));    IPH_LEN_SET(iphdr, htons(cop + IP_HLEN));    IPH_CHKSUM_SET(iphdr, 0);    IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN));#if IP_FRAG_USES_STATIC_BUF    if (last)      pbuf_realloc(rambuf, left + IP_HLEN);    /* This part is ugly: we alloc a RAM based pbuf for      * the link level header for each chunk and then      * free it.A PBUF_ROM style pbuf for which pbuf_header     * worked would make things simpler.     */    header = pbuf_alloc(PBUF_LINK, 0, PBUF_RAM);    if (header != NULL) {      pbuf_chain(header, rambuf);      netif->output(netif, header, dest);      IPFRAG_STATS_INC(ip_frag.xmit);      snmp_inc_ipfragcreates();      pbuf_free(header);    } else {      LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_frag: pbuf_alloc() for header failed\n"));      pbuf_free(rambuf);      return ERR_MEM;    }#else /* IP_FRAG_USES_STATIC_BUF */    /* No need for separate header pbuf - we allowed room for it in rambuf     * when allocated.     */    netif->output(netif, rambuf, dest);    IPFRAG_STATS_INC(ip_frag.xmit);    /* Unfortunately we can't reuse rambuf - the hardware may still be     * using the buffer. Instead we free it (and the ensuing chain) and     * recreate it next time round the loop. If we're lucky the hardware     * will have already sent the packet, the free will really free, and     * there will be zero memory penalty.     */        pbuf_free(rambuf);#endif /* IP_FRAG_USES_STATIC_BUF */    left -= cop;    ofo += nfb;  }#if IP_FRAG_USES_STATIC_BUF  pbuf_free(rambuf);#endif /* IP_FRAG_USES_STATIC_BUF */  snmp_inc_ipfragoks();  return ERR_OK;}#endif /* IP_FRAG */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日产欧美一区| 欧美精品一区二区三区蜜臀| 不卡av在线网| 粉嫩aⅴ一区二区三区四区 | 欧美三日本三级三级在线播放| 99久久综合精品| 色综合中文字幕国产 | 不卡在线观看av| 成人av在线一区二区三区| 91丨porny丨中文| 欧美亚洲尤物久久| 日韩欧美视频一区| 国产精品美女久久久久高潮| 日韩理论片一区二区| 亚洲一区日韩精品中文字幕| 亚洲高清视频在线| 国产一区二区在线看| 99re免费视频精品全部| 在线观看亚洲a| 日韩三级在线观看| 国产欧美日韩在线视频| 亚洲视频一区二区在线| 偷拍日韩校园综合在线| 国产一区亚洲一区| 91免费小视频| 日韩一级片网站| 国产精品色呦呦| 三级不卡在线观看| 岛国一区二区在线观看| 欧美日韩免费高清一区色橹橹| 欧美电视剧在线看免费| 亚洲免费观看高清| 美国十次综合导航| 91美女在线看| 日韩精品专区在线| 亚洲最色的网站| 国产精品99久久久久久宅男| 欧美亚洲综合久久| 欧美国产日产图区| 美女视频免费一区| 国产专区欧美精品| 爽好多水快深点欧美视频| 国产精品自产自拍| 欧美一级理论性理论a| 欧美激情一区二区三区在线| 在线精品视频一区二区| 久久久久综合网| 亚洲国产中文字幕在线视频综合| 国产91清纯白嫩初高中在线观看| 欧美日韩一本到| 国产精品久久免费看| 狠狠色伊人亚洲综合成人| 欧美日韩国产不卡| 亚洲人成伊人成综合网小说| 国产69精品久久99不卡| 久久―日本道色综合久久| 丝袜国产日韩另类美女| 欧美色爱综合网| 亚洲激情网站免费观看| 不卡免费追剧大全电视剧网站| 精品少妇一区二区三区日产乱码 | 99re这里只有精品6| 精品国产乱码久久| 全部av―极品视觉盛宴亚洲| 欧美午夜影院一区| 亚洲乱码一区二区三区在线观看| 国产成人在线影院| 久久久亚洲国产美女国产盗摄| 麻豆精品一二三| 日韩一区二区三区免费看| 视频一区视频二区中文| 欧美精品99久久久**| 天天色综合天天| 欧美日本精品一区二区三区| 天天综合天天做天天综合| 欧美性猛交一区二区三区精品| 亚洲精品自拍动漫在线| 色综合久久久久综合体桃花网| 国产精品黄色在线观看| 99精品热视频| 亚洲午夜久久久久久久久久久| 欧美性色综合网| 亚洲成av人片一区二区三区| 欧美一区二区在线观看| 美腿丝袜在线亚洲一区| 久久天天做天天爱综合色| 成人免费va视频| 亚洲伊人伊色伊影伊综合网| 欧美日韩一区二区在线视频| 婷婷丁香激情综合| 精品日产卡一卡二卡麻豆| 国产成人av一区| 亚洲人成在线观看一区二区| 欧美日本在线视频| 韩国理伦片一区二区三区在线播放| 久久久久久久电影| 91丨九色丨蝌蚪丨老版| 日韩和欧美的一区| 久久影院午夜片一区| 91丝袜美腿高跟国产极品老师 | 日韩一二在线观看| 国产精品一二二区| 亚洲一区二区偷拍精品| 日韩欧美你懂的| www.色综合.com| 日本成人中文字幕在线视频 | 99re热这里只有精品免费视频| 亚洲国产精品天堂| 久久亚洲二区三区| 欧美日韩一区二区三区四区五区| 韩国视频一区二区| 亚洲自拍偷拍欧美| 国产亚洲va综合人人澡精品| 欧美日韩专区在线| 国产福利精品一区| 天堂在线一区二区| 亚洲精品中文字幕乱码三区| 久久免费午夜影院| 精品视频一区二区不卡| 成人一区在线看| 久久精品久久99精品久久| 亚洲综合一区二区三区| 国产欧美视频在线观看| 欧美一区二区三区人| 91福利国产精品| 成年人午夜久久久| 国产福利一区二区三区视频| 亚洲va欧美va天堂v国产综合| 国产精品久久久久婷婷二区次| 日韩三级在线免费观看| 欧美久久久久中文字幕| 91免费视频大全| 成人免费视频一区| 精品伊人久久久久7777人| 五月婷婷久久综合| 亚洲一区欧美一区| 亚洲最新在线观看| 亚洲卡通动漫在线| 亚洲色图在线视频| 国产精品久久久久aaaa樱花| 亚洲精品一区二区精华| 日韩欧美国产一区二区三区| 欧美乱妇15p| 亚洲a一区二区| 一本久久a久久免费精品不卡| 制服丝袜av成人在线看| 97精品超碰一区二区三区| 国产电影精品久久禁18| 精品一区二区三区在线视频| 久久国产婷婷国产香蕉| 久久疯狂做爰流白浆xx| 美国毛片一区二区三区| 激情另类小说区图片区视频区| 天天操天天干天天综合网| 亚洲v中文字幕| 日韩成人精品在线观看| 卡一卡二国产精品| 国产最新精品免费| 粉嫩绯色av一区二区在线观看| 粉嫩欧美一区二区三区高清影视| 国产99久久久国产精品| av在线一区二区| 欧美视频中文一区二区三区在线观看| 91精品国产综合久久香蕉的特点 | 欧美男女性生活在线直播观看| 欧美性色aⅴ视频一区日韩精品| 欧美亚洲精品一区| 欧美一区二区三区免费| 久久女同精品一区二区| 国产精品三级av在线播放| 亚洲精选免费视频| 美女诱惑一区二区| 成人黄页在线观看| 欧美色男人天堂| www精品美女久久久tv| 国产精品传媒在线| 亚洲国产cao| 粉嫩av一区二区三区粉嫩| 欧美最新大片在线看| 久久综合av免费| 亚洲综合久久久久| 久久99日本精品| 91免费视频观看| 精品久久久久久久久久久久包黑料 | 精品日产卡一卡二卡麻豆| 国产精品看片你懂得| 亚洲国产一区二区a毛片| 久久66热re国产| 色悠久久久久综合欧美99| 精品第一国产综合精品aⅴ| 日日欢夜夜爽一区| 国产xxx精品视频大全| 欧美精品成人一区二区三区四区| 国产亚洲va综合人人澡精品| 亚洲福利一二三区| 成人蜜臀av电影| www久久精品| 天堂成人国产精品一区| 97se亚洲国产综合在线| 国产喂奶挤奶一区二区三区|