亚洲欧美第一页_禁久久精品乱码_粉嫩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美女片黄在线观看91美女| 久久久久99精品国产片| 免费成人在线播放| 欧美日本一区二区三区四区| 亚洲女爱视频在线| 99热国产精品| 国产亚洲污的网站| 久久精品国产秦先生| 欧美午夜一区二区| 伊人一区二区三区| 97精品视频在线观看自产线路二| 久久久噜噜噜久久人人看| 蜜臀av性久久久久蜜臀av麻豆| 色菇凉天天综合网| 亚洲日本va在线观看| 成人免费高清视频在线观看| 国产日韩欧美亚洲| 国内精品第一页| 久久影院午夜片一区| 日韩精品乱码免费| 日韩欧美在线1卡| 日本aⅴ免费视频一区二区三区| 欧美日韩一区成人| 午夜激情久久久| 欧美一区二区三区四区高清| 国产乱码精品一区二区三| 日韩美女主播在线视频一区二区三区| 亚洲高清在线视频| 欧美日韩二区三区| 日本在线播放一区二区三区| 日韩欧美综合在线| 激情图片小说一区| 亚洲国产高清aⅴ视频| 99re这里都是精品| 亚洲图片欧美视频| 91麻豆精品国产综合久久久久久| 日本aⅴ精品一区二区三区| 欧美一区二区三区在线观看| 美女视频一区二区三区| 日本一区二区三区在线观看| 不卡的电影网站| 一区二区三区日韩精品| 日韩一区二区三区观看| 国产在线国偷精品产拍免费yy| 国产三级精品三级| 日本丶国产丶欧美色综合| 三级成人在线视频| 久久久www免费人成精品| 99国产精品一区| 日韩中文字幕一区二区三区| 久久亚洲精品小早川怜子| 91天堂素人约啪| 免费在线看一区| 国产精品美女一区二区三区| 欧美性淫爽ww久久久久无| 精彩视频一区二区| 一区二区日韩av| 欧美成人福利视频| 色婷婷精品大在线视频| 久久精品国产**网站演员| 国产拍揄自揄精品视频麻豆| 在线这里只有精品| 久久精品国产一区二区三区免费看| 国产亚洲精品bt天堂精选| 色哟哟一区二区| 日韩av在线播放中文字幕| 久久夜色精品国产欧美乱极品| 91视频观看视频| 免费高清在线一区| 中文字幕中文字幕一区| 精品国产一二三区| 在线欧美一区二区| 国产精品一区二区91| 五月天网站亚洲| 亚洲三级在线免费| 26uuu精品一区二区在线观看| 久久久久久久久久看片| 91精品国产美女浴室洗澡无遮挡| 成人精品国产福利| 久久精品国产亚洲一区二区三区| 亚洲黄一区二区三区| 国产视频一区二区在线| 欧美日韩国产一区二区三区地区| 成人亚洲精品久久久久软件| 日本成人在线视频网站| 亚洲视频一二区| 精品99久久久久久| 91精品国产一区二区三区| 91福利资源站| 日本韩国精品在线| 成人午夜激情在线| 国产在线精品一区二区夜色| 男男视频亚洲欧美| 午夜精品在线看| 亚洲成av人片一区二区三区| 亚洲色图.com| 一级日本不卡的影视| 成人免费在线播放视频| 国产精品久久久久久久第一福利| 精品国产凹凸成av人网站| 在线播放日韩导航| 在线欧美小视频| 欧美视频一区二区在线观看| 成人av电影免费观看| 国产成人8x视频一区二区| 国产中文字幕一区| 国产剧情一区二区| 国模大尺度一区二区三区| 精品一区二区三区香蕉蜜桃 | 蜜臀av亚洲一区中文字幕| 午夜一区二区三区在线观看| 一区二区三区日本| 三级不卡在线观看| 精品中文字幕一区二区小辣椒| 蜜臀av性久久久久蜜臀aⅴ| 捆绑调教美女网站视频一区| 久久99蜜桃精品| 韩国精品在线观看| 国产suv精品一区二区883| 91小视频在线观看| 欧美性xxxxxx少妇| 日韩欧美国产小视频| 久久久国产精品午夜一区ai换脸| 国产三区在线成人av| 国产精品另类一区| 亚洲欧美一区二区三区极速播放 | 天天综合网天天综合色| 日韩av在线播放中文字幕| 狠狠色综合播放一区二区| 国产91精品欧美| 在线亚洲免费视频| 日韩一区二区免费电影| 亚洲精品一区二区三区99| 国产精品久久久久影院亚瑟 | 亚洲一区视频在线观看视频| 亚洲 欧美综合在线网络| 日韩av网站在线观看| 国产一区二区三区久久久| 91麻豆国产福利在线观看| 欧美电影一区二区| 国产喷白浆一区二区三区| 亚洲国产一区视频| 国产精品一二三| 欧美日韩国产电影| 精品久久国产97色综合| 中文字幕一区二区三区乱码在线 | 中文成人综合网| 亚洲激情自拍偷拍| 狠狠色综合日日| 欧美影片第一页| 国产精品久久久久一区| 日本不卡高清视频| 一本色道久久综合亚洲91| 2023国产一二三区日本精品2022| 亚洲九九爱视频| 国产伦理精品不卡| 欧美麻豆精品久久久久久| 国产精品欧美精品| 久热成人在线视频| 777久久久精品| 亚洲男女毛片无遮挡| 国产精品一区二区在线看| 91麻豆精品久久久久蜜臀| 亚洲欧洲制服丝袜| 成人网在线播放| xfplay精品久久| 男女男精品网站| 欧美久久一二区| 亚洲色图清纯唯美| 本田岬高潮一区二区三区| 欧美一级久久久久久久大片| 亚洲午夜久久久久久久久电影院 | 国产美女娇喘av呻吟久久| 欧美日韩一区成人| 亚洲精品美国一| 9l国产精品久久久久麻豆| 国产日韩精品一区二区三区| 精品制服美女久久| 日韩色视频在线观看| 蜜臀av国产精品久久久久| 欧美日韩色一区| 亚洲国产日韩精品| 欧美性一二三区| 亚洲国产毛片aaaaa无费看| 日本高清成人免费播放| 亚洲欧美日韩国产另类专区| 99re热视频这里只精品| 中文字幕av一区二区三区免费看| 国产精品一区二区免费不卡| 久久久久久久久久电影| 国产一区二区免费视频|