Chinaunix首页 | 论坛 | 博客
  • 博客访问: 581954
  • 博文数量: 126
  • 博客积分: 4379
  • 博客等级: 上校
  • 技术积分: 2110
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-06 22:35
文章分类

全部博文(126)

文章存档

2012年(5)

2011年(3)

2010年(2)

2009年(116)

分类: LINUX

2009-01-10 16:49:31

uIP 文档:

文件: uip-1.0-refman.pdf
大小: 1396KB
下载: 下载
    

1The Ethernet header.

__packed struct uip_eth_hdr

{

struct uip_eth_addr dest;

struct uip_eth_addr src;

u16_t type;

};

__packed struct uip_eth_addr

{

u8_t addr[6];

};

#define UIP_ETHTYPE_ARP 0x0806

#define UIP_ETHTYPE_IP  0x0800

#define UIP_ETHTYPE_IP6 0x86dd

2ip_header 

__packed struct ethip_hdr

{

     struct uip_eth_hdr ethhdr;

     /* IP header. */

     u8_t vhl,                   //10

         tos,

         len[2],

         ipid[2],

         ipoffset[2],

         ttl,

         proto;

     u16_t ipchksum;             //2

     u16_t srcipaddr[2],         //8

          destipaddr[2];

};

 

 

/* TCP header. */

u16_t srcport,

destport;

u8_t seqno[4],

ackno[4],

tcpoffset,

flags,

wnd[2];

u16_t tcpchksum;

u8_t urgp[2];

u8_t optdata[4];

3a uIP TCP connection.

struct uip_tcp_conn

{  //fhy

u16_t ripaddr[2]; /**< The IP address of the remote host. */

u16_t lport; /**< The local TCP port, in network byte order. */

u16_t rport; /**< The local remote TCP port, in network byte order. */         //8

u8_t rcv_nxt[4]; /**< The sequence number that we expect to receive next. */

u8_t snd_nxt[4]; /**< The sequence number that was last sent by us. */         //8

u16_t len; /**< Length of the data that was previously sent. */                //2

u16_t mss; /**< Current maximum segment size for the connection. */

u16_t initialmss; /**< Initial maximum segment size for the connection. */

u8_t sa; /**< Retransmission time-out calculation state variable. */

u8_t sv; /**< Retransmission time-out calculation state variable. */

u16_t rto; /**< Retransmission time-out. */

u8_t tcpstateflags; /**< TCP state and flags. */

u16_t timer; /**< The retransmission timer. */        

u8_t nrtx; /**< The number of retransmissions for the last segment sent. */

/** The application state. */

u8_t appstate[UIP_APPSTATE_SIZE];

};

4appstate

__packed struct netreader_state

{

     DWORD dwCmdParaLen;    //要接收数据的总长度

     DWORD dwRecvPos;       //已经接收到的长度

     DWORD dwSndLen;

     enum statemachine  state;

};

 

uip_appdata = ( volatile u8_t*) (uip_buf + 40 + UIP_LLH_LEN);    //???

 

__packed struct arp_hdr {

     struct uip_eth_hdr ethhdr;

     u16_t hwtype;

     u16_t protocol;

     u8_t hwlen;

     u8_t protolen;

     u16_t opcode;

     struct uip_eth_addr shwaddr;

     u16_t sipaddr[2];

     struct uip_eth_addr dhwaddr;

     u16_t dipaddr[2];

};

阅读(1517) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~