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

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

?? inet.c

?? ARM7的一些試驗程序
?? C
字號:
/*
 * 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>
 *
 */


/* inet.c
 *
 * Functions common to all TCP/IP modules, such as the Internet checksum and the
 * byte order functions.
 *
 */


#include "lwip/opt.h"

#include "lwip/arch.h"

#include "lwip/def.h"
#include "lwip/inet.h"

#include "lwip/sys.h"

/* This is a reference implementation of the checksum algorithm

 - it may not work on all architectures, and all processors, particularly
   if they have issues with alignment and 16 bit access.

 - in this case you will need to port it to your architecture and 
   #define LWIP_CHKSUM <your_checksum_routine> 
   in your sys_arch.h
*/
#ifndef LWIP_CHKSUM
#define LWIP_CHKSUM lwip_standard_chksum
static u16_t
lwip_standard_chksum(void *dataptr, int len)
{
  u32_t acc;

  LWIP_DEBUGF(INET_DEBUG, ("lwip_chksum(%p, %d)\n", (void *)dataptr, len));
  for(acc = 0; len > 1; len -= 2) {
      /*    acc = acc + *((u16_t *)dataptr)++;*/
    acc += *(u16_t *)dataptr;
    dataptr = (void *)((u16_t *)dataptr + 1);
  }

  /* add up any odd byte */
  if (len == 1) {
    acc += htons((u16_t)((*(u8_t *)dataptr) & 0xff) << 8);
    LWIP_DEBUGF(INET_DEBUG, ("inet: chksum: odd byte %d\n", (unsigned int)(*(u8_t *)dataptr)));
  } else {
    LWIP_DEBUGF(INET_DEBUG, ("inet: chksum: no odd byte\n"));
  }
  acc = (acc >> 16) + (acc & 0xffffUL);

  if ((acc & 0xffff0000) != 0) {
    acc = (acc >> 16) + (acc & 0xffffUL);
  }

  return (u16_t)acc;
}
#endif

/* inet_chksum_pseudo:
 *
 * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
 */

u16_t
inet_chksum_pseudo(struct pbuf *p,
       struct ip_addr *src, struct ip_addr *dest,
       u8_t proto, u16_t proto_len)
{
  u32_t acc;
  struct pbuf *q;
  u8_t swapped;

  acc = 0;
  swapped = 0;
  /* iterate through all pbuf in chain */
  for(q = p; q != NULL; q = q->next) {
    LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n",
      (void *)q, (void *)q->next));
    acc += LWIP_CHKSUM(q->payload, q->len);
    /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%lx \n", acc));*/
    while (acc >> 16) {
      acc = (acc & 0xffffUL) + (acc >> 16);
    }
    if (q->len % 2 != 0) {
      swapped = 1 - swapped;
      acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8);
    }
    /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%lx \n", acc));*/
  }

  if (swapped) {
    acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8);
  }
  acc += (src->addr & 0xffffUL);
  acc += ((src->addr >> 16) & 0xffffUL);
  acc += (dest->addr & 0xffffUL);
  acc += ((dest->addr >> 16) & 0xffffUL);
  acc += (u32_t)htons((u16_t)proto);
  acc += (u32_t)htons(proto_len);

  while (acc >> 16) {
    acc = (acc & 0xffffUL) + (acc >> 16);
  }
  LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%lx\n", acc));
  return (u16_t)~(acc & 0xffffUL);
}

/* inet_chksum:
 *
 * Calculates the Internet checksum over a portion of memory. Used primarely for IP
 * and ICMP.
 */

u16_t
inet_chksum(void *dataptr, u16_t len)
{
  u32_t acc;

  acc = LWIP_CHKSUM(dataptr, len);
  while (acc >> 16) {
    acc = (acc & 0xffff) + (acc >> 16);
  }
  return (u16_t)~(acc & 0xffff);
}

u16_t
inet_chksum_pbuf(struct pbuf *p)
{
  u32_t acc;
  struct pbuf *q;
  u8_t swapped;

  acc = 0;
  swapped = 0;
  for(q = p; q != NULL; q = q->next) {
    acc += LWIP_CHKSUM(q->payload, q->len);
    while (acc >> 16) {
      acc = (acc & 0xffffUL) + (acc >> 16);
    }
    if (q->len % 2 != 0) {
      swapped = 1 - swapped;
      acc = (acc & 0x00ffUL << 8) | (acc & 0xff00UL >> 8);
    }
  }

  if (swapped) {
    acc = ((acc & 0x00ffUL) << 8) | ((acc & 0xff00UL) >> 8);
  }
  return (u16_t)~(acc & 0xffffUL);
}

/* Here for now until needed in other places in lwIP */
#ifndef isascii
#define in_range(c, lo, up)  ((u8_t)c >= lo && (u8_t)c <= up)
#define isascii(c)           in_range(c, 0x20, 0x7f)
#define isdigit(c)           in_range(c, '0', '9')
#define isxdigit(c)          (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'))
#define islower(c)           in_range(c, 'a', 'z')
#define isspace(c)           (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
#endif		
		

 /*
  * Ascii internet address interpretation routine.
  * The value returned is in network order.
  */

 /*  */
 /* inet_addr */
 u32_t inet_addr(const char *cp)
 {
     struct in_addr val;

     if (inet_aton(cp, &val)) {
         return (val.s_addr);
     }
     return (INADDR_NONE);
 }

 /*
  * Check whether "cp" is a valid ascii representation
  * of an Internet address and convert to a binary address.
  * Returns 1 if the address is valid, 0 if not.
  * This replaces inet_addr, the return value from which
  * cannot distinguish between failure and a local broadcast address.
  */
 /*  */
 /* inet_aton */
 int inet_aton(const char *cp, struct in_addr *addr)
 {
     u32_t val;
     int base, n;
     char c;
     u32_t parts[4];
     u32_t* pp = parts;

     c = *cp;
     for (;;) {
         /*
          * Collect number up to ``.''.
          * Values are specified as for C:
          * 0x=hex, 0=octal, isdigit=decimal.
          */
         if (!isdigit(c))
             return (0);
         val = 0; base = 10;
         if (c == '0') {
             c = *++cp;
             if (c == 'x' || c == 'X')
                 base = 16, c = *++cp;
             else
                 base = 8;
         }
         for (;;) {
             if (isdigit(c)) {
                 val = (val * base) + (int)(c - '0');
                 c = *++cp;
             } else if (base == 16 && isxdigit(c)) {
                 val = (val << 4) |
                     (int)(c + 10 - (islower(c) ? 'a' : 'A'));
                 c = *++cp;
             } else
             break;
         }
         if (c == '.') {
             /*
              * Internet format:
              *  a.b.c.d
              *  a.b.c   (with c treated as 16 bits)
              *  a.b (with b treated as 24 bits)
              */
             if (pp >= parts + 3)
                 return (0);
             *pp++ = val;
             c = *++cp;
         } else
             break;
     }
     /*
      * Check for trailing characters.
      */
     if (c != '\0' && (!isascii(c) || !isspace(c)))
         return (0);
     /*
      * Concoct the address according to
      * the number of parts specified.
      */
     n = pp - parts + 1;
     switch (n) {

     case 0:
         return (0);     /* initial nondigit */

     case 1:             /* a -- 32 bits */
         break;

     case 2:             /* a.b -- 8.24 bits */
         if (val > 0xffffff)
             return (0);
         val |= parts[0] << 24;
         break;

     case 3:             /* a.b.c -- 8.8.16 bits */
         if (val > 0xffff)
             return (0);
         val |= (parts[0] << 24) | (parts[1] << 16);
         break;

     case 4:             /* a.b.c.d -- 8.8.8.8 bits */
         if (val > 0xff)
             return (0);
         val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
         break;
     }
     if (addr)
         addr->s_addr = htonl(val);
     return (1);
 }

/* Convert numeric IP address into decimal dotted ASCII representation.
 * returns ptr to static buffer; not reentrant!
 */
char *inet_ntoa(struct in_addr addr)
{
  static char str[16];
  u32_t s_addr = addr.s_addr;
  char inv[3];
  char *rp;
  u8_t *ap;
  u8_t rem;
  u8_t n;
  u8_t i;

  rp = str;
  ap = (u8_t *)&s_addr;
  for(n = 0; n < 4; n++) {
    i = 0;
    do {
      rem = *ap % (u8_t)10;
      *ap /= (u8_t)10;
      inv[i++] = '0' + rem;
    } while(*ap);
    while(i--)
      *rp++ = inv[i];
    *rp++ = '.';
    ap++;
  }
  *--rp = 0;
  return str;
}


#ifndef BYTE_ORDER
#error BYTE_ORDER is not defined
#endif
#if BYTE_ORDER == LITTLE_ENDIAN

u16_t
htons(u16_t n)
{
  return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
}

u16_t
ntohs(u16_t n)
{
  return htons(n);
}

u32_t
htonl(u32_t n)
{
  return ((n & 0xff) << 24) |
    ((n & 0xff00) << 8) |
    ((n & 0xff0000) >> 8) |
    ((n & 0xff000000) >> 24);
}

u32_t
ntohl(u32_t n)
{
  return htonl(n);
}

#endif /* BYTE_ORDER == LITTLE_ENDIAN */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线视频亚洲一区| 高清成人在线观看| 欧美一区二区在线看| 五月综合激情网| 日韩精品在线一区二区| 国产在线视频一区二区三区| 久久综合五月天婷婷伊人| 国产精品一二三四五| 国产精品青草久久| 3751色影院一区二区三区| 亚洲777理论| 日韩欧美视频在线| 大美女一区二区三区| 亚洲欧美视频一区| 日韩一区二区精品葵司在线| 国产剧情一区在线| 亚洲精品伦理在线| 日韩一级免费观看| 成人精品视频网站| 亚洲国产日韩av| 久久综合av免费| 91久久免费观看| 激情图区综合网| 亚洲日本va午夜在线影院| 欧美日韩不卡一区二区| 国产激情91久久精品导航| 一区二区三区国产精华| 日韩免费视频一区二区| 成人手机电影网| 热久久久久久久| 国产精品伦一区| 91精品国产91热久久久做人人| 国产美女视频一区| 一区二区三区四区亚洲| 日韩精品一区二区三区四区视频| 成人毛片老司机大片| 午夜精品一区二区三区电影天堂 | 欧美电影免费观看高清完整版 | 国产午夜精品一区二区三区嫩草| av不卡一区二区三区| 久久99精品网久久| 亚洲国产精品久久久久婷婷884| 久久久精品蜜桃| 91精品国产综合久久蜜臀| av中文字幕在线不卡| 久久精品国产**网站演员| 一二三四社区欧美黄| 欧美国产欧美综合| 欧美一级黄色片| 欧美三区免费完整视频在线观看| 丁香婷婷综合网| 久久精品噜噜噜成人av农村| 亚洲一区视频在线观看视频| 国产精品久久久久久久久免费樱桃| 欧美成人精品福利| 在线播放91灌醉迷j高跟美女| 99麻豆久久久国产精品免费| 国产精品一区久久久久| 麻豆免费看一区二区三区| 亚洲午夜精品17c| 亚洲精品日产精品乱码不卡| 国产精品久久久久久久裸模| 国产欧美一区二区在线| www精品美女久久久tv| 日韩视频免费观看高清完整版| 欧美亚洲日本国产| 在线一区二区观看| 色婷婷综合激情| 91在线码无精品| 95精品视频在线| 99麻豆久久久国产精品免费优播| 成人黄色在线网站| 大白屁股一区二区视频| 粉嫩嫩av羞羞动漫久久久| 国产精品自产自拍| 国产精品资源站在线| 粉嫩一区二区三区性色av| 风流少妇一区二区| 99精品久久99久久久久| 99精品欧美一区二区蜜桃免费| 97精品超碰一区二区三区| 96av麻豆蜜桃一区二区| 欧美性videosxxxxx| 欧美日韩久久久一区| 在线成人av影院| 精品日韩一区二区三区免费视频| 欧美一级免费观看| 精品久久一区二区三区| 国产日韩精品一区| 综合在线观看色| 亚洲夂夂婷婷色拍ww47| 免费亚洲电影在线| 国产露脸91国语对白| 91性感美女视频| 欧美日韩一级二级三级| 日韩精品一区二区三区四区| 久久综合九色欧美综合狠狠| 国产精品你懂的在线欣赏| 亚洲激情av在线| 男人的天堂久久精品| 国产成人综合网站| 日韩一区二区中文字幕| 久久久久国色av免费看影院| 亚洲图片欧美激情| 日韩国产高清在线| 国产精品一线二线三线| 在线精品国精品国产尤物884a| 5858s免费视频成人| 欧美国产一区视频在线观看| 一区二区三区四区av| 欧美aaa在线| 97久久超碰精品国产| 日韩欧美色综合| 最新国产成人在线观看| 日本午夜一区二区| 北条麻妃一区二区三区| 777xxx欧美| 18欧美乱大交hd1984| 久久精品噜噜噜成人88aⅴ| 91视频免费播放| 欧美zozo另类异族| 亚洲在线成人精品| 国产毛片一区二区| 欧美日韩免费电影| 国产精品第四页| 久久草av在线| 在线观看亚洲成人| 国产亚洲精久久久久久| 亚洲国产sm捆绑调教视频| 国产成人精品亚洲日本在线桃色 | 欧美一区二区视频在线观看2022 | 欧美猛男男办公室激情| 国产欧美一区二区精品仙草咪| 午夜国产精品一区| 99久久精品免费精品国产| 精品久久人人做人人爰| 午夜精品久久久久久久99樱桃| 波多野结衣中文字幕一区 | 精品污污网站免费看| 中文字幕av一区二区三区高| 免费观看在线综合色| 欧美日韩一级片在线观看| 中文字幕在线免费不卡| 国产麻豆精品久久一二三| 91精品国产麻豆国产自产在线 | 精品欧美乱码久久久久久| 亚洲一级电影视频| av资源网一区| 国产精品色哟哟| 国产馆精品极品| 久久久亚洲国产美女国产盗摄| 天使萌一区二区三区免费观看| 色一区在线观看| 中文字幕在线一区免费| 成人动漫视频在线| 国产女主播一区| 国产·精品毛片| 久久久久久日产精品| 国产一区二区三区日韩| 2021久久国产精品不只是精品| 免费观看一级欧美片| 91精品国产一区二区三区香蕉| 亚洲成av人片在线观看| 欧美年轻男男videosbes| 亚洲一区二区三区四区在线观看| 色婷婷av一区二区三区大白胸 | 日韩精品免费视频人成| 欧美系列亚洲系列| 亚洲午夜久久久久久久久电影网| 在线一区二区三区做爰视频网站| 亚洲精选一二三| 欧美日韩国产综合一区二区| 亚洲午夜久久久久中文字幕久| 欧美日韩国产经典色站一区二区三区| 一区二区三区日本| 欧美日韩国产美| 日韩精品一级中文字幕精品视频免费观看 | 久久色视频免费观看| 国产综合色精品一区二区三区| 国产午夜精品理论片a级大结局| 国产大陆精品国产| 国产精品久久影院| 色狠狠综合天天综合综合| 午夜影院久久久| 26uuu国产电影一区二区| 成人免费的视频| 一区二区三区欧美激情| 欧美乱妇15p| 精品一区二区三区的国产在线播放| xnxx国产精品| 97久久超碰国产精品| 午夜不卡在线视频| 2019国产精品| 色偷偷久久一区二区三区| 日韩高清在线电影| 国产女人18水真多18精品一级做| 日本韩国精品在线| 看电视剧不卡顿的网站| 国产精品国产自产拍高清av王其| 欧美这里有精品|