|
INET Framework for OMNeT++/OMNEST
|
This class provides an interface that should be implemented by all network sockets. More...
#include <INetworkSocket.h>
Classes | |
| class | ICallback |
Public Member Functions | |
| virtual void | setCallback (ICallback *callback)=0 |
| Sets a callback object, to be used with processMessage(). More... | |
| virtual const Protocol * | getNetworkProtocol () const =0 |
| Returns the associated network protocol used to deliver datagrams by this socket. More... | |
| virtual void | bind (const Protocol *protocol, L3Address localAddress)=0 |
| Binds this socket to the given protocol and local address. More... | |
| virtual void | connect (L3Address remoteAddress)=0 |
| Connects to a remote socket. More... | |
| virtual void | sendTo (Packet *packet, L3Address remoteAddress)=0 |
| Sends a packet to the given remote address using the associated network protocol. More... | |
| virtual void | close ()=0 |
| Closes this socket releasing all resources. More... | |
Public Member Functions inherited from inet::ISocket | |
| virtual | ~ISocket () |
| virtual int | getSocketId () const =0 |
| Returns the socket Id which is unique within the network node. More... | |
| virtual bool | belongsToSocket (cMessage *msg) const =0 |
| Returns true if the message belongs to this socket. More... | |
| virtual void | processMessage (cMessage *msg)=0 |
| Examines the message, takes ownership, and updates socket state. More... | |
| virtual void | send (Packet *packet)=0 |
| virtual void | destroy ()=0 |
| Notify the protocol that the owner of ISocket has destroyed the socket. More... | |
| virtual bool | isOpen () const =0 |
This class provides an interface that should be implemented by all network sockets.
|
pure virtual |
Binds this socket to the given protocol and local address.
All incoming packets matching the given parameters will be delivered via the callback interface.
Implemented in inet::Ipv4Socket, inet::Ipv6Socket, and inet::L3Socket.
Referenced by inet::PingApp::handleSelfMessage().
|
pure virtual |
Closes this socket releasing all resources.
Once closed, a closed socket may be bound to another (or the same) protocol, and reused.
Implements inet::ISocket.
Implemented in inet::L3Socket, inet::Ipv4Socket, and inet::Ipv6Socket.
Referenced by inet::PingApp::handleStopOperation().
|
pure virtual |
Connects to a remote socket.
The socket will only receive packets from the specified address, and you can use send() as opposed to sendTo() to send packets.
Implemented in inet::Ipv4Socket, inet::Ipv6Socket, and inet::L3Socket.
|
pure virtual |
Returns the associated network protocol used to deliver datagrams by this socket.
Implemented in inet::L3Socket, inet::Ipv4Socket, and inet::Ipv6Socket.
Sends a packet to the given remote address using the associated network protocol.
Implemented in inet::Ipv4Socket, inet::Ipv6Socket, and inet::L3Socket.
|
pure virtual |
Sets a callback object, to be used with processMessage().
This callback object may be your simple module itself (if it multiply inherits from ICallback too, that is you declared it as
class MyAppModule : public cSimpleModule, public ICallback
and redefined the necessary virtual functions; or you may use dedicated class (and objects) for this purpose.
Sockets don't delete the callback object in the destructor or on any other occasion.
Implemented in inet::L3Socket, inet::Ipv4Socket, and inet::Ipv6Socket.
Referenced by inet::PingApp::handleSelfMessage().