[ANet-devel] TCPIP library requirements
Status: Abandoned
Brought to you by:
benad
From: Benoit N. <be...@ma...> - 2001-05-10 00:28:47
|
Here's a quick list of the requirements for the TCP/IP lib, so we can start right now. Basically, the core of the deamon should remain single-threaded, to ensure maximum portability. But all I/O (or as much as possible) should be asynchronous, with callback functions. For Mac OS, we may have to use co-operative multitasking, so it might require OS-specific "yield" calls. Remember: this is a draft. As long as the lib supports the functionnality here, everything's OK. Also, the connection libs can also be (later) for HTTP, UDP, or anything else you can think of. I'll take care about managing the different connection libs (hopefully, dynamic libs) later. So, here's what we need for the connection library (the first one to implement is TCP/IP, of course): - UInt32 NewConnection(UInt8 *address, UInt32 connectionID) Makes a new conenction. It is up to the library to make and remember the "mapping" between connectionID and the address (or socket). The format of the address is specific to the lib, and it's up to the lib to resolve domain names. - UInt32 Send(UInt32 connectionID, UInt8 buffer, UInt32 bufferLength, UInt32 (*callBackFunction)(UInt32 connectionID)) Asynchronously sends data through the connection. - UInt32 Receive(UInt32 connectionID, UInt8 buffer, UInt32 bufferLength) Flushes the current input buffer into another buffer. It's up to the connection to maintain input buffers for each connection. DO NOT clear the input buffer if an error or disconnection occurs. - UInt32 GetTransferRate(UInt32 connectionID, double *inRate, double *outRate) Gets the transfer rate of the connection. Required for the bandwidth manager. For now, do not care about the protocol overhead (here, the overhead for TCP/IP). - UInt32 GetAddress(UInt32 connectionID, UInt8 buffer, UInt32 bufferLength) Gets the address, as given in NewConnection. I think it's enough for now. The lib can (actually, should) create its own buffers, and there's currently no limit. I'll start thinking about memory management later. - Benad |