Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Protocol modules and families


Protocol modules

Protocol modules are dynamic link libraries with a .PRT extension and a UID2 of KUidProtocolModule (0x1000004A). They export one function as ordinal 1. This function is called to create a single instance of a CProtocolFamilyBase derived object.

[Top]


Protocol families

Protocol families are used to group together various related protocols, such as TCP, UDP and IP. A CProtocolFamilyBase-derived object is created for each protocol module when the socket server is started. To achieve this, the socket server parses all .esk files in the System\Data directory, and firstly looks up the [sockman] sections. Then, for each protocol named there, the section of the same name is examined to find the filename of that protocol. The dynamic link library given by that file is loaded, and the function at ordinal 1 is called to create the protocol family.

After the protocol family has been created in this way, the socket server calls its ProtocolList() functions. The socket server caches the information gathered from calling ProtocolList() and unloads the protocol module when it is needed. Thus the socket server has an up-to-date list of all protocols which can be run, without the memory overhead of having them loaded at all times.

When a request comes in to create a socket of a particular type, the socket server re-loads the protocol module and calls first Install(), and then Open() and NewProtocolL() of the protocol family. The latter function instantiates the new protocol.

The protocol family object should allocate memory to hold an array of TServerProtocolDesc structures. This function should then fill them in and return the pointer and a count of the number of protocols supported.

The socket server caches this information, so that it does not need to keep the protocol module loaded.

The protocol family should not attempt to use static data (which it can’t) or to free this memory later as the socket server will automatically free this storage.