From: Alberto B. <alb...@gm...> - 2007-12-16 16:32:19
|
On Sat, Dec 15, 2007 at 04:13:23PM -0300, Alberto Bertogli wrote: > I also wrote a patch for the official socket module, which I will post > soon. Here's the patch for the Python's socket module. If it's ok with you, intend to send it to the python's development mailing list; so it'd be great if somebody with more TIPC experience than myself reviews it. The patch itself it's quite simple: it adds some TIPC constants at the end, and adds a way to convert a struct sockaddr_tipc into a Python tuple, and viceversa. The tuple is composed of four integer values: - TIPC_ADDR_NAME or TIPC_ADDR_NAMESEQ - A server type if TIPC_ADDR_NAME: - A port number - Ignored else: - Lower port number - Upper port number The scope is hardcoded to cluster; but if you think it's worth it, I can make it to be an optional fifth value. If this patch gets applied, it will be extremely hard to change the address representation in the future, so it'd be nice to get it right =) I selected a tuple because it is: - a simple, easy to construct data structure, - extensible if we need to add more fields in the future, - used as a way to express addresses for all the other network protocols. I know there are two more address types (TIPC_ADDR_MCAST and TIPC_ADDR_ID), but I have never used them, so I don't know the semantics well enough. .From the tipc examples I can assume TIPC_ADDR_MCAST uses nameseq and TIPC_ADDR_ID uses the id part of the sockaddr_tipc union. If you think it's worth it, I can add code to handle those too (they will fit into the 4-tuple described above). Thanks a lot, Alberto |