Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Protocols and binding

A protocol may be a complete stack in itself or it may require the services of other protocols (above and below it) to provide a full transport service. Generally these protocols will be from the same protocol family.

A protocol that is part of a multi-protocol stack (and is not at the lowest level) will be requested to bind to other protocols below it in the stack. An obvious corollary of this is that protocols that are not at the top of the stack will be bound to by other protocols below them in the stack.

All protocols are expected to accept data from above for transmission to lower level protocols (or the network media in the case of a network driver) and to accept data from below (or the network media) for transmission up the stack to higher level protocols.

A protocol that is providing socket services will be expected to create CSocketServiceProvider objects which accept data from the socket server (on behalf of a client request) for transmission down the stack.

When a protocol binds to another protocol, it provides an ID number. If the lower protocol provides any multiplexing functions (i.e. more than one protocol can bind to it) this ID number should be the number used to identify data sent to the binding protocol. The exact usage and significant size of this ID number is protocol-specific.

Note that this ID number is not the index in the .esk files—it is another number, invented and agreed upon by the protocols in question. It is only necessary if any demultiplexing of datagrams will take place.

If the socket server should pass an invalid ID to a protocol to bind to (one it has already used, for example), the function Bind() or BindTo() should leave. This usually happens when there is an error in the .esk file, so that a protocol is bound to twice by the same protocol, for example.

In a TCP/IP stack, both TCP and UDP need to bind to IP. In the IP header there is a byte which can hold a protocol ID. BindTo() would therefore be called on both TCP and UDP, with a parameter specifying IP. Each call to BindTo() would call Bind() in the lower protocol. So IP’s Bind() would get called twice — once from TCP, and once from UDP.