Documentation on writing a custom socket

Robert Watson rwatson at
Sat Mar 8 17:19:42 UTC 2008

On Sat, 8 Mar 2008, Hans Petter Selasky wrote:

> I'm planning to create a new socket type in FreeBSD called AF_Q921, which is 
> to be used for ISDN telephony. Where do I find documentation on how to 
> implement a new socket in the kernel ?

I'd start with a copy of the Design and Implementation of FreeBSD, which 
contains a structural overview of how the protocol parts fit together.  The 
Stevens TCP/IP implementation book is extremely out-of-date, but useful 
reading nontheless.

The first thing to think about, BTW, is whether or not a new protocol is in 
fact what you want to do.  Protocol families bring a lot of useful 
infrastructure to the table: an IPC model, a routing infrastructure, 
abstractions for "interfaces", etc.  However, they may or may not be what 
you're looking for -- before going down this path I'd want to think very 
carefully about whether the requirements you have are best met in this way, or 
possibly better met by creating a new device abstraction that isn't connected 
to the protocol stack, or by using a device stack tied to Netgraph nodes. 
Could you tell us a bit more about what you're trying to do, and perhaps we 
can provide some useful pointers?  For example, do you anticipate using or 
even needing the routing facilities, and how might you map ISDN telephony 
parts into the normal network stack infrastructure of addresses, routing, 
interfaces, etc?

Robert N M Watson
Computer Laboratory
University of Cambridge

More information about the freebsd-hackers mailing list