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

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

?? tcp.c

?? 是一本完整而詳細的TCP/IP協議指南。描述了屬于每一層的各個協議以及它們如何在不同操作系統中運行。作者用Lawrence Berkeley實驗室的tcpdump程序來捕獲不同操作系統和TCP/IP實
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * Copyright (c) 2001, 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. Neither the name of the Institute nor the names of its contributors  *    may be used to endorse or promote products derived from this software  *    without specific prior written permission.  * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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> * * $Id: tcp.c,v 1.14 2002/03/04 10:47:56 adam Exp $ *//*-----------------------------------------------------------------------------------*//* tcp.c * * This file contains common functions for the TCP implementation, such as functinos * for manipulating the data structures and the TCP timer functions. TCP functions * related to input and output is found in tcp_input.c and tcp_output.c respectively. * *//*-----------------------------------------------------------------------------------*/#include "lwip/debug.h"#include "lwip/def.h"#include "lwip/mem.h"#include "lwip/memp.h"#include "lwip/tcp.h"/* Incremented every coarse grained timer shot   (typically every 500 ms, determined by TCP_COARSE_TIMEOUT). */u32_t tcp_ticks;const u8_t tcp_backoff[13] =    { 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 };/* The TCP PCB lists. */struct tcp_pcb_listen *tcp_listen_pcbs;  /* List of all TCP PCBs in LISTEN state. */struct tcp_pcb *tcp_active_pcbs;  /* List of all TCP PCBs that are in a				 state in which they accept or send				 data. */struct tcp_pcb *tcp_tw_pcbs;      /* List of all TCP PCBs in TIME-WAIT. */struct tcp_pcb *tcp_tmp_pcb;#define MIN(x,y) (x) < (y)? (x): (y)#if MEMP_RECLAIMstatic u8_t tcp_memp_reclaim(void *arg, memp_t type);#endif#if MEM_RECLAIMstatic mem_size_t tcp_mem_reclaim(void *arg, mem_size_t size);#endifstatic u8_t tcp_timer;/*-----------------------------------------------------------------------------------*//* * tcp_init(): * * Initializes the TCP layer. *//*-----------------------------------------------------------------------------------*/voidtcp_init(void){  /* Clear globals. */  tcp_listen_pcbs = NULL;  tcp_active_pcbs = NULL;  tcp_tw_pcbs = NULL;  tcp_tmp_pcb = NULL;    /* Register memory reclaim function */#if MEM_RECLAIM  mem_register_reclaim((mem_reclaim_func)tcp_mem_reclaim, NULL);#endif /* MEM_RECLAIM */#if MEMP_RECLAIM  memp_register_reclaim(MEMP_PBUF, (memp_reclaim_func)tcp_memp_reclaim, NULL);  memp_register_reclaim(MEMP_TCP_SEG, (memp_reclaim_func)tcp_memp_reclaim, NULL);  memp_register_reclaim(MEMP_TCP_PCB, (memp_reclaim_func)tcp_memp_reclaim, NULL);#endif /* MEMP_RECLAIM */  /* initialize timer */  tcp_ticks = 0;  tcp_timer = 0;  }/*-----------------------------------------------------------------------------------*//* * tcp_tmr(): * * Called periodically to dispatch TCP timers. * *//*-----------------------------------------------------------------------------------*/voidtcp_tmr(){  ++tcp_timer;  if(tcp_timer == 10) {    tcp_timer = 0;  }    if(tcp_timer & 1) {    /* Call tcp_fasttmr() every 200 ms, i.e., every other timer       tcp_tmr() is called. */    tcp_fasttmr();  }  if(tcp_timer == 0 || tcp_timer == 5) {    /* Call tcp_slowtmr() every 500 ms, i.e., every fifth timer       tcp_tmr() is called. */    tcp_slowtmr();  }}/*-----------------------------------------------------------------------------------*//* * tcp_close(): * * Closes the connection held by the PCB. * *//*-----------------------------------------------------------------------------------*/err_ttcp_close(struct tcp_pcb *pcb){  err_t err;#if TCP_DEBUG  DEBUGF(TCP_DEBUG, ("tcp_close: closing in state "));  tcp_debug_print_state(pcb->state);  DEBUGF(TCP_DEBUG, ("\n"));#endif /* TCP_DEBUG */  switch(pcb->state) {  case LISTEN:    err = ERR_OK;    tcp_pcb_remove((struct tcp_pcb **)&tcp_listen_pcbs, pcb);    memp_free(MEMP_TCP_PCB_LISTEN, pcb);    pcb = NULL;    break;  case SYN_SENT:    err = ERR_OK;    tcp_pcb_remove(&tcp_active_pcbs, pcb);    memp_free(MEMP_TCP_PCB, pcb);    pcb = NULL;    break;  case SYN_RCVD:    err = tcp_send_ctrl(pcb, TCP_FIN);    if(err == ERR_OK) {      pcb->state = FIN_WAIT_1;    }    break;  case ESTABLISHED:    err = tcp_send_ctrl(pcb, TCP_FIN);    if(err == ERR_OK) {      pcb->state = FIN_WAIT_1;    }    break;  case CLOSE_WAIT:    err = tcp_send_ctrl(pcb, TCP_FIN);    if(err == ERR_OK) {      pcb->state = LAST_ACK;    }    break;  default:    /* Has already been closed, do nothing. */    err = ERR_OK;    pcb = NULL;    break;  }  if(pcb != NULL && err == ERR_OK) {    err = tcp_output(pcb);  }  return err;}/*-----------------------------------------------------------------------------------*//* * tcp_abort() * * Aborts a connection by sending a RST to the remote host and deletes * the local protocol control block. This is done when a connection is * killed because of shortage of memory. * *//*-----------------------------------------------------------------------------------*/voidtcp_abort(struct tcp_pcb *pcb){  u32_t seqno, ackno;  u16_t remote_port, local_port;  struct ip_addr remote_ip, local_ip;  void (* errf)(void *arg, err_t err);  void *errf_arg;    /* Figure out on which TCP PCB list we are, and remove us. If we     are in an active state, call the receive function associated with     the PCB with a NULL argument, and send an RST to the remote end. */  if(pcb->state == TIME_WAIT) {    tcp_pcb_remove(&tcp_tw_pcbs, pcb);    memp_free(MEMP_TCP_PCB, pcb);  } else if(pcb->state == LISTEN) {    tcp_pcb_remove((struct tcp_pcb **)&tcp_listen_pcbs, pcb);    memp_free(MEMP_TCP_PCB_LISTEN, pcb);  } else {    seqno = pcb->snd_nxt;    ackno = pcb->rcv_nxt;    ip_addr_set(&local_ip, &(pcb->local_ip));    ip_addr_set(&remote_ip, &(pcb->remote_ip));    local_port = pcb->local_port;    remote_port = pcb->remote_port;    errf = pcb->errf;    errf_arg = pcb->callback_arg;    tcp_pcb_remove(&tcp_active_pcbs, pcb);    memp_free(MEMP_TCP_PCB, pcb);    if(errf != NULL) {      errf(errf_arg, ERR_ABRT);    }    DEBUGF(TCP_RST_DEBUG, ("tcp_abort: sending RST\n"));    tcp_rst(seqno, ackno, &local_ip, &remote_ip, local_port, remote_port);  }}/*-----------------------------------------------------------------------------------*//* * tcp_bind(): * * Binds the connection to a local portnumber and IP address. If the * IP address is not given (i.e., ipaddr == NULL), the IP address of * the outgoing network interface is used instead. * *//*-----------------------------------------------------------------------------------*/err_ttcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port){  struct tcp_pcb *cpcb;  /* Check if the address already is in use. */  for(cpcb = (struct tcp_pcb *)tcp_listen_pcbs;      cpcb != NULL; cpcb = cpcb->next) {    if(cpcb->local_port == port) {      if(ip_addr_isany(&(cpcb->local_ip)) ||	 ip_addr_isany(ipaddr) ||	 ip_addr_cmp(&(cpcb->local_ip), ipaddr)) {	return ERR_USE;      }    }  }  for(cpcb = tcp_active_pcbs;      cpcb != NULL; cpcb = cpcb->next) {    if(cpcb->local_port == port) {      if(ip_addr_isany(&(cpcb->local_ip)) ||	 ip_addr_isany(ipaddr) ||	 ip_addr_cmp(&(cpcb->local_ip), ipaddr)) {	return ERR_USE;      }    }  }  if(!ip_addr_isany(ipaddr)) {    pcb->local_ip = *ipaddr;  }  pcb->local_port = port;  DEBUGF(TCP_DEBUG, ("tcp_bind: bind to port %d\n", port));  return ERR_OK;}/*-----------------------------------------------------------------------------------*//* * tcp_listen(): * * Set the state of the connection to be LISTEN, which means that it * is able to accept incoming connections. The protocol control block * is reallocated in order to consume less memory. Setting the * connection to LISTEN is an irreversible process. * *//*-----------------------------------------------------------------------------------*/struct tcp_pcb *tcp_listen(struct tcp_pcb *pcb){  pcb->state = LISTEN;  pcb = memp_realloc(MEMP_TCP_PCB, MEMP_TCP_PCB_LISTEN, pcb);  if(pcb == NULL) {    return NULL;  }  TCP_REG((struct tcp_pcb **)&tcp_listen_pcbs, pcb);  return pcb;}/*-----------------------------------------------------------------------------------*//* * tcp_recved(): * * This function should be called by the application when it has * processed the data. The purpose is to advertise a larger window * when the data has been processed. * *//*-----------------------------------------------------------------------------------*/voidtcp_recved(struct tcp_pcb *pcb, u16_t len){  pcb->rcv_wnd += len;  if(pcb->rcv_wnd > TCP_WND) {    pcb->rcv_wnd = TCP_WND;  }  if(!(pcb->flags & TF_ACK_DELAY) ||     !(pcb->flags & TF_ACK_NOW)) {    tcp_ack(pcb);  }  DEBUGF(TCP_DEBUG, ("tcp_recved: recveived %d bytes, wnd %u (%u).\n",		     len, pcb->rcv_wnd, TCP_WND - pcb->rcv_wnd));}/*-----------------------------------------------------------------------------------*//* * tcp_new_port(): * * A nastly hack featuring 'goto' statements that allocates a * new TCP local port. *//*-----------------------------------------------------------------------------------*/static u16_ttcp_new_port(void){  struct tcp_pcb *pcb;  static u16_t port = 4096;   again:  if(++port > 0x7fff) {    port = 4096;  }    for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {    if(pcb->local_port == port) {      goto again;    }  }  for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {    if(pcb->local_port == port) {      goto again;    }  }  for(pcb = (struct tcp_pcb *)tcp_listen_pcbs; pcb != NULL; pcb = pcb->next) {    if(pcb->local_port == port) {      goto again;    }  }  return port;}/*-----------------------------------------------------------------------------------*//* * tcp_connect(): * * Connects to another host. The function given as the "connected" * argument will be called when the connection has been established. * *//*-----------------------------------------------------------------------------------*/err_ttcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,	    err_t (* connected)(void *arg, struct tcp_pcb *tpcb, err_t err)){  u32_t optdata;  err_t ret;  u32_t iss;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费黄色在线| 欧美精品一区视频| 日韩免费观看高清完整版| 成人欧美一区二区三区黑人麻豆| 日韩制服丝袜av| 成人激情动漫在线观看| 精品国精品国产| 午夜av一区二区| 一本色道久久综合亚洲91| 久久五月婷婷丁香社区| 日韩制服丝袜av| 欧美日韩综合不卡| 亚洲人成7777| 91麻豆免费视频| 1区2区3区精品视频| 国产成人免费视频网站| 精品国产伦一区二区三区观看体验 | 国产日本亚洲高清| 免费人成黄页网站在线一区二区| 欧美视频一区二区三区| 一区二区在线观看av| 成人av一区二区三区| 国产精品欧美久久久久一区二区| 国产乱妇无码大片在线观看| 日韩欧美一级二级| 蜜桃精品视频在线观看| 欧美一区二区三区免费视频| 午夜精品久久久久久久99水蜜桃| 91视频免费播放| 亚洲色图视频网| 91丝袜高跟美女视频| 成人免费在线视频观看| 91色porny| 一区二区三区日韩欧美精品| 色综合 综合色| 亚洲成人先锋电影| 欧美一区三区四区| 久久99国内精品| 久久久久久久久久久久电影 | 欧美一区二区三区在线看| 午夜欧美视频在线观看 | 中文字幕高清不卡| 99视频超级精品| 中文字幕亚洲欧美在线不卡| 91麻豆国产在线观看| 一区二区三区日韩| 欧美剧情片在线观看| 蜜臀久久99精品久久久久久9| 欧美大片在线观看一区| 国产一区二区三区在线观看免费 | 国产精品二区一区二区aⅴ污介绍| 丰满岳乱妇一区二区三区| 国产精品热久久久久夜色精品三区| 国产精品一区二区x88av| 亚洲欧美二区三区| 在线播放中文一区| 风间由美性色一区二区三区| 亚洲美女少妇撒尿| 日韩午夜激情电影| 99精品桃花视频在线观看| 亚洲永久精品国产| 26uuu久久综合| 91在线视频网址| 亚洲一区在线观看免费| 欧美精品一区二区三区蜜桃视频| 成人黄色电影在线| 日韩电影一区二区三区| 国产精品欧美一区喷水| 欧美美女一区二区| 国产91清纯白嫩初高中在线观看| 亚洲综合在线电影| 久久久欧美精品sm网站| 欧美视频三区在线播放| 国产大片一区二区| 午夜精品福利久久久| 欧美国产日韩在线观看| 欧美日韩国产首页在线观看| 岛国一区二区在线观看| 日韩高清不卡在线| 国产精品九色蝌蚪自拍| 日韩片之四级片| 欧洲色大大久久| 成人毛片视频在线观看| 免费高清视频精品| 亚洲一区二区中文在线| 国产精品美女一区二区在线观看| 欧美一区二区三区免费视频| 色综合久久中文字幕综合网| 国产一区二区三区四区五区入口| 性欧美大战久久久久久久久| 亚洲日本一区二区| 欧美国产日韩在线观看| 欧美精品一区二区三区在线播放| 6080yy午夜一二三区久久| 99麻豆久久久国产精品免费| 国精产品一区一区三区mba视频 | 日韩欧美国产综合| 欧美日本乱大交xxxxx| 在线观看一区日韩| 91女神在线视频| 成人动漫视频在线| 国产91清纯白嫩初高中在线观看| 精品一区二区三区免费视频| 久热成人在线视频| 免费在线观看一区二区三区| 午夜电影一区二区| 日韩精品国产欧美| 日本三级亚洲精品| 免费美女久久99| 热久久一区二区| 天天做天天摸天天爽国产一区| 亚洲一区二区影院| 亚洲国产精品影院| 亚洲成a人在线观看| 亚洲国产视频一区二区| 亚洲制服丝袜在线| 天堂蜜桃91精品| 奇米影视7777精品一区二区| 欧美aaaaaa午夜精品| 乱一区二区av| 国产一区91精品张津瑜| 国产69精品久久777的优势| 国产91丝袜在线播放| 97精品久久久午夜一区二区三区| www.亚洲人| 欧美亚洲综合一区| 9191成人精品久久| 精品乱人伦小说| 中文字幕av一区二区三区高| 中文字幕一区二区三区四区| 亚洲日穴在线视频| 日韩精品久久理论片| 国产在线播放一区| av成人动漫在线观看| 欧美日韩一区 二区 三区 久久精品| 884aa四虎影成人精品一区| 精品粉嫩超白一线天av| 亚洲欧美综合色| 午夜精品在线看| 国产黄色成人av| 日本高清不卡在线观看| 91精品午夜视频| 国产欧美精品区一区二区三区| 亚洲欧洲av另类| 人人狠狠综合久久亚洲| 粗大黑人巨茎大战欧美成人| 在线免费不卡电影| 亚洲精品一区二区三区影院| 亚洲欧美综合另类在线卡通| 日本亚洲电影天堂| 91亚洲国产成人精品一区二三| 欧美色图片你懂的| 久久久九九九九| 亚洲成av人片一区二区三区| 国产大陆亚洲精品国产| 欧美日韩二区三区| 国产视频一区二区在线| 亚洲午夜免费视频| 国产高清久久久久| 欧美另类变人与禽xxxxx| 久久久91精品国产一区二区精品| 亚洲一区视频在线| 成人免费黄色在线| 久久亚洲捆绑美女| 青青草国产成人99久久| 91亚洲永久精品| 精品国产污网站| 午夜精品久久久久久不卡8050| 不卡的av在线| 精品成人a区在线观看| 亚洲va天堂va国产va久| 91蜜桃网址入口| 久久久久99精品国产片| 奇米精品一区二区三区在线观看一| 91免费精品国自产拍在线不卡| wwwwww.欧美系列| 日本中文一区二区三区| 色综合咪咪久久| 亚洲国产精品黑人久久久| 另类小说欧美激情| 欧美一级在线免费| 亚洲国产一区二区视频| 色婷婷国产精品综合在线观看| 国产色综合一区| 国产一区二区毛片| 久久人人97超碰com| 麻豆成人免费电影| 欧美一区二区播放| 日本成人在线看| 欧美一级理论片| 蜜桃一区二区三区四区| 56国语精品自产拍在线观看| 首页综合国产亚洲丝袜| 在线免费不卡电影| 午夜国产精品影院在线观看| 欧美日韩1234| 日韩av电影免费观看高清完整版 | 精品电影一区二区| 狠狠色丁香婷综合久久| 精品999久久久|