[ECOS] [eCos] Requesting guide to create/add new Protocol Family stack into Socket Layer Interface

Andrew Lunn andrew@lunn.ch
Sun Nov 23 10:38:00 GMT 2008


On Sun, Nov 23, 2008 at 01:00:47PM +0800, James wrote:
> Hi all,
> 
> I'm new to eCos/Linux and please bare with my novice questions.
> 
> I'm working on a new protocol stack for a device and wish to
> incorporate it into the Socket Layer API interface. This protocol
> stack is operates similarly to TCP/IP stack and must be running with
> the lifetime of the system. i.e., providing a common service to
> multiple applications at the same time.
> 
> A search on Google reveals that there are similar concept in Linux
> where the CAN protocol stack and Bluetooth protocol stack are
> incorporated into the standard Socket Layer Interface call so that
> programmers who are familiar with Socket Programming can utilize it
> easily. ie., can_hdr = socket(PF_CAN, ...) to create a application
> handler to access the CAN devices.
> 
> My questions are
> 
> 1) Is it possible to implement the same concept into eCos? So that I
> can just call the support socket interface calls for the application.

Sure. 

> 2) Where should I start to include the addition code to the relevant
> section of the eCos source files to support the new protocol stack? is
> it in /net/?? I've the necessary protocol libraries ready and need to
> know where the binding to the Socket API and device drivers are..

There is two ways to do this.

You are adding a new domain. Take a look at the code at the beginning
of net/bsd_tcpip/current/src/sys/netinet/in_proto.c. You can see how
IP is registered to the generic socket interface.

Or you can implemented a whole new protocol stack. The socket() call
in io/fileio/current/src/socket.cxx has a list of network stacks in
cyg_nstab. When you open a socket it will walk the list calling the
socket() function in each of these network stacks until one returns
success.

> 3) Is there any guide that can help me or describe the working of the
> eCos Socket API in details
> 

Not the internals. You just need to read the code. Once you get passed
the eCos wrapper into the FreeBSD stack there is documentation
available, eg the books by Stevens on the implementation of TCP/IP.

           Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list