Path: utzoo!attcan!ncrcan!scocan!larryp From: larryp@sco.COM (Larry Philps) Newsgroups: comp.protocols.tcp-ip Subject: Re: TCP/IP Source Code Search Message-ID: <1990Nov16.184809.18378@sco.com> Date: 16 Nov 90 18:48:09 GMT References: <9011052355.AA28967@yuba.WRS.COM> <1990Nov8.172640.13894@mdivax1.uucp> Sender: news@sco.com (News administration) Organization: SCO Canada, Inc. (formerly HCR Corporation) Lines: 42 In article <1990Nov8.172640.13894@mdivax1.uucp> mdivax1!robinson (Jim Robinson) writes: > >One possible problem is the use of non-int bit fields in the tcp and ip >header structures. Pre-ANSI C requires only that unsigned int bit fields be >supported by a compiler and ANSI C requires only (*I believe*) signed or >unsigned bit fields be supported. Thus, if your compiler does not support, >say, unsigned char bit fields, which are indeed used in the BSD code, you >will have to do a bit of work to work around this problem. If you are >unlucky, as I was, your compiler will *not* complain, but merely generate >incorrect code. > >You will also run into a number of annoying problems if the sizes of ints >and pointers on your target machine are greater than 32 bits, since there >are several coding practices employed that assume 32 bit pointers and ints. >-- >Jim Robinson >{uunet,ubc-cs}!van-bc!mdivax1!robinson Hi Jim! That was a *fun* project wasn't it! (The machine did not have a 16 bit data type, and could not do 16 bit arithmetic!) Originally the compiler only supported int bitfields (8 bytes on that machine), but the standard IP and TCP header structures are both 20 bytes. This is not divisble by 8. Since the machine enforced alignment, it was impossible to reference both the IP and TCP headers of a packet without moving things around. We eventually had to change the compiler to support short bitfields. The BSD code also used an incredibly *portable* method of moving 16 bit quantities around (ie. tcp options) via *(u_short *) cp = something. which unfortunately did not work too well with our 32 bit u_shorts. --- Larry Philps, SCO Canada, Inc (Formerly: HCR Corporation) Postman: 130 Bloor St. West, 10th floor, Toronto, Ontario. M5S 1N5 InterNet: larryp@sco.COM or larryp%scocan@uunet.uu.net UUCP: {uunet,utcsri,sco}!scocan!larryp Phone: (416) 922-1937 Fax: (416) 922-8397