INET Framework for OMNeT++/OMNEST
inet::INetworkSocket Class Referenceabstract

This class provides an interface that should be implemented by all network sockets. More...

#include <INetworkSocket.h>

Inheritance diagram for inet::INetworkSocket:
inet::ISocket inet::Ipv4Socket inet::Ipv6Socket inet::L3Socket

Classes

class  ICallback
 

Public Member Functions

virtual void setCallback (ICallback *callback)=0
 Sets a callback object, to be used with processMessage(). More...
 
virtual const ProtocolgetNetworkProtocol () 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
 

Detailed Description

This class provides an interface that should be implemented by all network sockets.

Member Function Documentation

◆ bind()

virtual void inet::INetworkSocket::bind ( const Protocol protocol,
L3Address  localAddress 
)
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().

◆ close()

virtual void inet::INetworkSocket::close ( )
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().

◆ connect()

virtual void inet::INetworkSocket::connect ( L3Address  remoteAddress)
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.

◆ getNetworkProtocol()

virtual const Protocol* inet::INetworkSocket::getNetworkProtocol ( ) const
pure virtual

Returns the associated network protocol used to deliver datagrams by this socket.

Implemented in inet::L3Socket, inet::Ipv4Socket, and inet::Ipv6Socket.

◆ sendTo()

virtual void inet::INetworkSocket::sendTo ( Packet packet,
L3Address  remoteAddress 
)
pure virtual

Sends a packet to the given remote address using the associated network protocol.

Implemented in inet::Ipv4Socket, inet::Ipv6Socket, and inet::L3Socket.

◆ setCallback()

virtual void inet::INetworkSocket::setCallback ( ICallback callback)
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().


The documentation for this class was generated from the following file: