class CProtocolBaseUnbind : public CProtocolBase |
CProtocolBase sub-class that adds a required function to unbind a protocol.
This class exists only because the CProtocolBase is missing an essential method: Unbind. All protocols that implement BindL, should also support Unbind!
It is assumed that all protocols and hooks, which connect to TCPIP stack, must support this method. Strictly, supporting Unbind is really needed only if the protocol makes use of BindL (e.g. the protocol is bound to other protocols).
Public Member Functions | |
---|---|
void | Unbind ( CProtocolBase *, TUint ) |
void | Unbind | ( | CProtocolBase * | aProtocol, |
TUint | aId = 0 | |||
) | [pure virtual] |
Unbinds from a specified protocol.
Unbind is a reverse of the BindL() . Unbind does nothing if there is no matching bind. It is safe to call Unbind "just to be sure". The rationale for Unbind is explained using the UDP protocol as an example.
When UDP protocol is active, it needs to receive IP packets with protocol=17 from the IP layer. To achieve this, the UDP will call IP protocol instance with BindL(UDP, 17). This registers UDP instance as a receiver of the UDP packets. IP records the UDP instance pointer and uses UDP-> Process() method to pass received packets to the UDP protocol instance.
Before UDP protocol instance is destroyed, the UDP registration in IP layer must be cancelled. Otherwise the IP layer would be using a dangling pointer after UDP destruction. The registration is cancelled by use of Unbind.
The similar reasoning applies to any hook that registers with the IP layer with BindL.
CProtocolBase * aProtocol | Protocol instance being unregistered. |
TUint aId = 0 | Identify the binding that is to be unregistered. The exact interpretation of this depends on protocol implementation, but generally, the aId value used in BindL can be used to unregister that specific binding. In addition to that, the TCPIP IP layer supports generic unbind: if aId is ZERO, then all bindings made by aProtocol are canceled and cleared. |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.