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

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

?? raw.c

?? 《ARM與嵌入式系統基礎教程》
?? 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;  s16_t 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%"X32_F"\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一区二区三区免费野_久草精品视频
亚洲一区二区中文在线| 亚洲欧美一区二区在线观看| 91天堂素人约啪| 国内精品国产三级国产a久久| 蜜臀av性久久久久蜜臀av麻豆| 亚洲国产sm捆绑调教视频 | 91国偷自产一区二区三区成为亚洲经典| 国产精品综合av一区二区国产馆| 国模少妇一区二区三区| 国产真实乱对白精彩久久| 国产成人亚洲综合色影视| 国产成人av网站| 成人18精品视频| 色婷婷av一区| 91精品国产综合久久久蜜臀粉嫩| 欧美一区二区精品| 久久久高清一区二区三区| 国产精品久久久久天堂| 亚洲精品精品亚洲| 首页亚洲欧美制服丝腿| 九一九一国产精品| 91视视频在线直接观看在线看网页在线看 | 欧美性xxxxxx少妇| 91精品国产一区二区三区蜜臀| 欧美电影精品一区二区| 国产精品第一页第二页第三页| 亚洲精品国产一区二区三区四区在线| 亚洲va欧美va人人爽| 精品一区二区影视| 91蜜桃网址入口| 日韩一区二区在线免费观看| 国产精品三级视频| 日韩av电影免费观看高清完整版在线观看| 精品在线免费观看| 色婷婷亚洲婷婷| 精品日韩一区二区三区免费视频| 亚洲情趣在线观看| 国内欧美视频一区二区| 91麻豆国产香蕉久久精品| 日韩视频免费观看高清在线视频| 欧美国产1区2区| 日韩中文字幕麻豆| 99视频在线精品| 亚洲一区二区三区美女| 国产在线精品一区二区夜色| 欧美亚洲国产一卡| 日本一区二区三区四区在线视频 | 青青草97国产精品免费观看无弹窗版| 国产精品一区二区在线观看网站 | 国产欧美一区二区精品仙草咪| 亚洲国产sm捆绑调教视频| 丰满放荡岳乱妇91ww| 欧美电视剧在线观看完整版| 亚洲一区二区三区不卡国产欧美| 成人午夜大片免费观看| 欧美大片日本大片免费观看| 一区二区三区四区不卡在线| 国产91对白在线观看九色| 日韩亚洲欧美在线| 五月天亚洲婷婷| 色www精品视频在线观看| 亚洲欧洲成人精品av97| 国产成人免费高清| 日本一区二区三级电影在线观看| 日韩av高清在线观看| 欧美男男青年gay1069videost | 69成人精品免费视频| 亚洲精品ww久久久久久p站| 丁香天五香天堂综合| 日韩欧美视频在线| 久久成人精品无人区| 精品三级av在线| 精品一区二区三区不卡| 精品久久久久久久人人人人传媒 | 性感美女久久精品| 欧美亚洲日本一区| 性感美女极品91精品| 欧美日韩中文精品| 亚洲国产精品久久艾草纯爱| 欧美人牲a欧美精品| 日日骚欧美日韩| 欧美一级日韩免费不卡| 免费亚洲电影在线| 精品欧美一区二区三区精品久久| 精品一区二区免费视频| 久久久久久久久久久99999| 成人小视频免费观看| 中文字幕一区二区三中文字幕| 成人免费av在线| 一区二区三区影院| 6080国产精品一区二区| 极品销魂美女一区二区三区| 久久亚洲精品国产精品紫薇| 成人一区二区视频| 亚洲精品视频免费看| 3atv在线一区二区三区| 韩国视频一区二区| 亚洲色图制服诱惑| 91精品国产免费| 国产高清精品在线| 伊人色综合久久天天| 日韩亚洲欧美成人一区| 国产高清精品久久久久| 亚洲国产日韩a在线播放| 日韩免费观看2025年上映的电影 | 成人综合日日夜夜| 亚洲尤物视频在线| 久久网站最新地址| 在线观看日韩精品| 国产曰批免费观看久久久| 亚洲人吸女人奶水| 欧美一区二区观看视频| 不卡高清视频专区| 久久综合综合久久综合| 国产日韩欧美高清在线| 欧美日韩www| 91在线精品一区二区三区| 男人的天堂久久精品| 中文字幕日韩一区| 欧美精品一区二区三区蜜桃| 色综合久久88色综合天天| 国产精品一卡二卡在线观看| 亚洲一级在线观看| 国产精品久久久久久久岛一牛影视 | 欧美日本在线播放| 成人午夜视频在线| 乱中年女人伦av一区二区| 夜夜嗨av一区二区三区四季av| 久久久综合视频| 91精品综合久久久久久| 色噜噜狠狠成人中文综合| 国产自产高清不卡| 天天av天天翘天天综合网 | 99久久精品国产导航| 精品综合免费视频观看| 亚洲一区二区三区四区在线观看 | 精品国精品自拍自在线| 欧美日韩不卡视频| 欧美午夜一区二区三区免费大片| 成人毛片老司机大片| 国产91高潮流白浆在线麻豆| 国产在线精品免费| 国产一区不卡在线| 国产曰批免费观看久久久| 激情五月婷婷综合| 青青青伊人色综合久久| 视频在线观看国产精品| 亚洲丰满少妇videoshd| 亚洲一区二区在线免费观看视频| 亚洲精品中文在线| 亚洲一区二区免费视频| 亚洲bdsm女犯bdsm网站| 亚洲成精国产精品女| 日韩成人午夜精品| 免费的国产精品| 蜜桃免费网站一区二区三区| 美女诱惑一区二区| 国产精品原创巨作av| 国产**成人网毛片九色| 成人在线视频一区二区| 色综合久久中文综合久久牛| 91黄色在线观看| 精品视频免费在线| 日韩一区二区三区免费观看| 精品国产一区二区三区不卡| 欧美激情在线观看视频免费| 国产一区二区精品久久| 国产成人精品三级麻豆| kk眼镜猥琐国模调教系列一区二区| 91在线小视频| 欧美老年两性高潮| 精品国产在天天线2019| 国产精品理论在线观看| 亚洲一二三专区| 麻豆国产欧美一区二区三区| 国产99精品在线观看| 色天天综合色天天久久| 制服丝袜亚洲色图| 国产三级三级三级精品8ⅰ区| 国产精品毛片大码女人| 亚洲主播在线观看| 国产乱对白刺激视频不卡| 色一情一乱一乱一91av| 日韩美女视频在线| 亚洲人吸女人奶水| 久久国产福利国产秒拍| 99视频精品全部免费在线| 欧美日本乱大交xxxxx| 国产视频在线观看一区二区三区 | 69堂国产成人免费视频| 国产日本一区二区| 亚洲成人中文在线| 高清国产一区二区| 欧美高清精品3d| 中文字幕一区三区| 狠狠网亚洲精品| 欧美日韩国产123区| 日本一区二区三区免费乱视频| 日韩电影一区二区三区| 99久久国产综合色|国产精品|