TCPIP协议源代码分论.pdf

  1. 1、本文档共1147页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
ahdlc.h 页 1 共 1 1 #ifndef _AHDLC_H 2 #define _AHDLC_H 3 #include global.h 4 #include mbuf.h 5 6 /* Asynch HDLC receiver control block */ 7 struct ahdlc { 8 int escaped; /* Escape char (0x7d) just seen */ 9 int hunt; /* Flushing input until next flag */ 10 struct mbuf *inframe; /* Current frame being reassembled */ 11 int maxsize; /* Maximum packet size */ 12 uint16 fcs; /* current CRC value */ 13 int32 rxframes; /* Valid frames received */ 14 int32 aborts; /* Aborts seen */ 15 int32 toobigs; /* Frames larger than maxsize */ 16 int32 crcerrs; /* Frames with CRC errors */ 17 int32 runts; /* Frames shorter than 2 bytes */ 18 }; 19 #define HDLC_ESC_ASYNC 0x7d /* Escapes special chars (0x7d, 0x7e) */ 20 #define HDLC_FLAG 0x7e /* Ends each frame */ 21 #define HDLC_ESC_COMPL 0x20 /* XORed with special chars in data */ 22 23 void init_hdlc(struct ahdlc *,int); 24 struct mbuf *ahdlcrx(struct ahdlc *,uint8); 25 struct mbuf *ahdlctx(struct mbuf *); 26 27 #endif /* _AHDLC_H */ 28 29 ahdlc.c 页 1 共 3 1 /* Asynchronous HDLC routines */ 2 #include global.h 3 #include ahdlc.h 4 #include crc.h 5 #include trace.h /******/ 6 7 static uint8 *putbyte(uint8 *,uint8); 8 9 void 10 init_hdlc(hp,maxsize) 11 struct ahdlc *hp; 12 int maxsize; 13 { 14 hp-escaped = 0; 15 hp-hunt = 0; 16 hp-inframe = NULL; 17 hp-maxsize = maxsize; 18 hp-fcs = FCS_START; 19 hp-rxframes = 0; 20 hp-aborts = 0; 21 hp-toobigs = 0; 22 hp-crcerrs = 0; 23 } 24 25 /* Process incoming data. Return completed packets, NULL otherwise */ 26 struct mbuf * 27 ahdlcrx(ap,c) 28 struct ahdlc *ap; /* HDLC

文档评论(0)

xina171127 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档