On Wed Oct 28 16:44:36 EDT 2009, ash_...@bk.ru wrote:
> Hi, folks.
> I'm trying to understand how system interact with network protocols, such as 
> tcp, udp and other.
> i'm look through sources in /sys/src/9/ip/ and saw follow:
>  - protocol header struct
>  - protocl init function
> and so on.
> But i'm grep in plan9.iso and don't find any files, when Tcp4hdr or tcpinit 
> used. How it could be 
> used?
> Where i can read about it or, better, where i can see at code, used such 
> functions.
> 
> Sorry for english and maybe foolish question.

excellent question.  you're running into a little magic
built into the kernel build scripts.  port/makedevc
is a script called from the kernel mkfile (these days,
usually pc/mkfile) that builds $kernelconfig.c.  this
file has an array called ipprotoinit.  if you specifiy
tcp in your kernel config, this array will contain a
reference to tcpinit.  here's the array from my kernel

        void (*ipprotoinit[])(Fs*) = {
                ilinit,
                tcpinit,
                udpinit,
                ipifcinit,
                icmpinit,
                icmp6init,
                nil,
        };

this array is referenced in ip/ipgetfs where tcpinit
would typically be called.

i hope that answers the question.  it is a bit confusing.

- erik

Reply via email to