Received data context.
Receipt of a packet consists of a series of functions which typically analyse header information, then pass the remaining contents - or part of them on to a sub-function at the next layer up the protocol stack. Certain information e.g. source address, is relevant higher up the layers and therefore usually gets passed from function to function as an argument and there is a tendency to pass ever more function arguments into subsequent handlers to provide context for those higher layers.
Rather than do this, we can accumulate context information on the data block being processed in a context structure. At each layer, the information in this structure is only valid for information coming up from the layers below, only whilst nested processing is taking place, and only for items not modified by layers above. - it is not safe to save pointers to this structure and try and dereference them later!
There is currently just one global instance of this structure so it is not thread safe. However, if implementing a multi-threaded version (e.g. one thread per socket) it would be easy enough to have one structure per thread and passing just one pointer to this structure from function to function will still be more efficient.
The down side of this strategy is the necessity to include headers and provide access to data from widely separated layers which provides opportunities for sloppy and careless programming which must be avoided.