Erik Nordmark wrote:
Aaron Williams wrote:
I'm not sure if this is the correct place to ask, but I am trying to figure out how to port an old custom in-house streams-based IPC protocol stack to run on top of UDP instead of raw Ethernet or ATM. I have found a few hints here and there that it could be done, but no documentation or examples other than trying to decipher the t_kxxx/tli API calls in the kernel source code.

Basically I need to port our IPC stack to run over UDP because we need to switch to different hardware since Sun discontinued their ATM adapter and the new hardware APIs appear to be non-standard and are undocumented. While documentation to the raw APIs is undocumented, the new hardware does support running TCP/IP over ATM. By taking advantage of TCP/IP the IPC layer should be independent of any L2 transport as long as UDP is supported.

Specifically, how do I go about formatting the packets to go over UDP streams to emulate "sendto" and what format should I expect the received frames to be in? I also believe I will need to bind to a specific port.

I am pretty new to streams, having spent most of my development efforts in VxWorks and Linux, though I have been going through the Streams Programming Guide (which is quite good except for all the formatting errors).

If you just need a all the UDP packets for a particular UDP port, you can put that into a streams module which speaks the TPI message format (a T_UNITDATA_REQ to send, receiving a T_UNITDATA_IND etc), and then push this on a socket.

Then simplest thing might be to do the binding to the port number in user space. Thus somehing like
    s = socket(AF_INET, SOCK_DGRAM, 0);
    bind(s, ...)
    ioctl(s, I_PUSH, "yourmodule");

and from then on your module will receive T_UNITDATA_IND messages (where the address is a struct sockaddr_in) and can send using T_UNITDATA_REQ.

   Erik

Thank you. That sounds a lot easier than trying to do the bind in kernel space. I just was not sure I could do this or not. If I do this I assume that I should also be able to unbind from user space? Do I need to unplumb my module before unbinding, or can I still use socket requests on the socket after connecting our module?

I also have written some sample userspace streams code which I guess I could also use. Something like:

s = open("/dev/udp", O_RDWR);
strm_bind(s, &myaddr);
ioctl(s, I_PUSH, "mymodule");

where strm_bind does the appropriate putmsg with a T_BIND_REQ and getmsg gets the response. Though in this case, socket access looks even easier.

-Aaron
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to