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

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

?? raw.c

?? LWIP源碼.rar
?? 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 <string.h>#include "lwip/opt.h"#include "lwip/def.h"#include "lwip/memp.h"#include "lwip/inet.h"#include "lwip/ip_addr.h"#include "lwip/netif.h"#include "lwip/raw.h"#include "lwip/stats.h"#include "arch/perf.h"#include "lwip/snmp.h"#if LWIP_RAW/** The list of RAW PCBs */static struct raw_pcb *raw_pcbs = NULL;voidraw_init(void){  raw_pcbs = NULL;}/** * 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 pbuf pbuf to be demultiplexed to a RAW PCB. * @param netif 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;  struct ip_hdr *iphdr;  int proto;  u8_t eaten = 0;  iphdr = p->payload;  proto = IPH_PROTO(iphdr);  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) {      /* 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;        }      }      /* no receive callback function was set for this raw PCB */      /* drop the packet */    }    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 | DBG_TRACE | 3, ("raw_sendto\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 | DBG_TRACE | 2, ("raw_sendto: could not allocate header\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\n", (void *)q, (void *)p));  }  else {    /* first pbuf q equals given pbuf */    q = p;    pbuf_header(q, -IP_HLEN);  }    if ((netif = ip_route(ipaddr)) == NULL) {    LWIP_DEBUGF(RAW_DEBUG | 1, ("raw_sendto: No route to 0x%lx\n", ipaddr->addr));#if RAW_STATS    /*    ++lwip_stats.raw.rterr;*/#endif /* RAW_STATS */    /* free any temporary header pbuf allocated by pbuf_header() */    if (q != p) {      pbuf_free(q);    }    return ERR_RTE;  }  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);  }  err = ip_output_if (q, src_ip, ipaddr, pcb->ttl, pcb->tos, pcb->protocol, netif);  /* 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 * @param ipaddr the destination address of the IP packet * */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(u16_t proto) {  struct raw_pcb *pcb;  LWIP_DEBUGF(RAW_DEBUG | DBG_TRACE | 3, ("raw_new\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一区二区三区免费野_久草精品视频
精品国产乱码久久久久久蜜臀 | 欧美一区二区精美| av成人动漫在线观看| 五月天中文字幕一区二区| 国产精品乱码妇女bbbb| 久久久亚洲综合| 69堂国产成人免费视频| 欧美一区二区三区四区在线观看| av在线不卡免费看| 粉嫩高潮美女一区二区三区| 欧美aa在线视频| 不卡在线视频中文字幕| 日韩中文字幕一区二区三区| 婷婷一区二区三区| 天堂成人国产精品一区| 亚洲精品视频观看| 亚洲视频免费看| 一区二区三区在线视频观看58| 亚洲欧美日韩在线播放| 亚洲香蕉伊在人在线观| 亚洲成a人片在线观看中文| 亚洲综合在线观看视频| 婷婷夜色潮精品综合在线| 日日夜夜一区二区| 日韩电影在线一区二区| 性做久久久久久免费观看欧美| 婷婷综合在线观看| 美洲天堂一区二卡三卡四卡视频| 男女视频一区二区| 国产一区二区中文字幕| 国产馆精品极品| 成人理论电影网| 亚洲码国产岛国毛片在线| 国产精品五月天| 一区二区三区精品视频| 日韩美女久久久| 午夜日韩在线电影| 免费av成人在线| 美女在线观看视频一区二区| 国产精品一区二区在线看| 成人综合日日夜夜| 欧美日韩在线综合| 2021中文字幕一区亚洲| 欧美经典一区二区三区| 亚洲综合自拍偷拍| 奇米综合一区二区三区精品视频| 精东粉嫩av免费一区二区三区| 精品一区中文字幕| 成年人国产精品| 欧美色视频在线观看| 91麻豆精品国产自产在线观看一区 | 久久综合中文字幕| 国产区在线观看成人精品| 亚洲猫色日本管| 国产精品久久久久久久久搜平片 | 在线免费观看日本一区| 日韩精品一区二区三区老鸭窝 | 国产精品2024| 91久久精品一区二区| 日韩欧美在线影院| 亚洲乱码国产乱码精品精的特点| 日本一不卡视频| 粉嫩13p一区二区三区| 欧美一区二区三区免费在线看| 国产女主播在线一区二区| 亚洲国产视频一区二区| 美女网站色91| 色美美综合视频| 久久综合久久综合亚洲| 久久久九九九九| 亚洲电影视频在线| 日韩高清不卡在线| 波多野结衣亚洲| 国产亚洲污的网站| 午夜天堂影视香蕉久久| 成人黄色av网站在线| 欧美岛国在线观看| 一区二区三区欧美视频| 国产美女精品在线| 日韩一区二区三区电影| 亚洲色图20p| 国产美女在线精品| 精品裸体舞一区二区三区| 亚洲精品国产第一综合99久久| 国产在线麻豆精品观看| www.66久久| 久久色视频免费观看| 中文字幕一区二区三区不卡| 久久国产精品第一页| 欧美午夜理伦三级在线观看| 中文字幕在线观看一区二区| 国产麻豆精品在线观看| 日韩一区二区影院| 亚洲一区中文在线| 91欧美一区二区| 欧美激情在线看| 国产一区二区三区精品欧美日韩一区二区三区 | 在线视频一区二区免费| 国产精品伦一区二区三级视频| 亚洲一二三四在线观看| 色婷婷久久久亚洲一区二区三区 | 亚洲欧美在线高清| 丁香激情综合国产| 精品国产欧美一区二区| 日韩精品欧美精品| 日韩一级视频免费观看在线| 亚洲va国产va欧美va观看| 色婷婷综合视频在线观看| 亚洲精品成a人| 成人sese在线| 国产精品美女久久久久av爽李琼 | 91污在线观看| 中文字幕一区二区三区色视频| av成人免费在线| 综合av第一页| 色婷婷综合中文久久一本| 一区二区三区中文免费| 欧美中文字幕久久| 亚洲一区二区四区蜜桃| 欧美伊人久久大香线蕉综合69| 国产精品久久毛片| 99热99精品| 中文字幕一区二区在线播放| av色综合久久天堂av综合| 久久久久久久久久看片| 国产福利一区二区三区视频 | 日本视频一区二区三区| 欧美一区二区在线免费观看| 寂寞少妇一区二区三区| 国产亚洲午夜高清国产拍精品| 国产成人在线电影| 亚洲男人的天堂网| 欧美婷婷六月丁香综合色| 麻豆91在线播放| 久久久久国产精品人| eeuss鲁一区二区三区| 亚洲一区二区视频在线| 在线播放91灌醉迷j高跟美女| 美国精品在线观看| 国产精品午夜在线| 91福利国产成人精品照片| 婷婷久久综合九色综合绿巨人 | 亚洲一本大道在线| 欧美女孩性生活视频| 蜜桃视频免费观看一区| 国产精品女上位| 欧美亚洲日本一区| 蜜桃在线一区二区三区| 国产精品久久久久久久久搜平片| 日本黄色一区二区| 国产精一区二区三区| 亚洲精品视频观看| 日韩欧美一二三四区| 国产91对白在线观看九色| 亚洲国产视频一区| 欧美电视剧在线观看完整版| 粉嫩aⅴ一区二区三区四区五区 | 色婷婷久久久久swag精品 | 国产在线一区观看| 亚洲欧美综合色| 欧美日韩www| 国产电影一区二区三区| 亚洲精品成人精品456| 精品sm在线观看| 色视频一区二区| 国产资源在线一区| 亚洲成人资源在线| 中文字幕精品—区二区四季| 欧美在线小视频| 成人国产一区二区三区精品| 午夜精品久久久久久久久| 国产亚洲va综合人人澡精品| 91精品国产一区二区人妖| 成人黄色777网| 免费精品99久久国产综合精品| 欧美高清视频www夜色资源网| 香蕉乱码成人久久天堂爱免费| 国产精品久久午夜夜伦鲁鲁| 日韩视频在线观看一区二区| 在线视频观看一区| 成人理论电影网| 国产综合色产在线精品| 日本色综合中文字幕| 亚洲综合在线视频| 亚洲私人黄色宅男| 国产精品护士白丝一区av| 精品免费国产一区二区三区四区| 欧美日韩国产影片| 在线日韩av片| 91久久精品一区二区三| 91在线视频播放地址| 懂色一区二区三区免费观看| 精品午夜久久福利影院 | 91麻豆精品视频| 波多野结衣中文一区| 国产高清久久久久| 国产一区二区三区精品欧美日韩一区二区三区| 午夜精品福利久久久| 亚洲成人av一区二区三区| 亚洲一卡二卡三卡四卡无卡久久|