免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1169 | 回复: 0
打印 上一主题 下一主题

关于uIP及其Data Struct [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-01-10 16:49 |只看该作者 |倒序浏览

uIP 文档:

文件:
uip-1.0-refman.pdf
大小:
1396KB
下载:
下载
     
1、The 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
2、ip_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];
3、a uIP TCP connection.
struct uip_tcp_conn
{  //fhy
u16_t ripaddr[2]; /**
u16_t lport; /**
u16_t rport; /**         //8
u8_t rcv_nxt[4]; /**
u8_t snd_nxt[4]; /**         //8
u16_t len; /**                //2
u16_t mss; /**
u16_t initialmss; /**
u8_t sa; /**
u8_t sv; /**
u16_t rto; /**
u8_t tcpstateflags; /**
u16_t timer; /**         
u8_t nrtx; /**
/** The application state. */
u8_t appstate[UIP_APPSTATE_SIZE];
};
4、appstate
__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];
};


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/15201/showart_1786770.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP