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

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

?? raw.c

?? uCOSII_lwip_lpc1768
?? C
字號:
/** * @file * Implementation of raw protocol PCBs for low-level handling of * different types of protocols besides (or overriding) those * already available in lwIP. * *//* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, *    this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, *    this list of conditions and the following disclaimer in the documentation *    and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products *    derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels <adam@sics.se> * */#include "opt.h"#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */#include "def.h"#include "memp.h"#include "inet.h"#include "ip_addr.h"#include "netif.h"#include "raw.h"#include "stats.h"#include "snmp.h"#include "perf.h"#include <string.h>/** The list of RAW PCBs */static struct raw_pcb *raw_pcbs;/** * Determine if in incoming IP packet is covered by a RAW PCB * and if so, pass it to a user-provided receive callback function. * * Given an incoming IP datagram (as a chain of pbufs) this function * finds a corresponding RAW PCB and calls the corresponding receive * callback function. * * @param p pbuf to be demultiplexed to a RAW PCB. * @param inp network interface on which the datagram was received. * @return - 1 if the packet has been eaten by a RAW PCB receive *           callback function. The caller MAY NOT not reference the *           packet any longer, and MAY NOT call pbuf_free(). * @return - 0 if packet is not eaten (pbuf is still referenced by the *           caller). * */u8_traw_input(struct pbuf *p, struct netif *inp){  struct raw_pcb *pcb, *prev;  struct ip_hdr *iphdr;  s16_t proto;  u8_t eaten = 0;  LWIP_UNUSED_ARG(inp);  iphdr = p->payload;  proto = IPH_PROTO(iphdr);  prev = NULL;  pcb = raw_pcbs;  /* loop through all raw pcbs until the packet is eaten by one */  /* this allows multiple pcbs to match against the packet by design */  while ((eaten == 0) && (pcb != NULL)) {    if (pcb->protocol == proto) {#if IP_SOF_BROADCAST_RECV      /* broadcast filter? */      if ((pcb->so_options & SOF_BROADCAST) || !ip_addr_isbroadcast(&(iphdr->dest), inp))#endif /* IP_SOF_BROADCAST_RECV */      {        /* receive callback function available? */        if (pcb->recv != NULL) {          /* the receive callback function did not eat the packet? */          if (pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src)) != 0) {            /* receive function ate the packet */            p = NULL;            eaten = 1;            if (prev != NULL) {            /* move the pcb to the front of raw_pcbs so that is               found faster next time */              prev->next = pcb->next;              pcb->next = raw_pcbs;              raw_pcbs = pcb;            }          }        }        /* no receive callback function was set for this raw PCB */      }      /* drop the packet */    }    prev = pcb;    pcb = pcb->next;  }  return eaten;}/** * Bind a RAW PCB. * * @param pcb RAW PCB to be bound with a local address ipaddr. * @param ipaddr local IP address to bind with. Use IP_ADDR_ANY to * bind to all local interfaces. * * @return lwIP error code. * - ERR_OK. Successful. No error occured. * - ERR_USE. The specified IP address is already bound to by * another RAW PCB. * * @see raw_disconnect() */err_traw_bind(struct raw_pcb *pcb, struct ip_addr *ipaddr){  ip_addr_set(&pcb->local_ip, ipaddr);  return ERR_OK;}/** * Connect an RAW PCB. This function is required by upper layers * of lwip. Using the raw api you could use raw_sendto() instead * * This will associate the RAW PCB with the remote address. * * @param pcb RAW PCB to be connected with remote address ipaddr and port. * @param ipaddr remote IP address to connect with. * * @return lwIP error code * * @see raw_disconnect() and raw_sendto() */err_traw_connect(struct raw_pcb *pcb, struct ip_addr *ipaddr){  ip_addr_set(&pcb->remote_ip, ipaddr);  return ERR_OK;}/** * Set the callback function for received packets that match the * raw PCB's protocol and binding.  *  * The callback function MUST either * - eat the packet by calling pbuf_free() and returning non-zero. The *   packet will not be passed to other raw PCBs or other protocol layers. * - not free the packet, and return zero. The packet will be matched *   against further PCBs and/or forwarded to another protocol layers. *  * @return non-zero if the packet was free()d, zero if the packet remains * available for others. */voidraw_recv(struct raw_pcb *pcb,         u8_t (* recv)(void *arg, struct raw_pcb *upcb, struct pbuf *p,                      struct ip_addr *addr),         void *recv_arg){  /* remember recv() callback and user data */  pcb->recv = recv;  pcb->recv_arg = recv_arg;}/** * Send the raw IP packet to the given address. Note that actually you cannot * modify the IP headers (this is inconsistent with the receive callback where * you actually get the IP headers), you can only specify the IP payload here. * It requires some more changes in lwIP. (there will be a raw_send() function * then.) * * @param pcb the raw pcb which to send * @param p the IP payload to send * @param ipaddr the destination address of the IP packet * */err_traw_sendto(struct raw_pcb *pcb, struct pbuf *p, struct ip_addr *ipaddr){  err_t err;  struct netif *netif;  struct ip_addr *src_ip;  struct pbuf *q; /* q will be sent down the stack */    LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_sendto\r\n"));    /* not enough space to add an IP header to first pbuf in given p chain? */  if (pbuf_header(p, IP_HLEN)) {    /* allocate header in new pbuf */    q = pbuf_alloc(PBUF_IP, 0, PBUF_RAM);    /* new header pbuf could not be allocated? */    if (q == NULL) {      LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("raw_sendto: could not allocate header\r\n"));      return ERR_MEM;    }    /* chain header q in front of given pbuf p */    pbuf_chain(q, p);    /* { first pbuf q points to header pbuf } */    LWIP_DEBUGF(RAW_DEBUG, ("raw_sendto: added header pbuf %p before given pbuf %p\r\n", (void *)q, (void *)p));  }  else {    /* first pbuf q equals given pbuf */    q = p;    if(pbuf_header(q, -IP_HLEN)) {      LWIP_ASSERT("Can't restore header we just removed!", 0);      return ERR_MEM;    }  }  if ((netif = ip_route(ipaddr)) == NULL) {    LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_LEVEL_WARNING, ("raw_sendto: No route to 0x%"X32_F"\r\n", ipaddr->addr));    /* free any temporary header pbuf allocated by pbuf_header() */    if (q != p) {      pbuf_free(q);    }    return ERR_RTE;  }#if IP_SOF_BROADCAST  /* broadcast filter? */  if ( ((pcb->so_options & SOF_BROADCAST) == 0) && ip_addr_isbroadcast(ipaddr, netif) ) {    LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_LEVEL_WARNING, ("raw_sendto: SOF_BROADCAST not enabled on pcb %p\r\n", (void *)pcb));    /* free any temporary header pbuf allocated by pbuf_header() */    if (q != p) {      pbuf_free(q);    }    return ERR_VAL;  }#endif /* IP_SOF_BROADCAST */  if (ip_addr_isany(&pcb->local_ip)) {    /* use outgoing network interface IP address as source address */    src_ip = &(netif->ip_addr);  } else {    /* use RAW PCB local IP address as source address */    src_ip = &(pcb->local_ip);  }#if LWIP_NETIF_HWADDRHINT  netif->addr_hint = &(pcb->addr_hint);#endif /* LWIP_NETIF_HWADDRHINT*/  err = ip_output_if (q, src_ip, ipaddr, pcb->ttl, pcb->tos, pcb->protocol, netif);#if LWIP_NETIF_HWADDRHINT  netif->addr_hint = NULL;#endif /* LWIP_NETIF_HWADDRHINT*/  /* did we chain a header earlier? */  if (q != p) {    /* free the header */    pbuf_free(q);  }  return err;}/** * Send the raw IP packet to the address given by raw_connect() * * @param pcb the raw pcb which to send * @param p the IP payload to send * */err_traw_send(struct raw_pcb *pcb, struct pbuf *p){  return raw_sendto(pcb, p, &pcb->remote_ip);}/** * Remove an RAW PCB. * * @param pcb RAW PCB to be removed. The PCB is removed from the list of * RAW PCB's and the data structure is freed from memory. * * @see raw_new() */voidraw_remove(struct raw_pcb *pcb){  struct raw_pcb *pcb2;  /* pcb to be removed is first in list? */  if (raw_pcbs == pcb) {    /* make list start at 2nd pcb */    raw_pcbs = raw_pcbs->next;    /* pcb not 1st in list */  } else {    for(pcb2 = raw_pcbs; pcb2 != NULL; pcb2 = pcb2->next) {      /* find pcb in raw_pcbs list */      if (pcb2->next != NULL && pcb2->next == pcb) {        /* remove pcb from list */        pcb2->next = pcb->next;      }    }  }  memp_free(MEMP_RAW_PCB, pcb);}/** * Create a RAW PCB. * * @return The RAW PCB which was created. NULL if the PCB data structure * could not be allocated. * * @param proto the protocol number of the IPs payload (e.g. IP_PROTO_ICMP) * * @see raw_remove() */struct raw_pcb *raw_new(u8_t proto) {  struct raw_pcb *pcb;  LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_new\r\n"));  pcb = memp_malloc(MEMP_RAW_PCB);  /* could allocate RAW PCB? */  if (pcb != NULL) {    /* initialize PCB to all zeroes */    memset(pcb, 0, sizeof(struct raw_pcb));    pcb->protocol = proto;    pcb->ttl = RAW_TTL;    pcb->next = raw_pcbs;    raw_pcbs = pcb;  }  return pcb;}#endif /* LWIP_RAW */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
老司机精品视频线观看86| 成人av网站免费| 国产黄色精品网站| 91在线免费视频观看| 一本色道久久综合精品竹菊| 欧美日韩在线电影| 日韩视频永久免费| 国产精品色哟哟| 亚洲高清中文字幕| 国产精品综合av一区二区国产馆| 紧缚捆绑精品一区二区| 99久久er热在这里只有精品15| 欧美在线视频你懂得| 久久久久国产一区二区三区四区| 久久亚洲综合色| 欧美性猛交xxxx乱大交退制版| 91精品国产麻豆| 国产精品久久久久久久久久久免费看| 一区二区三区精品在线观看| 另类小说一区二区三区| 91久久奴性调教| 国产亚洲一区二区三区| 日韩中文字幕不卡| 91香蕉视频黄| 久久久www成人免费无遮挡大片| 夜夜嗨av一区二区三区中文字幕| 国产九色sp调教91| 日韩无一区二区| 亚洲一级二级在线| 99久久国产综合精品色伊| 久久天天做天天爱综合色| 亚洲成人av免费| 91成人看片片| 亚洲乱码日产精品bd| 99精品视频一区| 久久精品一区二区三区av| 亚洲国产精品一区二区久久恐怖片 | 欧美片网站yy| 亚洲国产中文字幕| 欧美在线观看18| 一区二区激情小说| 91久久免费观看| 欧美国产日韩在线观看| 国内精品免费**视频| 在线观看不卡一区| 亚洲精品网站在线观看| 99国产精品国产精品毛片| 久久精品男人的天堂| 免费视频最近日韩| 精品国产一区久久| 国产成人av电影在线| 中文字幕字幕中文在线中不卡视频| 高清久久久久久| 亚洲三级电影全部在线观看高清| 91麻豆精东视频| 日韩国产欧美在线视频| 欧美一区二区福利视频| 国内精品久久久久影院一蜜桃| 国产亚洲精品资源在线26u| 97久久精品人人爽人人爽蜜臀| 最新不卡av在线| 在线播放91灌醉迷j高跟美女| 捆绑紧缚一区二区三区视频| 国产欧美日韩中文久久| 在线一区二区三区四区五区| 男人的j进女人的j一区| 国产精品美日韩| 3d成人动漫网站| 国产成人日日夜夜| 一区二区三区成人| 成人av片在线观看| 亚洲欧美日韩国产成人精品影院| 欧美日韩综合不卡| 国产福利一区二区三区在线视频| 一区二区三区欧美| 久久久久久久久岛国免费| 欧美日韩免费电影| av在线综合网| 国模一区二区三区白浆| 亚洲国产成人精品视频| 国产蜜臀av在线一区二区三区| 欧美亚洲国产一区二区三区va| 成人免费毛片a| 激情综合网最新| 日本视频免费一区| 天天综合日日夜夜精品| 一区二区三区欧美久久| 中文字幕综合网| 国产精品久久久久久亚洲毛片| 26uuu亚洲综合色| 日韩视频国产视频| 欧美电影在线免费观看| 欧美日韩视频在线一区二区| 欧美体内she精高潮| 在线亚洲高清视频| 色综合色综合色综合| 91蜜桃免费观看视频| bt欧美亚洲午夜电影天堂| 东方欧美亚洲色图在线| 国产一区二区精品久久91| 韩国精品主播一区二区在线观看 | 国产suv精品一区二区6| 国产精品1区2区| 国产91精品露脸国语对白| 国产a精品视频| 91在线高清观看| 欧美精品日韩综合在线| 欧美一区二区三区四区五区 | 亚洲自拍偷拍麻豆| 五月天婷婷综合| 精品一区二区国语对白| 国产成a人亚洲精| 91免费观看视频| 日韩欧美国产一区在线观看| 久久精品男人天堂av| 亚洲欧美偷拍另类a∨色屁股| 亚洲自拍偷拍综合| 激情伊人五月天久久综合| 国产**成人网毛片九色| 91久久一区二区| 精品对白一区国产伦| 亚洲日本在线a| 奇米四色…亚洲| 91久久精品网| 久久精品人人做人人综合| 亚洲精品免费播放| 亚洲一级片在线观看| 一二三四区精品视频| 麻豆中文一区二区| 日本韩国精品在线| 国产欧美综合色| 精品一区二区三区免费视频| 91久久香蕉国产日韩欧美9色| 久久久国产午夜精品| 日日欢夜夜爽一区| 欧美在线|欧美| 国产精品成人午夜| 国产成人精品综合在线观看| 欧美日韩国产另类一区| 一区二区三区中文字幕电影 | 久久久777精品电影网影网 | 成人爱爱电影网址| www成人在线观看| 蜜桃视频在线一区| 日韩视频一区二区三区在线播放 | 99久久免费精品高清特色大片| 久久精品视频一区二区三区| 韩国三级在线一区| 精品国产一区二区三区久久久蜜月 | 一区二区成人在线观看| 国产精品1024| 国产精品午夜在线| 成人av网址在线| 亚洲三级视频在线观看| 91免费在线看| 亚洲小说欧美激情另类| 成人精品视频一区二区三区| 国产亚洲欧美日韩日本| 波多野结衣亚洲| ●精品国产综合乱码久久久久| 99久久婷婷国产综合精品电影| 亚洲欧洲av一区二区三区久久| 91丨九色丨尤物| 亚洲成人动漫在线免费观看| 91精品在线一区二区| 精品亚洲porn| 日韩一区中文字幕| 777xxx欧美| 国产精品1024| 亚洲综合久久久久| 日韩精品一区二区三区蜜臀| 成人免费视频网站在线观看| 亚洲成人自拍一区| 久久看人人爽人人| 色婷婷综合久色| 免费美女久久99| 亚洲精品视频观看| 久久这里只有精品6| 91久久一区二区| 国产一区二区三区在线观看精品 | 国产另类ts人妖一区二区| 亚洲乱码国产乱码精品精98午夜| 欧美日韩中文字幕一区| 久久精品亚洲精品国产欧美 | 亚洲国产日韩在线一区模特| 日韩一区和二区| 91免费在线视频观看| 国内精品久久久久影院薰衣草| 亚洲黄色在线视频| 久久久精品影视| 日韩欧美第一区| 欧美色窝79yyyycom| 国产成人综合视频| 免费人成网站在线观看欧美高清| 亚洲免费av在线| 国产精品久久久一本精品 | 一区二区三区不卡在线观看 | 中文久久乱码一区二区| 日韩一级成人av| 91精品国产免费久久综合|