Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!van-bc!robinson Newsgroups: comp.protocols.tcp-ip Subject: Re: TCP/IP Source Code Search Message-ID: <1990Nov8.172640.13894@mdivax1.uucp> Date: 8 Nov 90 17:26:40 GMT References: <9011052355.AA28967@yuba.WRS.COM> Reply-To: mdivax1!robinson (Jim Robinson) Organization: Mobile Data International, Richmond, B.C., Canada Lines: 31 Return-Path: Apparently-To: van-bc!rnews In article <9011052355.AA28967@yuba.WRS.COM> hwajin@yuba.UUCP (Hwa Jin Bae) writes: >>Many people use the Berkeley code as a start. It's an excellent >>protocol engine; its main drawback is that it really really wants to >>live inside a UNIX kernel. It often takes many man-months to port >>properly. You can find it on uunet.uu.net for anonymous FTP. > >berkeley code is actually pretty portable. it's really not that hard >to port berkeley code to non-unix environment. you need to write a set >of compatible routines -- spl*(), splx() can be emulated using semaphores, >timeout() can be emulated in most operating systems that support >watchdog timers of some sort, sleep() (kernel version) can be done >via a semaphore or mailbox, wakeup() the same way, perror() and panic() >are trivial, cluster mbuf can be emulated if you change the mbuf structure >slightly even on systems that lack virtual memory, etc. i'm speaking >from my experience... your mileage may vary. 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