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

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

?? uip.c

?? IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR
?? C
?? 第 1 頁 / 共 5 頁
字號:
/**
 * \addtogroup uip
 * @{
 */

/**
 * \file
 * The uIP TCP/IP stack code.
 * \author Adam Dunkels <adam@dunkels.com>
 */

/*
 * Copyright (c) 2001-2003, Adam Dunkels.
 * 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 uIP TCP/IP stack.
 *
 * $Id: uip.c,v 1.62.2.10 2003/10/07 13:23:01 adam Exp $
 *
 */

/*
This is a small implementation of the IP and TCP protocols (as well as
some basic ICMP stuff). The implementation couples the IP, TCP and the
application layers very tightly. To keep the size of the compiled code
down, this code also features heavy usage of the goto statement.

The principle is that we have a small buffer, called the uip_buf, in
which the device driver puts an incoming packet. The TCP/IP stack
parses the headers in the packet, and calls upon the application. If
the remote host has sent data to the application, this data is present
in the uip_buf and the application read the data from there. It is up
to the application to put this data into a byte stream if needed. The
application will not be fed with data that is out of sequence.

If the application whishes to send data to the peer, it should put its
data into the uip_buf, 40 bytes from the start of the buffer. The
TCP/IP stack will calculate the checksums, and fill in the necessary
header fields and finally send the packet back to the peer.
*/

#include "uip.h"
#include "uipopt.h"
#include "uip_arch.h"



/* Structures and definitions. */
#define TCP_FIN 0x01
#define TCP_SYN 0x02
#define TCP_RST 0x04
#define TCP_PSH 0x08
#define TCP_ACK 0x10
#define TCP_URG 0x20
#define TCP_CTL 0x3f

#define ICMP_ECHO_REPLY 0
#define ICMP_ECHO       8

/* Macros. */
#define BUF ((uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define FBUF ((uip_tcpip_hdr *)&uip_reassbuf[0])
#define ICMPBUF ((uip_icmpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define UDPBUF ((uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])

#if UIP_STATISTICS == 1
struct uip_stats uip_stat;
#define UIP_STAT(s) s
#else
#define UIP_STAT(s)
#endif /* UIP_STATISTICS == 1 */

#if UIP_LOGGING == 1
#include <stdio.h>
void uip_log(char *msg);
#define UIP_LOG(m) uip_log(m)
#else
#define UIP_LOG(m)
#endif /* UIP_LOGGING == 1 */




/*-----------------------------------------------------------------------------------*/
/* Variable definitions. */


/* The IP address of this host. If it is defined to be fixed (by setting UIP_FIXEDADDR to 1 in uipopt.h), the address is set here. Otherwise, the address */
#if UIP_FIXEDADDR > 0
  const u16_t uip_hostaddr[2] = { HTONS((UIP_IPADDR0 << 8) | UIP_IPADDR1),
                                  HTONS((UIP_IPADDR2 << 8) | UIP_IPADDR3)};
  const u16_t uip_arp_draddr[2] = {HTONS((UIP_DRIPADDR0 << 8) | UIP_DRIPADDR1),
                                   HTONS((UIP_DRIPADDR2 << 8) | UIP_DRIPADDR3)};
  const u16_t uip_arp_netmask[2] ={HTONS((UIP_NETMASK0 << 8) | UIP_NETMASK1),
                                   HTONS((UIP_NETMASK2 << 8) | UIP_NETMASK3)};
#else
  u16_t uip_hostaddr[2];
  u16_t uip_arp_draddr[2], uip_arp_netmask[2];
#endif /* UIP_FIXEDADDR */

  u8_t uip_buf[UIP_BUFSIZE+2];   /* The packet buffer that contains incoming packets. */
  volatile u8_t *uip_appdata;  /* The uip_appdata pointer points to application data. */
  volatile u8_t *uip_sappdata;  /* The uip_appdata pointer points to the application data which is to be sent. */
#if UIP_URGDATA > 0
  volatile u8_t *uip_urgdata;  /* The uip_urgdata pointer points to urgent data (out-of-band data), if present. */
  volatile u8_t uip_urglen, uip_surglen;
#endif /* UIP_URGDATA > 0 */
  volatile u16_t uip_len, uip_slen; /* The uip_len is either 8 or 16 bits,
				        depending on the maximum packet
        				size. */

  volatile u8_t uip_flags;     /* The uip_flags variable is used for
				communication between the TCP/IP stack
				and the application program. */
  struct uip_conn *uip_conn;   /* uip_conn always points to the current
				connection. */

  struct uip_conn uip_conns[UIP_CONNS];
                             /* The uip_conns array holds all TCP
				connections. */
  u16_t uip_listenports[UIP_LISTENPORTS];
                             /* The uip_listenports list all currently
				listning ports. */
#if UIP_UDP
  struct uip_udp_conn *uip_udp_conn;
  struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
#endif /* UIP_UDP */

  static u16_t ipid;           /* Ths ipid variable is an increasing
				number that is used for the IP ID
				field. */

  static u8_t iss[4];          /* The iss variable is used for the TCP
				initial sequence number. */

#if UIP_ACTIVE_OPEN
  static u16_t lastport;       /* Keeps track of the last port used for
				a new connection. */
#endif /* UIP_ACTIVE_OPEN */

/* Temporary variables. */
  volatile u8_t uip_acc32[4];
  static u8_t c, opt;
  static u16_t tmp16;


/*-----------------------------------------------------------------------------------*/
void uip_init(void)
{
  for(c = 0; c < UIP_LISTENPORTS; ++c) {
                      uip_listenports[c] = 0;
  }
  for(c = 0; c < UIP_CONNS; ++c) {
                      uip_conns[c].tcpstateflags = CLOSED;
  }
#if UIP_ACTIVE_OPEN
  lastport = 1024;
#endif /* UIP_ACTIVE_OPEN */

#if UIP_UDP
  for(c = 0; c < UIP_UDP_CONNS; ++c) {
                      uip_udp_conns[c].lport = 0;
  }
#endif /* UIP_UDP */

  /* IPv4 initialization. */
#if UIP_FIXEDADDR == 0
  uip_hostaddr[0] = uip_hostaddr[1] = 0;
#endif /* UIP_FIXEDADDR */

}
/*-----------------------------------------------------------------------------------*/
#if UIP_ACTIVE_OPEN
struct uip_conn * uip_connect(u16_t *ripaddr, u16_t rport)
{
      register struct uip_conn *conn, *cconn;
  
again:/* Find an unused local port. */
      ++lastport;

      if(lastport >= 32000) {
                    lastport = 4096;
       }
   
     for(c = 0; c < UIP_CONNS; ++c) {/* Check if this port is already in use, and if so try to find
                                         another one. */
                     conn = &uip_conns[c];
                     if(conn->tcpstateflags != CLOSED && conn->lport == htons(lastport)) {
                                                                                   goto again;
                     }
     }
     conn = 0;
     for(c = 0; c < UIP_CONNS; ++c) {
                       cconn = &uip_conns[c];
                       if(cconn->tcpstateflags == CLOSED) {
                                                   conn = cconn;
                                                   break;
                       }
                       if(cconn->tcpstateflags == TIME_WAIT) {
                                   if(conn == 0 || cconn->timer > uip_conn->timer) {
                                                   conn = cconn;
                                   }
                       }
     }
    if(conn == 0) {
           return 0;
    }

    conn->tcpstateflags = SYN_SENT;

    conn->snd_nxt[0] = iss[0];
    conn->snd_nxt[1] = iss[1];
    conn->snd_nxt[2] = iss[2];
    conn->snd_nxt[3] = iss[3];

    conn->initialmss = conn->mss = UIP_TCP_MSS;

    conn->len = 1;   /* TCP length of the SYN is one. */
    conn->nrtx = 0;
    conn->timer = 1; /* Send the SYN next time around. */
    conn->rto = UIP_RTO;
    conn->sa = 0;
    conn->sv = 16;
    conn->lport = htons(lastport);
    conn->rport = rport;
    conn->ripaddr[0] = ripaddr[0];
    conn->ripaddr[1] = ripaddr[1];

    return conn;
}
#endif /* UIP_ACTIVE_OPEN */
/*-----------------------------------------------------------------------------------*/
#if UIP_UDP
struct uip_udp_conn * uip_udp_new(u16_t *ripaddr, u16_t rport)
{
    register struct uip_udp_conn *conn;

  
again:/* Find an unused local port. */
    ++lastport;

    if(lastport >= 32000) {
                lastport = 4096;
    }
    for(c = 0; c < UIP_UDP_CONNS; ++c) {
                if(uip_udp_conns[c].lport == lastport) {
                                                  goto again;
                }
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色屁屁一区二区| 亚洲婷婷综合久久一本伊一区| 欧美日韩一区二区三区四区| 91丨porny丨首页| 成人avav影音| 92国产精品观看| 成人av资源网站| 99热精品国产| 91日韩在线专区| 在线精品亚洲一区二区不卡| 精品污污网站免费看| 欧美日韩国产美| 欧美一区三区四区| 精品剧情在线观看| 久久蜜桃av一区二区天堂 | 欧美美女bb生活片| 欧美日韩一区二区三区四区| 日韩一区国产二区欧美三区| 精品日产卡一卡二卡麻豆| 国产亚洲欧洲997久久综合| 久久精品免费在线观看| 自拍视频在线观看一区二区| 亚洲自拍偷拍麻豆| 日韩电影免费在线| 国产一区二区三区在线观看免费视频 | 国产一区视频导航| 国产91精品一区二区麻豆网站 | 中文字幕一区视频| 精品一区二区三区免费| 成人伦理片在线| 在线亚洲一区二区| 91精品国产综合久久久久久久久久 | 日本vs亚洲vs韩国一区三区| 国产一区二区在线视频| 成人黄色电影在线| 欧美日韩一区在线| 久久久电影一区二区三区| 日韩伦理电影网| 偷拍一区二区三区四区| 国产一区二区三区最好精华液| 97久久精品人人爽人人爽蜜臀| 欧美日韩一区二区三区在线看| 精品电影一区二区| 亚洲欧美色图小说| 免费一级欧美片在线观看| 成人开心网精品视频| 欧美日韩免费观看一区三区| 久久九九国产精品| 亚洲午夜激情网站| 成人午夜电影久久影院| 欧美日韩成人综合在线一区二区| 2欧美一区二区三区在线观看视频| 综合色天天鬼久久鬼色| 久久精品国产免费看久久精品| 波多野结衣精品在线| 日韩一区二区精品在线观看| 亚洲私人黄色宅男| 久久99精品久久久| 欧美怡红院视频| 国产精品久久久久永久免费观看| 午夜精品国产更新| 色综合久久99| 国产日韩精品一区二区三区在线| 亚洲妇女屁股眼交7| 成人精品视频一区二区三区| 3d成人动漫网站| 一区二区三区蜜桃网| 国产成人免费av在线| 日韩一级完整毛片| 亚洲二区在线观看| 91色综合久久久久婷婷| 精品久久久久久久人人人人传媒| 亚洲最大成人综合| eeuss鲁片一区二区三区| 精品av综合导航| 日本欧美一区二区在线观看| 在线一区二区三区四区| 成人欧美一区二区三区视频网页| 精品午夜久久福利影院| 欧美高清一级片在线| 一区二区三区丝袜| 91婷婷韩国欧美一区二区| 蜜臀av国产精品久久久久| 在线一区二区三区做爰视频网站| 国产精品污www在线观看| 国产精品一区二区在线观看不卡| 日韩视频国产视频| 日韩精品一级中文字幕精品视频免费观看 | 国产东北露脸精品视频| 精品久久一区二区| 捆绑紧缚一区二区三区视频| 欧美一区二区在线免费观看| 午夜影院在线观看欧美| 欧美日韩免费观看一区二区三区 | 成人黄色大片在线观看| 国产人伦精品一区二区| 国产剧情一区二区| 久久九九全国免费| 国产精品一二三| 久久久久久电影| 国产精品一区在线观看你懂的| 欧美精品一区二区三区在线播放| 老司机午夜精品| 日韩欧美成人激情| 美女视频黄a大片欧美| 日韩视频免费观看高清完整版| 日韩国产成人精品| 日韩一区二区高清| 国产一区二区三区在线观看免费| 精品电影一区二区三区| 国产麻豆一精品一av一免费| 久久精品无码一区二区三区| 国产成人欧美日韩在线电影| 国产精品入口麻豆九色| 91免费国产在线观看| 亚洲免费色视频| 精品视频一区 二区 三区| 日韩影视精彩在线| 精品裸体舞一区二区三区| 国产sm精品调教视频网站| 国产精品视频你懂的| 色综合中文字幕国产| 亚洲人成精品久久久久| 欧美中文一区二区三区| 丝袜脚交一区二区| 精品日韩一区二区三区免费视频| 韩国成人精品a∨在线观看| 日本一区二区不卡视频| 成人av网站免费| 亚洲成在人线免费| 日韩精品一区二区三区三区免费 | 精品日韩成人av| 国产ts人妖一区二区| 一区二区视频在线| 3d动漫精品啪啪一区二区竹菊| 国产一区二区成人久久免费影院| 日韩理论片网站| 欧美一区二区三区四区在线观看| 国内精品不卡在线| 亚洲女爱视频在线| 日韩一区二区在线看片| 成人美女在线观看| 日韩高清中文字幕一区| 亚洲国产岛国毛片在线| 欧美视频一区在线| 国产一区二区三区不卡在线观看 | 国模一区二区三区白浆| 中文字幕一区二区三区不卡| 欧美精品一卡两卡| 国产高清无密码一区二区三区| 亚洲另类中文字| 精品国产一区二区三区久久影院| 成人污污视频在线观看| 亚洲大型综合色站| 国产精品毛片大码女人| 91精品在线免费| 99热国产精品| 国产在线一区观看| 亚洲与欧洲av电影| 中文在线资源观看网站视频免费不卡 | 国产毛片精品视频| 亚洲第一搞黄网站| 亚洲国产精品成人综合色在线婷婷| 欧美三级电影在线看| 国产成人在线视频免费播放| 亚洲www啪成人一区二区麻豆 | 国产精品456| 天堂午夜影视日韩欧美一区二区| 欧美国产精品v| 精品日韩在线一区| 欧美丰满嫩嫩电影| 色欧美乱欧美15图片| 国产精品一卡二卡在线观看| 日产欧产美韩系列久久99| 亚洲视频在线观看一区| 国产日韩精品一区二区三区 | 亚洲黄色av一区| 亚洲国产高清不卡| 久久综合九色综合欧美98| 欧美乱熟臀69xxxxxx| 97国产精品videossex| 国产精品白丝jk白祙喷水网站| 一本大道久久a久久综合婷婷 | 在线视频综合导航| 99久久精品一区| 国产v综合v亚洲欧| 国产一区二区三区精品欧美日韩一区二区三区| 一区av在线播放| 亚洲人成伊人成综合网小说| 中文字幕第一区二区| 国产欧美精品一区二区色综合 | 奇米色一区二区| 亚洲国产va精品久久久不卡综合| 中文字幕亚洲视频| 中文字幕 久热精品 视频在线| 国产视频一区二区在线| 久久免费偷拍视频| 久久久久久久久久久久电影| 精品国产精品一区二区夜夜嗨| 91精品国产黑色紧身裤美女|