INET Framework for OMNeT++/OMNEST
inet::SctpSocket Class Reference

#include <SctpSocket.h>

Inheritance diagram for inet::SctpSocket:
inet::ISocket

Classes

class  ICallback
 Abstract base class for your callback objects. More...
 

Public Types

enum  State {
  NOT_BOUND, CLOSED, LISTENING, CONNECTING,
  CONNECTED, PEER_CLOSED, LOCALLY_CLOSED, SOCKERROR
}
 

Public Member Functions

 SctpSocket (bool type=true)
 Constructor. More...
 
 SctpSocket (cMessage *msg)
 Constructor, to be used with forked sockets (see listen()). More...
 
 ~SctpSocket ()
 Destructor. More...
 
void * getUserData () const
 
void setUserData (void *userData)
 
int getSocketId () const override
 Returns the internal connection Id. More...
 
int getState () const
 Returns the socket state, one of NOT_BOUND, CLOSED, LISTENING, CONNECTING, CONNECTED, etc. More...
 
Getter functions
AddressVector getLocalAddresses () const
 
int getLocalPort () const
 
AddressVector getRemoteAddresses () const
 
int getRemotePort () const
 
L3Address getRemoteAddr () const
 
Opening and closing connections, sending data
void setOutputGate (cGate *toSctp)
 Sets the gate on which to send to SCTP. More...
 
void setOutboundStreams (int streams)
 Setter and getter methods for socket and API Parameters. More...
 
void setInboundStreams (int streams)
 
void setAppLimited (bool option)
 
void setStreamReset (int option)
 
void setStreamPriority (uint32_t stream, uint32_t priority)
 
void setMaxInitRetrans (int option)
 
void setMaxInitRetransTimeout (int option)
 
void setRtoInitial (double option)
 
void setRtoMin (double option)
 
void setRtoMax (double option)
 
void setSackFrequency (int option)
 
void setSackPeriod (double option)
 
void setMaxBurst (int option)
 
void setFragPoint (int option)
 
void setNagle (int option)
 
void setPathMaxRetrans (int option)
 
void setEnableHeartbeats (bool option)
 
void setHbInterval (double option)
 
void setRtoInfo (double initial, double max, double min)
 
void setAssocMaxRtx (int option)
 
void setUserOptions (SocketOptions *msg)
 
int getOutboundStreams ()
 
int getInboundStreams ()
 
bool getStreamReset ()
 
int getLastStream ()
 
double getRtoInitial ()
 
int getMaxInitRetransTimeout ()
 
int getMaxInitRetrans ()
 
int getMaxBurst ()
 
int getFragPoint ()
 
int getAssocMaxRtx ()
 
void getSocketOptions ()
 
void bind (int localPort)
 Bind the socket to a local port number. More...
 
void bind (L3Address localAddr, int localPort)
 Bind the socket to a local port number and IP address (useful with multi-homing). More...
 
void bindx (AddressVector localAddr, int localPort)
 
void addAddress (L3Address addr)
 
void listen (bool fork=true, bool streamReset=false, uint32_t requests=0, uint32_t messagesToPush=0)
 Initiates passive OPEN. More...
 
void listen (uint32_t requests=0, bool fork=false, uint32_t messagesToPush=0, bool options=false, int32_t fd=-1)
 
void accept (int socketId)
 
void connect (L3Address remoteAddress, int32_t remotePort, bool streamReset=false, int32_t prMethod=0, uint32_t numRequests=0)
 Active OPEN to the given remote socket. More...
 
void connect (int32_t fd, L3Address remoteAddress, int32_t remotePort, uint32_t numRequests, bool options=false)
 
void connectx (AddressVector remoteAddresses, int32_t remotePort, bool streamReset=false, int32_t prMethod=0, uint32_t numRequests=0)
 Active OPEN to the given remote socket. More...
 
void accept (int32_t assocId, int32_t fd)
 
void acceptSocket (int newSockId)
 
virtual void send (Packet *packet) override
 Send data message. More...
 
void sendNotification (cMessage *msg)
 Send notification. More...
 
void sendRequest (cMessage *msg)
 Send request. More...
 
void close (int id)
 Closes the local end of the connection. More...
 
virtual void close () override
 Close the socket. More...
 
void abort ()
 Aborts the association. More...
 
void shutdown (int id=-1)
 
void requestStatus ()
 Causes SCTP to reply with a fresh SctpStatusInfo, attached to a dummy message as controlInfo(). More...
 
Handling of messages arriving from SCTP
virtual bool belongsToSocket (cMessage *msg) const override
 Returns true if the message belongs to this socket instance (message has a SctpCommand as controlInfo(), and the assocId in it matches that of the socket.) More...
 
void setCallback (ICallback *cb)
 Sets a callback object, to be used with processMessage(). More...
 
void processMessage (cMessage *msg) override
 Examines the message (which should have arrived from SctpMain), updates socket state, and if there is a callback object installed (see setCallback(), class CallbackInterface), dispatches to the appropriate method. More...
 
void setState (int state)
 
void setTunInterface (int id)
 
int getTunInterface ()
 
virtual void destroy () override
 Notify the protocol that the owner of ISocket has destroyed the socket. More...
 
virtual bool isOpen () const override
 
- Public Member Functions inherited from inet::ISocket
virtual ~ISocket ()
 

Static Public Member Functions

static int32_t getNewAssocId ()
 Generates a new integer, to be used as assocId. More...
 
static const char * stateName (int state)
 Returns name of socket state code returned by state(). More...
 

Public Attributes

cGate * gateToSctp
 
int interfaceIdToTun = -1
 

Protected Member Functions

void sendToSctp (cMessage *msg)
 

Protected Attributes

int assocId
 
int sockstate
 
bool oneToOne
 
bool appLimited
 
L3Address localAddr
 
AddressVector localAddresses
 
int localPrt
 
L3Address remoteAddr
 
AddressVector remoteAddresses
 
int remotePrt
 
int fsmStatus
 
int lastStream
 
SocketOptionssOptions
 
AppSocketOptionsappOptions
 
ICallbackcb
 
void * userData
 

Static Protected Attributes

static int32_t nextAssocId = 0
 

Member Enumeration Documentation

◆ State

Enumerator
NOT_BOUND 
CLOSED 
LISTENING 
CONNECTING 
CONNECTED 
PEER_CLOSED 
LOCALLY_CLOSED 
SOCKERROR 

Constructor & Destructor Documentation

◆ SctpSocket() [1/2]

inet::SctpSocket::SctpSocket ( bool  type = true)

Constructor.

The connectionId() method returns a valid Id right after constructor call.

22 {
24  localPrt = remotePrt = 0;
25  fsmStatus = -1;
26  cb = nullptr;
27  userData = nullptr;
28  gateToSctp = nullptr;
29  lastStream = -1;
30  oneToOne = type;
31  sOptions = new SocketOptions();
32  appOptions = new AppSocketOptions();
36  appLimited = false;
37 // if (oneToOne)
39  /* else
40  assocId = 0;*/
41  EV_INFO << "sockstate=" << stateName(sockstate) << " assocId=" << assocId << "\n";
42 }

◆ SctpSocket() [2/2]

inet::SctpSocket::SctpSocket ( cMessage *  msg)

Constructor, to be used with forked sockets (see listen()).

The assocId will be picked up from the message: it should have arrived from SctpMain and contain SctpCommmand control info.

45 {
46  auto& tags = check_and_cast<ITaggedObject *>(msg)->getTags();
47  if (tags.getNumTags() == 0)
48  throw cRuntimeError("SctpSocket::SctpSocket(cMessage *): no SctpCommandReq in message (not from SCTP?)");
49 
50  assocId = tags.getTag<SocketInd>()->getSocketId();
52 
53  localPrt = remotePrt = -1;
54  sOptions = new SocketOptions();
55  appOptions = new AppSocketOptions();
58  appLimited = false;
59  cb = nullptr;
60  userData = nullptr;
61  gateToSctp = nullptr;
62  lastStream = -1;
63  oneToOne = true;
64 
65  if (msg->getKind() == SCTP_I_AVAILABLE) {
66  const auto& connectInfo = tags.findTag<SctpAvailableReq>();
67  assocId = connectInfo->getNewSocketId();
68  localAddr = connectInfo->getLocalAddr();
69  remoteAddr = connectInfo->getRemoteAddr();
70  localPrt = connectInfo->getLocalPort();
71  remotePrt = connectInfo->getRemotePort();
72  }
73  else if (msg->getKind() == SCTP_I_ESTABLISHED) {
74  // management of stockstate is left to processMessage() so we always
75  // set it to CONNECTED in the ctor, whatever SCTP_I_xxx arrives.
76  // However, for convenience we extract SctpConnectInfo already here, so that
77  // remote address/port can be read already after the ctor call.
78 
79  const auto& connectInfo = tags.findTag<SctpConnectReq>();
80  localAddr = connectInfo->getLocalAddr();
81  remoteAddr = connectInfo->getRemoteAddr();
82  localPrt = connectInfo->getLocalPort();
83  remotePrt = connectInfo->getRemotePort();
84  fsmStatus = connectInfo->getStatus();
85  appOptions->inboundStreams = connectInfo->getInboundStreams();
86  appOptions->outboundStreams = connectInfo->getOutboundStreams();
87  }
88 }

◆ ~SctpSocket()

inet::SctpSocket::~SctpSocket ( )

Destructor.

91 {
92  delete sOptions;
93  delete appOptions;
94  if (cb) {
95  cb->socketDeleted(this);
96  }
97 }

Member Function Documentation

◆ abort()

void inet::SctpSocket::abort ( )

Aborts the association.

432 {
433  if (sockstate != NOT_BOUND && sockstate != CLOSED && sockstate != SOCKERROR) {
434  Request *msg = new Request("ABORT", SCTP_C_ABORT);
435  auto cmd = msg->addTag<SctpCommandReq>();
436  cmd->setSocketId(assocId);
437  sendToSctp(msg);
438  }
439  sockstate = CLOSED;
440 }

Referenced by inet::SctpClient::handleTimer(), and inet::NetPerfMeter::successfullyEstablishedConnection().

◆ accept() [1/2]

void inet::SctpSocket::accept ( int  socketId)

◆ accept() [2/2]

void inet::SctpSocket::accept ( int32_t  assocId,
int32_t  fd 
)
328 {
329  Request *cmsg = new Request("Accept", SCTP_C_ACCEPT);
330  auto cmd = cmsg->addTag<SctpCommandReq>();
331  cmd->setLocalPort(localPrt);
332  cmd->setRemoteAddr(remoteAddr);
333  cmd->setRemotePort(remotePrt);
334  cmd->setSocketId(assId);
335  cmd->setFd(fd);
336  sendToSctp(cmsg);
337 }

◆ acceptSocket()

void inet::SctpSocket::acceptSocket ( int  newSockId)
340 {
341  Request *cmsg = new Request("SCTP_C_ACCEPT_SOCKET_ID", SCTP_C_ACCEPT_SOCKET_ID);
342  cmsg->addTag<SctpAvailableReq>()->setSocketId(newSockId);
343  cmsg->addTag<DispatchProtocolReq>()->setProtocol(&Protocol::sctp);
344  cmsg->addTag<SocketReq>()->setSocketId(newSockId);
345  check_and_cast<cSimpleModule *>(gateToSctp->getOwnerModule())->send(cmsg, gateToSctp);
346 }

Referenced by processMessage().

◆ addAddress()

void inet::SctpSocket::addAddress ( L3Address  addr)
166 {
167  EV_INFO << "add address " << addr << "\n";
168  localAddresses.push_back(addr);
169 }

◆ belongsToSocket()

bool inet::SctpSocket::belongsToSocket ( cMessage *  msg) const
overridevirtual

Returns true if the message belongs to this socket instance (message has a SctpCommand as controlInfo(), and the assocId in it matches that of the socket.)

Implements inet::ISocket.

451 {
452  bool ret = (check_and_cast<Indication *>(msg)->getTag<SocketInd>()->getSocketId() == assocId);
453  return ret;
454 }

◆ bind() [1/2]

void inet::SctpSocket::bind ( int  localPort)

Bind the socket to a local port number.

143 {
144  if (sockstate != NOT_BOUND)
145  throw cRuntimeError("SctpSocket::bind(): socket already bound");
146 
147  localAddresses.push_back(L3Address()); // Unspecified address
148  localPrt = lPort;
149  sockstate = CLOSED;
151 }

Referenced by connect(), inet::NetPerfMeter::createAndBindSocket(), inet::SctpClient::initialize(), inet::SctpServer::initialize(), and inet::SctpPeer::initialize().

◆ bind() [2/2]

void inet::SctpSocket::bind ( L3Address  localAddr,
int  localPort 
)

Bind the socket to a local port number and IP address (useful with multi-homing).

154 {
155  EV_INFO << "bind address " << lAddr << "\n";
156  if (sockstate != NOT_BOUND)
157  throw cRuntimeError("SctpSocket::bind(): socket already bound");
158 
159  localAddresses.push_back(lAddr);
160  localPrt = lPort;
161  sockstate = CLOSED;
163 }

◆ bindx()

void inet::SctpSocket::bindx ( AddressVector  localAddr,
int  localPort 
)
172 {
173  L3Address lAddr;
174  for (auto& lAddresse : lAddresses) {
175  EV << "bindx: bind address " << (lAddresse) << "\n";
176  localAddresses.push_back((lAddresse));
177  }
178  localPrt = lPort;
179  sockstate = CLOSED;
181 }

Referenced by inet::SctpClient::initialize(), inet::SctpServer::initialize(), and inet::SctpPeer::initialize().

◆ close() [1/2]

virtual void inet::SctpSocket::close ( )
inlineoverridevirtual

Close the socket.

Implements inet::ISocket.

290 { close(-1); }

Referenced by close().

◆ close() [2/2]

void inet::SctpSocket::close ( int  id)

Closes the local end of the connection.

With SCTP, a CLOSE operation means "I have no more data to send", and thus results in a one-way connection until the remote SCTP closes too (or the FIN_WAIT_1 timeout expires)

395 {
396  EV_INFO << "SctpSocket::close()\n";
397 
398  Request *msg = new Request("CLOSE", SCTP_C_CLOSE);
399  auto cmd = msg->addTag<SctpCommandReq>();
400  if (id == -1)
401  cmd->setSocketId(assocId);
402  else
403  cmd->setFd(id);
404  sendToSctp(msg);
406 }

Referenced by inet::SctpClient::close(), inet::SctpClient::handleTimer(), inet::NetPerfMeter::handleTimer(), inet::SctpPeer::socketDataArrived(), inet::SctpPeer::socketPeerClosed(), and inet::NetPerfMeter::teardownConnection().

◆ connect() [1/2]

void inet::SctpSocket::connect ( int32_t  fd,
L3Address  remoteAddress,
int32_t  remotePort,
uint32_t  numRequests,
bool  options = false 
)
285 {
286  EV_INFO << "Socket connect. Assoc=" << assocId << ", sockstate=" << stateName(sockstate) << "\n";
287 
288  if (oneToOne && sockstate == NOT_BOUND)
289  bind(0);
290 
291  if (oneToOne && sockstate != CLOSED)
292  throw cRuntimeError("SctpSocket::connect(): connect() or listen() already called");
293 
294  if (!oneToOne && sockstate != LISTENING)
295  throw cRuntimeError("SctpSocket::connect(): one-to-many style socket must be listening");
296 
297  remoteAddr = remoteAddress;
298  remotePrt = remotePort;
299 
300  Request *cmsg = new Request("Associate", SCTP_C_ASSOCIATE);
301  auto openCmd = cmsg->addTag<SctpOpenReq>();
302  if (oneToOne)
303  openCmd->setSocketId(assocId);
304  else
305  openCmd->setSocketId(getNewAssocId());
306  EV_INFO << "Socket connect. Assoc=" << openCmd->getSocketId() << ", sockstate=" << stateName(sockstate) << "\n";
307  openCmd->setLocalAddresses(localAddresses);
308  openCmd->setLocalPort(localPrt);
309  openCmd->setRemoteAddr(remoteAddr);
310  openCmd->setRemotePort(remotePrt);
311  openCmd->setOutboundStreams(appOptions->outboundStreams);
312  openCmd->setInboundStreams(appOptions->inboundStreams);
313  openCmd->setStreamReset(appOptions->streamReset);
314  openCmd->setNumRequests(numRequests);
315  openCmd->setFd(fd);
316  openCmd->setAppLimited(appLimited);
317 
318  if (options) {
319  cmsg->setContextPointer((void *)sOptions);
320  }
321  sendToSctp(cmsg);
322 
323  if (oneToOne)
325 }

◆ connect() [2/2]

void inet::SctpSocket::connect ( L3Address  remoteAddress,
int32_t  remotePort,
bool  streamReset = false,
int32_t  prMethod = 0,
uint32_t  numRequests = 0 
)

Active OPEN to the given remote socket.

242 {
243  EV_INFO << "Socket connect. Assoc=" << assocId << ", sockstate=" << stateName(sockstate) << "\n";
244 
245  if (oneToOne && sockstate == NOT_BOUND) {
246  EV_INFO << "Connect: call bind first\n";
247  bind(0);
248  }
249 
250  if (oneToOne && sockstate != CLOSED)
251  throw cRuntimeError("SctpSocket::connect(): connect() or listen() already called");
252 
253  if (!oneToOne && sockstate != LISTENING)
254  throw cRuntimeError("SctpSocket::connect(): one-to-many style socket must be listening");
255 
256  remoteAddr = remoteAddress;
257  remotePrt = remotePort;
258 
259  Request *cmsg = new Request("Associate", SCTP_C_ASSOCIATE);
260  auto openCmd = cmsg->addTag<SctpOpenReq>();
261 
262  if (oneToOne)
263  openCmd->setSocketId(assocId);
264  else
265  openCmd->setSocketId(getNewAssocId());
266  EV_INFO << "Socket connect. Assoc=" << openCmd->getSocketId() << ", sockstate=" << stateName(sockstate) << "\n";
267  openCmd->setLocalAddresses(localAddresses);
268  openCmd->setLocalPort(localPrt);
269  openCmd->setRemoteAddr(remoteAddr);
270  openCmd->setRemotePort(remotePrt);
271  openCmd->setOutboundStreams(appOptions->outboundStreams);
272  openCmd->setInboundStreams(appOptions->inboundStreams);
273  appOptions->streamReset = streamReset;
274  openCmd->setNumRequests(numRequests);
275  openCmd->setPrMethod(prMethod);
276  openCmd->setStreamReset(streamReset);
277 
278  sendToSctp(cmsg);
279 
280  if (oneToOne)
282 }

Referenced by inet::SctpClient::connect(), inet::SctpPeer::connect(), and connectx().

◆ connectx()

void inet::SctpSocket::connectx ( AddressVector  remoteAddresses,
int32_t  remotePort,
bool  streamReset = false,
int32_t  prMethod = 0,
uint32_t  numRequests = 0 
)

Active OPEN to the given remote socket.

The current implementation just calls connect() with the first address of the given list. This behaviour may be improved in the future.

349 {
350  EV_INFO << "Socket connectx. sockstate=" << stateName(sockstate) << "\n";
351  remoteAddresses = remoteAddressList;
352  connect(remoteAddressList.front(), remotePort, streamReset, prMethod, numRequests);
353 }

Referenced by inet::NetPerfMeter::establishConnection().

◆ destroy()

void inet::SctpSocket::destroy ( )
overridevirtual

Notify the protocol that the owner of ISocket has destroyed the socket.

Typically used when the owner of ISocket has crashed.

Implements inet::ISocket.

422 {
423  EV << "SctpSocket::destroy()\n";
424 
425  Request *msg = new Request("DESTROY", SCTP_C_DESTROY);
426  auto cmd = msg->addTag<SctpCommandReq>();
427  cmd->setSocketId(assocId);
428  sendToSctp(msg);
429 }

◆ getAssocMaxRtx()

int inet::SctpSocket::getAssocMaxRtx ( )
inline
211 { return sOptions->assocMaxRtx; };

◆ getFragPoint()

int inet::SctpSocket::getFragPoint ( )
inline
210 { return sOptions->fragPoint; };

◆ getInboundStreams()

int inet::SctpSocket::getInboundStreams ( )
inline
203 { return appOptions->inboundStreams; };

◆ getLastStream()

int inet::SctpSocket::getLastStream ( )
inline
205 { return lastStream; };

◆ getLocalAddresses()

AddressVector inet::SctpSocket::getLocalAddresses ( ) const
inline
160 { return localAddresses; }

◆ getLocalPort()

int inet::SctpSocket::getLocalPort ( ) const
inline
161 { return localPrt; }

◆ getMaxBurst()

int inet::SctpSocket::getMaxBurst ( )
inline
209 { return sOptions->maxBurst; };

◆ getMaxInitRetrans()

int inet::SctpSocket::getMaxInitRetrans ( )
inline
208 { return sOptions->maxInitRetrans; };

◆ getMaxInitRetransTimeout()

int inet::SctpSocket::getMaxInitRetransTimeout ( )
inline
207 { return sOptions->maxInitRetransTimeout; };

◆ getNewAssocId()

static int32_t inet::SctpSocket::getNewAssocId ( )
inlinestatic

Generates a new integer, to be used as assocId.

(assocId is part of the key which associates connections with their apps).

144 { return getEnvir()->getUniqueNumber(); }

Referenced by inet::sctp::Sctp::addForkedAssociation(), connect(), listen(), and SctpSocket().

◆ getOutboundStreams()

int inet::SctpSocket::getOutboundStreams ( )
inline
202 { return appOptions->outboundStreams; };

◆ getRemoteAddr()

L3Address inet::SctpSocket::getRemoteAddr ( ) const
inline

◆ getRemoteAddresses()

AddressVector inet::SctpSocket::getRemoteAddresses ( ) const
inline
162 { return remoteAddresses; }

◆ getRemotePort()

int inet::SctpSocket::getRemotePort ( ) const
inline
163 { return remotePrt; }

◆ getRtoInitial()

double inet::SctpSocket::getRtoInitial ( )
inline
206 { return sOptions->rtoInitial; };

◆ getSocketId()

int inet::SctpSocket::getSocketId ( ) const
inlineoverridevirtual

◆ getSocketOptions()

void inet::SctpSocket::getSocketOptions ( )
133 {
134  EV_INFO << "getSocketOptions\n";
135  Request *cmsg = new Request("GetSocketOptions", SCTP_C_GETSOCKETOPTIONS);
136  auto sctpSendReq = cmsg->addTag<SctpSendReq>();
137  sctpSendReq->setSocketId(assocId);
138  sctpSendReq->setSid(0);
139  sendToSctp(cmsg);
140 }

Referenced by bind(), and bindx().

◆ getState()

int inet::SctpSocket::getState ( ) const
inline

Returns the socket state, one of NOT_BOUND, CLOSED, LISTENING, CONNECTING, CONNECTED, etc.

Messages received from SCTP must be routed through processMessage() in order to keep socket state up-to-date.

151 { return sockstate; }

Referenced by inet::SctpPeer::handleMessage(), inet::SctpClient::refreshDisplay(), inet::SctpClient::socketPeerClosed(), and inet::SctpPeer::socketPeerClosed().

◆ getStreamReset()

bool inet::SctpSocket::getStreamReset ( )
inline
204 { return appOptions->streamReset; }

◆ getTunInterface()

int inet::SctpSocket::getTunInterface ( )
inline
354 { return interfaceIdToTun; };

◆ getUserData()

void* inet::SctpSocket::getUserData ( ) const
inline
130 { return userData; }

◆ isOpen()

bool inet::SctpSocket::isOpen ( ) const
overridevirtual

Implements inet::ISocket.

647 {
648  switch (sockstate) {
649  case LISTENING:
650  case CONNECTING:
651  case CONNECTED:
652  case PEER_CLOSED:
653  case LOCALLY_CLOSED:
654  case SOCKERROR: // TODO check SOCKERROR is opened or is closed socket
655  return true;
656  case NOT_BOUND:
657  case CLOSED:
658  return false;
659  default:
660  throw cRuntimeError("invalid SctpSocket state: %d", sockstate);
661  }
662 }

◆ listen() [1/2]

void inet::SctpSocket::listen ( bool  fork = true,
bool  streamReset = false,
uint32_t  requests = 0,
uint32_t  messagesToPush = 0 
)

Initiates passive OPEN.

If fork=true, you'll have to create a new SctpSocket object for each incoming connection, and this socket will keep listening on the port. If fork=false, the first incoming connection will be accepted, and SCTP will refuse subsequent ones. See SctpOpenCommand documentation (neddoc) for more info.

184 {
185  if (sockstate != CLOSED)
186  throw cRuntimeError(sockstate == NOT_BOUND ?
187  "SctpSocket::listen(): must call bind() before listen()" :
188  "SctpSocket::listen(): connect() or listen() already called");
189 
190  Request *cmsg = new Request("PassiveOPEN", SCTP_C_OPEN_PASSIVE);
191  auto openCmd = cmsg->addTag<SctpOpenReq>();
192  openCmd->setLocalAddresses(localAddresses);
193  openCmd->setLocalPort(localPrt);
194  if (oneToOne)
195  openCmd->setSocketId(assocId);
196  else
197  openCmd->setSocketId(getNewAssocId());
198  openCmd->setFork(fork);
199  openCmd->setOutboundStreams(appOptions->outboundStreams);
200  openCmd->setInboundStreams(appOptions->inboundStreams);
201  appOptions->streamReset = reset;
202  openCmd->setNumRequests(requests);
203  openCmd->setStreamReset(reset);
204  openCmd->setMessagesToPush(messagesToPush);
205 
206  EV_INFO << "Assoc " << openCmd->getSocketId() << ": PassiveOPEN to SCTP from SctpSocket:listen()\n";
207  sendToSctp(cmsg);
209 }

Referenced by inet::NetPerfMeter::createAndBindSocket(), inet::SctpServer::initialize(), and inet::SctpPeer::initialize().

◆ listen() [2/2]

void inet::SctpSocket::listen ( uint32_t  requests = 0,
bool  fork = false,
uint32_t  messagesToPush = 0,
bool  options = false,
int32_t  fd = -1 
)
212 {
213  if (sockstate != CLOSED)
214  throw cRuntimeError(sockstate == NOT_BOUND ?
215  "SctpSocket::listen(): must call bind() before listen()" :
216  "SctpSocket::listen(): connect() or listen() already called");
217 
218  Request *cmsg = new Request("PassiveOPEN", SCTP_C_OPEN_PASSIVE);
219  auto openCmd = cmsg->addTag<SctpOpenReq>();
220  openCmd->setLocalAddresses(localAddresses);
221  openCmd->setLocalPort(localPrt);
222  if (oneToOne)
223  openCmd->setSocketId(assocId);
224  else
225  openCmd->setSocketId(getNewAssocId());
226  openCmd->setFork(fork);
227  openCmd->setFd(fd);
228  openCmd->setInboundStreams(appOptions->inboundStreams);
229  openCmd->setOutboundStreams(appOptions->outboundStreams);
230  openCmd->setNumRequests(requests);
231  openCmd->setMessagesToPush(messagesToPush);
232  openCmd->setStreamReset(appOptions->streamReset);
233 
234  EV_INFO << "Assoc " << openCmd->getSocketId() << ": PassiveOPEN to SCTP from SctpSocket:listen2()\n";
235  if (options)
236  cmsg->setContextPointer((void *)sOptions);
237  sendToSctp(cmsg);
239 }

◆ processMessage()

void inet::SctpSocket::processMessage ( cMessage *  msg)
overridevirtual

Examines the message (which should have arrived from SctpMain), updates socket state, and if there is a callback object installed (see setCallback(), class CallbackInterface), dispatches to the appropriate method.

The method deletes the message, unless (1) there is a callback object installed AND (2) the message is payload (message kind SCTP_I_DATA or SCTP_I_URGENT_DATA) when the responsibility of destruction is on the socketDataArrived() callback method.

IMPORTANT: for performance reasons, this method doesn't check that the message belongs to this socket, i.e. belongsToSocket(msg) would return true!

Implements inet::ISocket.

462 {
463  switch (msg->getKind()) {
464  case SCTP_I_DATA:
465  EV_INFO << "SCTP_I_DATA\n";
466  if (cb) {
467  cb->socketDataArrived(this, check_and_cast<Packet *>(msg), false);
468  msg = nullptr;
469  }
470  break;
471 
473  EV_INFO << "SCTP_I_NOTIFICATION\n";
474  if (cb) {
475  cb->socketDataNotificationArrived(this, check_and_cast<Message *>(msg));
476  }
477  break;
478 
479  case SCTP_I_SEND_MSG:
480  if (cb) {
481  cb->sendRequestArrived(this);
482  }
483  break;
484 
485  case SCTP_I_AVAILABLE: {
486  auto indication = check_and_cast<Indication *>(msg);
487  if (cb)
488  cb->socketAvailable(this, indication);
489  else {
490  int newSocketId = indication->getTag<SctpAvailableReq>()->getNewSocketId();
491  acceptSocket(newSocketId);
492  }
493  delete msg;
494  break;
495  }
496 
497  case SCTP_I_ESTABLISHED: {
498  EV_INFO << "SCTP_I_ESTABLISHED\n";
499  if (oneToOne)
501  auto indication = check_and_cast<Indication *>(msg);
502  auto connectInfo = indication->getTag<SctpConnectReq>();
503  localAddr = connectInfo->getLocalAddr();
504  remoteAddr = connectInfo->getRemoteAddr();
505  localPrt = connectInfo->getLocalPort();
506  remotePrt = connectInfo->getRemotePort();
507  fsmStatus = connectInfo->getStatus();
508  appOptions->inboundStreams = connectInfo->getInboundStreams();
509  appOptions->outboundStreams = connectInfo->getOutboundStreams();
510  assocId = indication->getTag<SocketInd>()->getSocketId();
511 
512  if (cb) {
513  cb->socketEstablished(this, connectInfo->getNumMsgs());
514  }
515  delete msg;
516  break;
517  }
518 
519  case SCTP_I_PEER_CLOSED:
520  EV_INFO << "peer closed\n";
521  if (oneToOne)
523 
524  if (cb) {
525  cb->socketPeerClosed(this);
526  }
527  delete msg;
528  break;
529 
530  case SCTP_I_ABORT:
531  case SCTP_I_CONN_LOST:
532  case SCTP_I_CLOSED:
533  EV_INFO << "SCTP_I_CLOSED called\n";
534  sockstate = CLOSED;
535  if (cb) {
536  cb->socketClosed(this);
537  }
538  delete msg;
539  break;
540 
543  case SCTP_I_TIMED_OUT:
545  if (cb) {
546  cb->socketFailure(this, msg->getKind());
547  }
548  break;
549 
550  case SCTP_I_STATUS: {
551  auto *message = check_and_cast<Indication *>(msg);
552  auto status = message->getTagForUpdate<SctpStatusReq>();
553  if (cb) {
554  cb->socketStatusArrived(this, status.get());
555  }
556  break;
557  }
558 
559  case SCTP_I_ABANDONED:
560  if (cb) {
561  cb->msgAbandonedArrived(this);
562  }
563  delete msg;
564  break;
565 
567  EV_INFO << "SCTP_I_SHUTDOWN_RECEIVED\n";
568  if (cb) {
570  }
571  delete msg;
572  break;
573 
575  if (cb) {
576  cb->sendqueueFullArrived(this);
577  }
578  break;
579 
581  auto& tags = check_and_cast<ITaggedObject *>(msg)->getTags();
582  auto cmd = tags.getTag<SctpCommandReq>();
583  if (cb) {
584  cb->sendqueueAbatedArrived(this, cmd->getNumMsgs());
585  }
586  break;
587  }
588 
592  delete msg;
593  break;
595  auto *indication = check_and_cast<Indication *>(msg);
596  if (cb)
597  cb->socketOptionsArrived(this, indication);
598  else
599  delete indication;
600  break;
601  }
602 
603  case SCTP_I_ADDRESS_ADDED: {
604  EV_INFO << "SCTP_I_ADDRESS_ADDED\n";
605  auto& tags = check_and_cast<ITaggedObject *>(msg)->getTags();
606  auto cmd = tags.getTag<SctpCommandReq>();
607  if (cb) {
608  cb->addressAddedArrived(this, cmd->getLocalAddr(), remoteAddr);
609  }
610 // delete cmd;
611  break;
612  }
613 
614  default: {
615  throw cRuntimeError("SctpSocket::processMessage(): invalid msg kind %d, one of the SCTP_I_xxx constants expected", msg->getKind());
616  }
617  }
618 }

Referenced by inet::SctpClient::handleMessage(), and inet::SctpPeer::handleMessage().

◆ requestStatus()

void inet::SctpSocket::requestStatus ( )

Causes SCTP to reply with a fresh SctpStatusInfo, attached to a dummy message as controlInfo().

The reply message can be recognized by its message kind SCTP_I_STATUS, or (if a callback object is used) the socketStatusArrived() method of the callback object will be called.

443 {
444  Request *msg = new Request("STATUS", SCTP_C_STATUS);
445  auto cmd = msg->addTag<SctpCommandReq>();
446  cmd->setSocketId(assocId);
447  sendToSctp(msg);
448 }

◆ send()

void inet::SctpSocket::send ( Packet packet)
overridevirtual

Send data message.

Implements inet::ISocket.

356 {
357  auto sendReq = packet->findTagForUpdate<SctpSendReq>();
358  if (sendReq) {
359  if (sendReq->getSid() == -1) {
361  sendReq->setSid(lastStream);
362  }
363  if (sendReq->getSocketId() == -1) {
364  sendReq->setSocketId(assocId);
365  }
366  }
367  else {
368  auto sctpReq = packet->addTagIfAbsent<SctpSendReq>();
369  sctpReq->setSocketId(assocId);
371  sctpReq->setSid(lastStream);
372  }
373  packet->setKind(SCTP_C_SEND);
374  sendToSctp(packet);
375 }

Referenced by inet::SctpClient::sendRequest(), inet::SctpPeer::sendRequest(), inet::SctpClient::socketDataArrived(), and inet::SctpPeer::socketDataArrived().

◆ sendNotification()

void inet::SctpSocket::sendNotification ( cMessage *  msg)

Send notification.

378 {
380  throw cRuntimeError("SctpSocket::sendNotification(%s): not connected or connecting", msg->getName());
381  }
382  else if (!oneToOne && sockstate != LISTENING) {
383  throw cRuntimeError("SctpSocket::sendNotification(%s): one-to-many style socket must be listening", msg->getName());
384  }
385 
386  sendToSctp(msg);
387 }

Referenced by inet::SctpClient::sendStreamResetNotification(), inet::SctpClient::setPrimaryPath(), inet::SctpClient::shutdownReceivedArrived(), inet::SctpPeer::shutdownReceivedArrived(), inet::SctpClient::socketDataNotificationArrived(), and inet::SctpPeer::socketDataNotificationArrived().

◆ sendRequest()

void inet::SctpSocket::sendRequest ( cMessage *  msg)

◆ sendToSctp()

void inet::SctpSocket::sendToSctp ( cMessage *  msg)
protected
119 {
120  if (!gateToSctp)
121  throw cRuntimeError("SctpSocket::sendToSctp(): setOutputGate() must be invoked before socket can be used");
122  EV_INFO << "sendToSctp SocketId is set to " << assocId << endl;
123  auto& tags = check_and_cast<ITaggedObject *>(msg)->getTags();
124  tags.addTagIfAbsent<DispatchProtocolReq>()->setProtocol(&Protocol::sctp);
125  tags.addTagIfAbsent<SocketReq>()->setSocketId(assocId == -1 ? this->assocId : assocId);
126  if (interfaceIdToTun != -1) {
127  tags.addTagIfAbsent<InterfaceReq>()->setInterfaceId(interfaceIdToTun);
128  }
129  check_and_cast<cSimpleModule *>(gateToSctp->getOwnerModule())->send(msg, gateToSctp);
130 }

Referenced by abort(), accept(), close(), connect(), destroy(), getSocketOptions(), listen(), requestStatus(), send(), sendNotification(), sendRequest(), setRtoInfo(), setStreamPriority(), and shutdown().

◆ setAppLimited()

void inet::SctpSocket::setAppLimited ( bool  option)
inline
181 { appLimited = option; }

◆ setAssocMaxRtx()

void inet::SctpSocket::setAssocMaxRtx ( int  option)
inline
198 { sOptions->assocMaxRtx = option; }

◆ setCallback()

void inet::SctpSocket::setCallback ( ICallback cb)

Sets a callback object, to be used with processMessage().

This callback object may be your simple module itself (if it multiply inherits from CallbackInterface too, that is you declared it as

class MyAppModule : public cSimpleModule, public SctpSocket::CallbackInterface

and redefined the necessary virtual functions; or you may use dedicated class (and objects) for this purpose.

SctpSocket doesn't delete the callback object in the destructor or on any other occasion.

457 {
458  cb = callback;
459 }

Referenced by inet::SctpClient::initialize(), and inet::SctpPeer::initialize().

◆ setEnableHeartbeats()

void inet::SctpSocket::setEnableHeartbeats ( bool  option)
inline
195 { sOptions->enableHeartbeats = option; }

◆ setFragPoint()

void inet::SctpSocket::setFragPoint ( int  option)
inline
192 { sOptions->fragPoint = option; }

◆ setHbInterval()

void inet::SctpSocket::setHbInterval ( double  option)
inline
196 { sOptions->hbInterval = option; }

◆ setInboundStreams()

void inet::SctpSocket::setInboundStreams ( int  streams)
inline

◆ setMaxBurst()

void inet::SctpSocket::setMaxBurst ( int  option)
inline
191 { sOptions->maxBurst = option; }

◆ setMaxInitRetrans()

void inet::SctpSocket::setMaxInitRetrans ( int  option)
inline
184 { sOptions->maxInitRetrans = option; }

◆ setMaxInitRetransTimeout()

void inet::SctpSocket::setMaxInitRetransTimeout ( int  option)
inline
185 { sOptions->maxInitRetransTimeout = option; }

◆ setNagle()

void inet::SctpSocket::setNagle ( int  option)
inline
193 { sOptions->nagle = option; }

◆ setOutboundStreams()

void inet::SctpSocket::setOutboundStreams ( int  streams)
inline

◆ setOutputGate()

void inet::SctpSocket::setOutputGate ( cGate *  toSctp)
inline

Sets the gate on which to send to SCTP.

Must be invoked before socket can be used. Example: socket.setOutputGate(gate("sctpOut"));

174 { gateToSctp = toSctp; }

Referenced by inet::NetPerfMeter::createAndBindSocket(), inet::SctpClient::initialize(), inet::SctpServer::initialize(), inet::SctpPeer::initialize(), and inet::NetPerfMeter::successfullyEstablishedConnection().

◆ setPathMaxRetrans()

void inet::SctpSocket::setPathMaxRetrans ( int  option)
inline
194 { sOptions->pathMaxRetrans = option; }

◆ setRtoInfo()

void inet::SctpSocket::setRtoInfo ( double  initial,
double  max,
double  min 
)
631 {
632  sOptions->rtoInitial = initial;
633  sOptions->rtoMax = max;
634  sOptions->rtoMin = min;
635  if (sockstate == CONNECTED) {
636  Request *msg = new Request("RtoInfo", SCTP_C_SET_RTO_INFO);
637  auto cmd = msg->addTag<SctpRtoReq>();
638  cmd->setSocketId(assocId);
639  cmd->setRtoInitial(initial);
640  cmd->setRtoMin(min);
641  cmd->setRtoMax(max);
642  sendToSctp(msg);
643  }
644 }

◆ setRtoInitial()

void inet::SctpSocket::setRtoInitial ( double  option)
inline
186 { sOptions->rtoInitial = option; }

◆ setRtoMax()

void inet::SctpSocket::setRtoMax ( double  option)
inline
188 { sOptions->rtoMax = option; }

◆ setRtoMin()

void inet::SctpSocket::setRtoMin ( double  option)
inline
187 { sOptions->rtoMin = option; }

◆ setSackFrequency()

void inet::SctpSocket::setSackFrequency ( int  option)
inline
189 { sOptions->sackFrequency = option; }

◆ setSackPeriod()

void inet::SctpSocket::setSackPeriod ( double  option)
inline
190 { sOptions->sackPeriod = option; }

◆ setState()

void inet::SctpSocket::setState ( int  state)
inline
350 { sockstate = state; }

◆ setStreamPriority()

void inet::SctpSocket::setStreamPriority ( uint32_t  stream,
uint32_t  priority 
)
621 {
622  Request *msg = new Request("SET_STREAM_PRIO", SCTP_C_SET_STREAM_PRIO);
623  auto cmd = msg->addTag<SctpSendReq>();
624  cmd->setSocketId(assocId);
625  cmd->setSid(stream);
626  cmd->setPpid(priority);
627  sendToSctp(msg);
628 }

Referenced by inet::SctpPeer::connect(), and inet::SctpServer::initialize().

◆ setStreamReset()

void inet::SctpSocket::setStreamReset ( int  option)
inline
182 { appOptions->streamReset = option; }

◆ setTunInterface()

void inet::SctpSocket::setTunInterface ( int  id)
inline
352 { interfaceIdToTun = id; }

◆ setUserData()

void inet::SctpSocket::setUserData ( void *  userData)
inline
131 { this->userData = userData; }

◆ setUserOptions()

void inet::SctpSocket::setUserOptions ( SocketOptions msg)
inline
200 { delete sOptions; sOptions = msg; }

◆ shutdown()

void inet::SctpSocket::shutdown ( int  id = -1)
409 {
410  EV << "SctpSocket::shutdown()\n";
411 
412  Request *msg = new Request("SHUTDOWN", SCTP_C_SHUTDOWN);
413  auto cmd = msg->addTag<SctpCommandReq>();
414  if (id == -1)
415  cmd->setSocketId(assocId);
416  else
417  cmd->setFd(id);
418  sendToSctp(msg);
419 }

Referenced by inet::SctpClient::handleTimer(), inet::SctpClient::sendqueueAbatedArrived(), inet::SctpClient::sendRequestArrived(), inet::SctpPeer::sendRequestArrived(), inet::SctpClient::socketEstablished(), and inet::SctpPeer::socketEstablished().

◆ stateName()

const char * inet::SctpSocket::stateName ( int  state)
static

Returns name of socket state code returned by state().

100 {
101 #define CASE(x) case x: \
102  s = #x; break
103  const char *s = "unknown";
104  switch (state) {
105  CASE(NOT_BOUND);
106  CASE(CLOSED);
107  CASE(LISTENING);
108  CASE(CONNECTING);
109  CASE(CONNECTED);
110  CASE(PEER_CLOSED);
112  CASE(SOCKERROR);
113  }
114  return s;
115 #undef CASE
116 }

Referenced by connect(), connectx(), inet::SctpClient::refreshDisplay(), and SctpSocket().

Member Data Documentation

◆ appLimited

bool inet::SctpSocket::appLimited
protected

Referenced by connect(), and SctpSocket().

◆ appOptions

AppSocketOptions* inet::SctpSocket::appOptions
protected

◆ assocId

◆ cb

ICallback* inet::SctpSocket::cb
protected

◆ fsmStatus

int inet::SctpSocket::fsmStatus
protected

Referenced by processMessage(), and SctpSocket().

◆ gateToSctp

cGate* inet::SctpSocket::gateToSctp

◆ interfaceIdToTun

int inet::SctpSocket::interfaceIdToTun = -1

Referenced by sendToSctp().

◆ lastStream

int inet::SctpSocket::lastStream
protected

Referenced by SctpSocket(), and send().

◆ localAddr

L3Address inet::SctpSocket::localAddr
protected

Referenced by processMessage(), and SctpSocket().

◆ localAddresses

AddressVector inet::SctpSocket::localAddresses
protected

Referenced by addAddress(), bind(), bindx(), connect(), and listen().

◆ localPrt

int inet::SctpSocket::localPrt
protected

◆ nextAssocId

int32_t inet::SctpSocket::nextAssocId = 0
staticprotected

◆ oneToOne

bool inet::SctpSocket::oneToOne
protected

◆ remoteAddr

L3Address inet::SctpSocket::remoteAddr
protected

◆ remoteAddresses

AddressVector inet::SctpSocket::remoteAddresses
protected

Referenced by connectx().

◆ remotePrt

int inet::SctpSocket::remotePrt
protected

◆ sockstate

int inet::SctpSocket::sockstate
protected

◆ sOptions

SocketOptions* inet::SctpSocket::sOptions
protected

◆ userData

void* inet::SctpSocket::userData
protected

Referenced by SctpSocket().


The documentation for this class was generated from the following files:
inet::SCTP_I_RCV_STREAMS_RESETTED
@ SCTP_I_RCV_STREAMS_RESETTED
Definition: SctpCommand_m.h:214
inet::SctpSocket::appLimited
bool appLimited
Definition: SctpSocket.h:87
inet::SCTP_I_SENDSOCKETOPTIONS
@ SCTP_I_SENDSOCKETOPTIONS
Definition: SctpCommand_m.h:217
inet::SctpSocket::sOptions
SocketOptions * sOptions
Definition: SctpSocket.h:100
inet::SocketOptions::hbInterval
double hbInterval
Definition: SctpSocket.h:37
inet::SctpSocket::ICallback::socketAvailable
virtual void socketAvailable(SctpSocket *socket, Indication *indication)=0
inet::SctpSocket::gateToSctp
cGate * gateToSctp
Definition: SctpSocket.h:110
inet::SCTP_I_CLOSED
@ SCTP_I_CLOSED
Definition: SctpCommand_m.h:201
inet::SCTP_C_OPEN_PASSIVE
@ SCTP_C_OPEN_PASSIVE
Definition: SctpCommand_m.h:131
inet::SctpSocket::getSocketId
int getSocketId() const override
Returns the internal connection Id.
Definition: SctpSocket.h:138
inet::SCTP_I_SENDQUEUE_FULL
@ SCTP_I_SENDQUEUE_FULL
Definition: SctpCommand_m.h:210
inet::SctpSocket::CONNECTED
@ CONNECTED
Definition: SctpSocket.h:80
inet::SCTP_I_RESET_REQUEST_FAILED
@ SCTP_I_RESET_REQUEST_FAILED
Definition: SctpCommand_m.h:215
inet::SocketOptions::fragPoint
int fragPoint
Definition: SctpSocket.h:33
inet::SCTP_I_SENDQUEUE_ABATED
@ SCTP_I_SENDQUEUE_ABATED
Definition: SctpCommand_m.h:211
inet::SctpSocket::fsmStatus
int fsmStatus
Definition: SctpSocket.h:96
inet::sctp::min
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SctpAssociation.h:261
inet::SctpSocket::ICallback::socketDataArrived
virtual void socketDataArrived(SctpSocket *socket, Packet *packet, bool urgent)=0
InterfaceReq
removed InterfaceReq
Definition: IUdp-gates.txt:11
inet::SocketOptions::assocMaxRtx
int assocMaxRtx
Definition: SctpSocket.h:38
DispatchProtocolReq
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down DispatchProtocolReq
Definition: IUdp-gates.txt:25
inet::SctpSocket::ICallback::sendqueueAbatedArrived
virtual void sendqueueAbatedArrived(SctpSocket *socket, unsigned long int buffer)
Definition: SctpSocket.h:76
inet::SCTP_C_SEND
@ SCTP_C_SEND
Definition: SctpCommand_m.h:132
inet::SctpSocket::getNewAssocId
static int32_t getNewAssocId()
Generates a new integer, to be used as assocId.
Definition: SctpSocket.h:144
inet::SCTP_I_CONN_LOST
@ SCTP_I_CONN_LOST
Definition: SctpCommand_m.h:207
inet::SCTP_C_SHUTDOWN
@ SCTP_C_SHUTDOWN
Definition: SctpCommand_m.h:142
inet::SocketOptions::maxInitRetransTimeout
int maxInitRetransTimeout
Definition: SctpSocket.h:26
inet::SCTP_I_SEND_STREAMS_RESETTED
@ SCTP_I_SEND_STREAMS_RESETTED
Definition: SctpCommand_m.h:213
inet::SCTP_C_STATUS
@ SCTP_C_STATUS
Definition: SctpCommand_m.h:135
inet::SCTP_I_CONNECTION_REFUSED
@ SCTP_I_CONNECTION_REFUSED
Definition: SctpCommand_m.h:202
inet::SctpSocket::interfaceIdToTun
int interfaceIdToTun
Definition: SctpSocket.h:111
inet::SCTP_C_ACCEPT_SOCKET_ID
@ SCTP_C_ACCEPT_SOCKET_ID
Definition: SctpCommand_m.h:153
inet::SctpSocket::acceptSocket
void acceptSocket(int newSockId)
Definition: SctpSocket.cc:339
inet::SctpSocket::NOT_BOUND
@ NOT_BOUND
Definition: SctpSocket.h:80
inet::SctpSocket::ICallback::socketOptionsArrived
virtual void socketOptionsArrived(SctpSocket *socket, Indication *indication)
Definition: SctpSocket.h:65
inet::SctpSocket::ICallback::msgAbandonedArrived
virtual void msgAbandonedArrived(SctpSocket *socket)
Definition: SctpSocket.h:73
inet::SCTP_I_DATA
@ SCTP_I_DATA
Definition: SctpCommand_m.h:197
inet::SCTP_C_ABORT
@ SCTP_C_ABORT
Definition: SctpCommand_m.h:134
inet::SctpSocket::stateName
static const char * stateName(int state)
Returns name of socket state code returned by state().
Definition: SctpSocket.cc:99
inet::SCTP_I_ESTABLISHED
@ SCTP_I_ESTABLISHED
Definition: SctpCommand_m.h:199
inet::SctpSocket::localAddr
L3Address localAddr
Definition: SctpSocket.h:89
inet::units::values::s
value< double, units::s > s
Definition: Units.h:1235
inet::SocketOptions::nagle
int nagle
Definition: SctpSocket.h:34
inet::SCTP_I_CONNECTION_RESET
@ SCTP_I_CONNECTION_RESET
Definition: SctpCommand_m.h:203
inet::SctpSocket::LOCALLY_CLOSED
@ LOCALLY_CLOSED
Definition: SctpSocket.h:80
inet::SCTP_C_GETSOCKETOPTIONS
@ SCTP_C_GETSOCKETOPTIONS
Definition: SctpCommand_m.h:150
inet::SCTP_C_DESTROY
@ SCTP_C_DESTROY
Definition: SctpCommand_m.h:154
inet::SctpSocket::ICallback::socketEstablished
virtual void socketEstablished(SctpSocket *socket, unsigned long int buffer)
Definition: SctpSocket.h:66
inet::SCTP_I_SHUTDOWN_RECEIVED
@ SCTP_I_SHUTDOWN_RECEIVED
Definition: SctpCommand_m.h:209
inet::SctpSocket::remotePrt
int remotePrt
Definition: SctpSocket.h:95
inet::SCTP_I_PEER_CLOSED
@ SCTP_I_PEER_CLOSED
Definition: SctpCommand_m.h:200
inet::SCTP_C_ASSOCIATE
@ SCTP_C_ASSOCIATE
Definition: SctpCommand_m.h:130
inet::SctpSocket::sendToSctp
void sendToSctp(cMessage *msg)
Definition: SctpSocket.cc:118
inet::SocketOptions::rtoMin
double rtoMin
Definition: SctpSocket.h:28
type
removed type
Definition: IUdp-gates.txt:7
inet::SocketOptions::pathMaxRetrans
int pathMaxRetrans
Definition: SctpSocket.h:36
inet::SctpSocket::close
virtual void close() override
Close the socket.
Definition: SctpSocket.h:290
inet::SctpSocket::CLOSED
@ CLOSED
Definition: SctpSocket.h:80
inet::SctpSocket::ICallback::sendRequestArrived
virtual void sendRequestArrived(SctpSocket *socket)
Definition: SctpSocket.h:72
inet::SCTP_C_SET_RTO_INFO
@ SCTP_C_SET_RTO_INFO
Definition: SctpCommand_m.h:152
inet::SCTP_I_DATA_NOTIFICATION
@ SCTP_I_DATA_NOTIFICATION
Definition: SctpCommand_m.h:198
inet::SCTP_I_STATUS
@ SCTP_I_STATUS
Definition: SctpCommand_m.h:205
inet::SctpSocket::localAddresses
AddressVector localAddresses
Definition: SctpSocket.h:90
inet::SocketOptions::sackPeriod
double sackPeriod
Definition: SctpSocket.h:31
inet::SctpSocket::ICallback::socketDeleted
virtual void socketDeleted(SctpSocket *socket)
Definition: SctpSocket.h:71
inet::sctp::max
double max(const double a, const double b)
Returns the maximum of a and b.
Definition: SctpAssociation.h:266
inet::SctpSocket::ICallback::sendqueueFullArrived
virtual void sendqueueFullArrived(SctpSocket *socket)
Definition: SctpSocket.h:75
inet::SctpSocket::ICallback::socketDataNotificationArrived
virtual void socketDataNotificationArrived(SctpSocket *socket, Message *msg)=0
inet::SCTP_I_TIMED_OUT
@ SCTP_I_TIMED_OUT
Definition: SctpCommand_m.h:204
inet::SocketOptions::maxInitRetrans
int maxInitRetrans
Definition: SctpSocket.h:25
inet::SctpSocket::assocId
int assocId
Definition: SctpSocket.h:83
inet::SocketOptions::sackFrequency
int sackFrequency
Definition: SctpSocket.h:30
inet::SctpSocket::ICallback::socketPeerClosed
virtual void socketPeerClosed(SctpSocket *socket)
Definition: SctpSocket.h:67
inet::SCTP_C_SET_STREAM_PRIO
@ SCTP_C_SET_STREAM_PRIO
Definition: SctpCommand_m.h:149
inet::SctpSocket::connect
void connect(L3Address remoteAddress, int32_t remotePort, bool streamReset=false, int32_t prMethod=0, uint32_t numRequests=0)
Active OPEN to the given remote socket.
Definition: SctpSocket.cc:241
inet::SocketOptions::enableHeartbeats
bool enableHeartbeats
Definition: SctpSocket.h:35
inet::SctpSocket::localPrt
int localPrt
Definition: SctpSocket.h:92
inet::SctpSocket::CONNECTING
@ CONNECTING
Definition: SctpSocket.h:80
inet::SctpSocket::ICallback::socketClosed
virtual void socketClosed(SctpSocket *socket)
Definition: SctpSocket.h:68
inet::SCTP_I_ABORT
@ SCTP_I_ABORT
Definition: SctpCommand_m.h:206
inet::Protocol::sctp
static const Protocol sctp
Definition: Protocol.h:108
inet::SctpSocket::sockstate
int sockstate
Definition: SctpSocket.h:85
inet::SctpSocket::LISTENING
@ LISTENING
Definition: SctpSocket.h:80
CASE
#define CASE(x)
inet::SCTP_I_SEND_MSG
@ SCTP_I_SEND_MSG
Definition: SctpCommand_m.h:208
inet::SctpSocket::cb
ICallback * cb
Definition: SctpSocket.h:103
tags
* tags
Definition: IUdp-gates.txt:3
inet::SctpSocket::lastStream
int lastStream
Definition: SctpSocket.h:97
inet::SctpSocket::remoteAddr
L3Address remoteAddr
Definition: SctpSocket.h:93
inet::SCTP_I_ABANDONED
@ SCTP_I_ABANDONED
Definition: SctpCommand_m.h:212
inet::SctpSocket::userData
void * userData
Definition: SctpSocket.h:104
inet::SocketOptions::maxBurst
int maxBurst
Definition: SctpSocket.h:32
inet::AppSocketOptions::outboundStreams
int outboundStreams
Definition: SctpSocket.h:44
inet::AppSocketOptions::streamReset
bool streamReset
Definition: SctpSocket.h:45
inet::SctpSocket::ICallback::socketStatusArrived
virtual void socketStatusArrived(SctpSocket *socket, SctpStatusReq *status)
Definition: SctpSocket.h:70
inet::SCTP_C_ACCEPT
@ SCTP_C_ACCEPT
Definition: SctpCommand_m.h:151
inet::SctpSocket::remoteAddresses
AddressVector remoteAddresses
Definition: SctpSocket.h:94
inet::SctpSocket::bind
void bind(int localPort)
Bind the socket to a local port number.
Definition: SctpSocket.cc:142
inet::SctpSocket::oneToOne
bool oneToOne
Definition: SctpSocket.h:86
inet::SCTP_C_CLOSE
@ SCTP_C_CLOSE
Definition: SctpCommand_m.h:133
inet::SCTP_I_ADDRESS_ADDED
@ SCTP_I_ADDRESS_ADDED
Definition: SctpCommand_m.h:216
inet::SctpSocket::SOCKERROR
@ SOCKERROR
Definition: SctpSocket.h:80
inet::SctpSocket::PEER_CLOSED
@ PEER_CLOSED
Definition: SctpSocket.h:80
inet::SctpSocket::appOptions
AppSocketOptions * appOptions
Definition: SctpSocket.h:101
inet::SctpSocket::getSocketOptions
void getSocketOptions()
Definition: SctpSocket.cc:132
inet::SctpSocket::ICallback::addressAddedArrived
virtual void addressAddedArrived(SctpSocket *socket, L3Address localAddr, L3Address remoteAddr)
Definition: SctpSocket.h:77
inet::SCTP_I_AVAILABLE
@ SCTP_I_AVAILABLE
Definition: SctpCommand_m.h:218
inet::SocketOptions::rtoMax
double rtoMax
Definition: SctpSocket.h:29
inet::SocketOptions::rtoInitial
double rtoInitial
Definition: SctpSocket.h:27
inet::SctpSocket::ICallback::socketFailure
virtual void socketFailure(SctpSocket *socket, int code)
Definition: SctpSocket.h:69
inet::AppSocketOptions::inboundStreams
int inboundStreams
Definition: SctpSocket.h:43
inet::SctpSocket::ICallback::shutdownReceivedArrived
virtual void shutdownReceivedArrived(SctpSocket *socket)
Definition: SctpSocket.h:74