Re: wanted: sosend() howto
Re: wanted: sosend() howto
- Subject: Re: wanted: sosend() howto
- From: "Justin C. Walker" <email@hidden>
- Date: Tue, 16 Sep 2003 09:45:33 -0700
On Tuesday, September 16, 2003, at 08:56 AM, Stefan Werner wrote:
Hi,
I want to send UDP packets from kernel space and am currently
struggling with the sosocket() call. It appears to be close to
undocumented and almost an hour of research on google did not turn up
much. I'd be very happy if I could get a simple code snippet that will
allow me to send a void* buffer (I haven't figured out how to use mbuf
yet) to a remote IP/Port. I found a little code in the nfs source
code, but I couldn't quite figure out where exactly the payload is and
what the other values mean.
I can understand your struggle. I don't find the 'sosocket()' call
anywhere in the xnu source base. Are you sure you have that right?
Some thoughts:
A) Using in-the-kernel calls like this is risky, in that there is no
guarantee that the semantics of the call will remain untouched as the
kernel evolves. This is just FYI.
B) Use the source, Luke. The 'xnu' project contains the code that both
implements and uses these calls, and you should be able to make use of
it to get the information you need by reading code. There is no
documentation, per se, for the kernel (cf. (A)). In particular, check
the "aurp" code in the "bsd/netat" directory. This code sets up a UDP
tunnel between the local system and a remote system to transmit
AppleTalk packets; it should have a lot in common with your efforts.
Note that the code is a bit encrusted with the dust of the ages; I
don't know that it has been run or tested since the Rhapsody days.
C) As a guide to the code, you should consider looking at
Wright/Stevens, "TCP/IP Illustrated, V.2", Addison-Wesley, 1995. It is
a very good "walk-through" of the code implementing the IP support in
earier BSD variants. A lot of nits are different, and Darwin has the
DLIL layer that is not mentioned in the book, but it will provide you
with enough information that the Darwin code should look familiar. The
'mbuf' structure and use is detailed in Ch. 2.
Regards,
Justin
--
/~\ The ASCII Justin C. Walker, Curmudgeon-at-Large
\ / Ribbon Campaign
X Help cure HTML Email
/ \
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.