On Sun, Jan 15, 2006 at 12:50:38PM +0100, Willem de Bruijn ([EMAIL PROTECTED]) wrote: > > I wonder if can anybody can say what is the advantages/disadvantages > > of the linux networking kernel layer comapred to STREAMS network layer > > (of Solaris for examples). > > hi John, > > I'll take a stab at this question, since I'm working on a stream-like > framework in/op top of Linux anyway. First of all, though, to everyone else: > hi. I don't normally post here because I don't develop mainline kernel code, > instead I write code for a network project outside the kerneltree. If this > question doesn't belong on this list let me know, we can take it offline. > > First some background info: the original STREAMS by Dennis Ritchie stacks > processing elements in the kernel. More recent derivates are Click and > ScoutOS. You can find a Linux port of the last online, search for 'Scout in > the Linux Kernel', aka SILK. > > The major architectural difference between streamlike architectures and > functional architectures (like the Linux kernel) is that in the first paths > are transient while in the latter they're hardcoded (as functions). You can > setup a streams environment in general by calling > > create_processor("ip"), > create_processor("tcp"), > link_processors("ip", "tcp") > > In functional methods, on the other hand, you have to know the exact function > name to call at compile time, i.e.: > > int tcp(char * pkt, int plen){ > if (!ip(pkt, plen)) > return -1; > //[... process tcp stuff ..] > return 0; > }
Just for clarification. Linux networking code never calls such hardcoded methods. It always does following [very roughly]: sys_send() -> sock_sendmsg() -> sock->ops->sendmsg() [for example it can be pointer to inet_sendmsg() ], which in turn calls sk->sk_prot->sendmsg() which for example could be a pointer to tcp_sendmsg(). So you already have above create_processor... , it is transformed into inet_register_protosw(SOCK_STREAM, IPPROTO_TCP) and so on... Concider also dst_output()/dst_input() stackable technique which is widely used in Linux networking code which makes it so flexible. -- Evgeniy Polyakov - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html