1

I'm working on a software-defined networking project, and I want to put a data tag into the destinations options header in an IPv6 UDP packet. I've been stumbling around a bit, and I ended up looking into Twisted 14.0, which seems to have some of the pieces, but I'm not seeing how to put them together. (I'm new at Python, and a total newbie at Twisted, so sorry for the confusion.)

I see that there is a pair of functions "send1msg" and "recv1msg", which are supposed to be wrappers of "some" of the functionality of the C calls sendmsg() and recvmsg(). Reading the documents leaves me with three questions:

1) For sending, the format shows: num_bytes_sent = send1msg(filedescriptor, data, flags, ancillary). The ancillary data appears to be a tuple (cmsg_level, cmsg_type, data). That's clear, but what I don't see is how to identify that the ancillary data should be the destination options field-- that would normally be via setsockopt(), but I don't see how to do that in Twisted. Ancillary data could technically be in any field in the header.

2) Similarly for receiving: data, flags, ancillary = recv1msg(filedescriptor, size) How do I set the socket options to receive destinations options? For that matter, if I've got a DatagramProtocol protocol object, how do I even read off the filedescriptor from it? Can I say self.fileno()?

3) The code examples show AF_UNIX sockets only-- is this even supported for UDP?

0 Answers0