Hey all. Here is the network API as it currently stands/I currently see it:
// Set up the packet, along with if you are encoding or decoding net_begin(enum_direction_enum, MESSAGE_TYPES); // Fill the packet net_uint32_t(uint32_t*); // Finalise the packet and send net_end(); The idea is that you pass a pointer to each of the functions, which if sending will be used for the data itself while if recv'ing will be used as the location to place the data. The advantage of this is that a single function is able to both encode and decode data. Using these primitives more complex functions that process structures can be developed. Currently most MESSAGE_TYPES have two functions, a send and recv one. I have no intention to change this, however I do plan to create a third function which deals with processing packets (sending or recving). The send and recv functions will then call this third tertiary function to deal with the packet. The potential disadvantages to this API are: - The use of globals for the packet and direction (will this ever be a problem?) - We end up adding more functions However the advantages are great, including: - Abstraction from platform specifics - Easy to update function definitions (one function does both send and recv) If everyone is happy with this then I will get to work on the primitives (probably in a new file such as netprimivites.{c|h}) and then submit them. Next I will work with whoever is willing to lend a hand to update the 1,000 or so source code changes which need to be made. Regards, Freddie. _______________________________________________ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev