Message generation/parsing overhaul
As talked previously with Lipu and Niels,
The community class would get two new methods:
-
register_message()which receives more or less the same args as the Message classes we now put on the list returned by initiate_meta_messages() in addition to the message id number, which will build a message factory for this message type and register it into the community. -
reregister_message()(better name anybody?) which unregisters the previous message with the same name/message id number and registers the passed one as its replacement.The factory will have:
-
new()method which return a message instance, filled with everything that can be automatically guessed or doesn't change between messages in a specific community (IE global time)
The community gets a convert_packet() method to parse binary messages to objects.
The messages will now extend construct.Container and will have methods such as:
-
packetproperty that dynamicaly serializes the packet.
Feel free to edit this post to extend/rectify.
Some nice things Niels found related to its implementation:
http://blog.namis.me/2012/02/16/python-class-factory/
http://blog.namis.me/2012/02/15/python-caching-using-defaultdict/
@whirm how's this going btw? Do you have a branch in wherein we got the decoding to work?
I haven't been able to work on this at all :(