INET Framework for OMNeT++/OMNEST
|
Implements the SCTP protocol. More...
#include <SCTP.h>
Classes | |
struct | AppAssocKey |
struct | AssocStat |
struct | SockPair |
struct | VTagPair |
Public Types | |
typedef std::map< int32, AssocStat > | AssocStatMap |
typedef std::map< int32, VTagPair > | SctpVTagMap |
typedef std::map< AppAssocKey, SCTPAssociation * > | SctpAppAssocMap |
typedef std::map< SockPair, SCTPAssociation * > | SctpAssocMap |
Public Member Functions | |
void | printInfoAssocMap () |
void | printVTagMap () |
void | removeAssociation (SCTPAssociation *assoc) |
virtual | ~SCTP () |
virtual void | initialize (int stage) override |
virtual int | numInitStages () const override |
virtual void | handleMessage (cMessage *msg) override |
virtual void | finish () override |
virtual void | send_to_ip (SCTPMessage *msg) |
AssocStat * | getAssocStat (uint32 assocId) |
void | updateSockPair (SCTPAssociation *assoc, L3Address localAddr, L3Address remoteAddr, int32 localPort, int32 remotePort) |
To be called from SCTPAssociation when socket pair changes. More... | |
void | addLocalAddress (SCTPAssociation *assoc, L3Address address) |
void | addLocalAddressToAllRemoteAddresses (SCTPAssociation *assoc, L3Address address, std::vector< L3Address > remAddresses) |
bool | addRemoteAddress (SCTPAssociation *assoc, L3Address localAddress, L3Address remoteAddress) |
void | removeLocalAddressFromAllRemoteAddresses (SCTPAssociation *assoc, L3Address address, std::vector< L3Address > remAddresses) |
void | removeRemoteAddressFromAllAssociations (SCTPAssociation *assoc, L3Address address, std::vector< L3Address > locAddresses) |
void | addForkedAssociation (SCTPAssociation *assoc, SCTPAssociation *newAssoc, L3Address localAddr, L3Address remoteAddr, int32 localPort, int32 remotePort) |
Update assocs socket pair, and register newAssoc (which'll keep LISTENing). More... | |
uint16 | getEphemeralPort () |
To be called from SCTPAssociation: reserves an ephemeral port for the connection. More... | |
SCTPAssociation * | getAssoc (int32 assocId) |
SCTPAssociation * | findAssocWithVTag (uint32 peerVTag, uint32 remotePort, uint32 localPort) |
SCTPAssociation * | findAssocForInitAck (SCTPInitAckChunk *initack, L3Address srcAddr, L3Address destAddr, uint32 srcPort, uint32 destPort, bool findListen) |
SctpVTagMap | getVTagMap () |
void | bindPortForUDP () |
SocketOptions * | collectSocketOptions () |
Getter and Setter for the socket options. More... | |
void | setSocketOptions (SocketOptions *options) |
int | getMaxInitRetrans () |
int | getMaxInitRetransTimeout () |
double | getRtoInitial () |
double | getRtoMin () |
double | getRtoMax () |
int | getSackFrequency () |
double | getSackPeriod () |
int | getMaxBurst () |
int | getFragPoint () |
int | getNagle () |
bool | getEnableHeartbeats () |
int | getPathMaxRetrans () |
int | getAssocMaxRtx () |
double | getHbInterval () |
void | setRtoInitial (double rtoInitial) |
void | setRtoMin (double rtoMin) |
void | setRtoMax (double rtoMax) |
Public Attributes | |
AssocStatMap | assocStatMap |
SctpVTagMap | sctpVTagMap |
SctpAppAssocMap | sctpAppAssocMap |
SctpAssocMap | sctpAssocMap |
std::list< SCTPAssociation * > | assocList |
UDPSocket | udpSocket |
SocketOptions * | socketOptions |
simtime_t | testTimeout |
uint32 | numGapReports |
uint32 | numPacketsReceived |
uint32 | numPacketsDropped |
bool | auth |
bool | addIP |
bool | pktdrop |
bool | sackNow |
uint64 | numPktDropReports |
Protected Member Functions | |
SCTPAssociation * | findAssocForMessage (L3Address srcAddr, L3Address destAddr, uint32 srcPort, uint32 destPort, bool findListen) |
SCTPAssociation * | findAssocForApp (int32 appGateIndex, int32 assocId) |
int32 | findAssocForFd (int32 fd) |
void | sendAbortFromMain (SCTPMessage *sctpmsg, L3Address fromAddr, L3Address toAddr) |
void | sendShutdownCompleteFromMain (SCTPMessage *sctpmsg, L3Address fromAddr, L3Address toAddr) |
virtual void | refreshDisplay () const override |
Protected Attributes | |
IRoutingTable * | rt |
IInterfaceTable * | ift |
int32 | sizeAssocMap |
uint16 | nextEphemeralPort |
Implements the SCTP protocol.
This section describes the internal architecture of the SCTP model.
You may want to check the SCTPSocket class which makes it easier to use SCTP from applications.
The SCTP protocol implementation is composed of several classes (discussion follows below):
SCTP subclassed from cSimpleModule. It manages socketpair-to-association mapping, and dispatches segments and user commands to the appropriate SCTPAssociation object.
SCTPAssociation manages the association, with the help of other objects. SCTPAssociation itself implements the basic SCTP "machinery": takes care of the state machine, stores the state variables (TCB), sends/receives etc.
SCTPAssociation internally relies on 3 objects. The first two are subclassed from SCTPSendQueue and SCTPReceiveQueue. They manage the actual data stream, so SCTPAssociation itself only works with sequence number variables. This makes it possible to easily accomodate need for various types of simulated data transfer: real byte stream, "virtual" bytes (byte counts only), and sequence of cMessage objects (where every message object is mapped to a SCTP sequence number range).
Currently implemented send queue and receive queue classes are SCTPVirtualDataSendQueue and SCTPVirtualDataRcvQueue which implement queues with "virtual" bytes (byte counts only).
The third object is subclassed from SCTPAlgorithm. Control over retransmissions, congestion control and ACK sending are "outsourced" from SCTPAssociation into SCTPAlgorithm: delayed acks, slow start, fast rexmit, etc. are all implemented in SCTPAlgorithm subclasses.
The concrete SCTPAlgorithm class to use can be chosen per association (in OPEN) or in a module parameter.
typedef std::map<int32, AssocStat> inet::sctp::SCTP::AssocStatMap |
typedef std::map<AppAssocKey, SCTPAssociation *> inet::sctp::SCTP::SctpAppAssocMap |
typedef std::map<SockPair, SCTPAssociation *> inet::sctp::SCTP::SctpAssocMap |
typedef std::map<int32, VTagPair> inet::sctp::SCTP::SctpVTagMap |
|
virtual |
void inet::sctp::SCTP::addForkedAssociation | ( | SCTPAssociation * | assoc, |
SCTPAssociation * | newAssoc, | ||
L3Address | localAddr, | ||
L3Address | remoteAddr, | ||
int32 | localPort, | ||
int32 | remotePort | ||
) |
Update assocs socket pair, and register newAssoc (which'll keep LISTENing).
Also, assoc will get a new assocId (and newAssoc will live on with its old assocId).
Referenced by inet::sctp::SCTPAssociation::processInitArrived().
void inet::sctp::SCTP::addLocalAddress | ( | SCTPAssociation * | assoc, |
L3Address | address | ||
) |
Referenced by inet::sctp::SCTPAssociation::processInitArrived(), and inet::sctp::SCTPAssociation::sendInit().
void inet::sctp::SCTP::addLocalAddressToAllRemoteAddresses | ( | SCTPAssociation * | assoc, |
L3Address | address, | ||
std::vector< L3Address > | remAddresses | ||
) |
bool inet::sctp::SCTP::addRemoteAddress | ( | SCTPAssociation * | assoc, |
L3Address | localAddress, | ||
L3Address | remoteAddress | ||
) |
Referenced by inet::sctp::SCTPAssociation::processAsconfArrived(), inet::sctp::SCTPAssociation::processInitAckArrived(), and inet::sctp::SCTPAssociation::processInitArrived().
void inet::sctp::SCTP::bindPortForUDP | ( | ) |
Referenced by initialize().
SocketOptions * inet::sctp::SCTP::collectSocketOptions | ( | ) |
|
protected |
Referenced by handleMessage().
Referenced by handleMessage().
SCTPAssociation * inet::sctp::SCTP::findAssocForInitAck | ( | SCTPInitAckChunk * | initack, |
L3Address | srcAddr, | ||
L3Address | destAddr, | ||
uint32 | srcPort, | ||
uint32 | destPort, | ||
bool | findListen | ||
) |
Referenced by handleMessage().
|
protected |
Referenced by findAssocForInitAck(), and handleMessage().
SCTPAssociation * inet::sctp::SCTP::findAssocWithVTag | ( | uint32 | peerVTag, |
uint32 | remotePort, | ||
uint32 | localPort | ||
) |
Referenced by handleMessage().
|
overridevirtual |
SCTPAssociation * inet::sctp::SCTP::getAssoc | ( | int32 | assocId | ) |
Referenced by findAssocWithVTag().
|
inline |
|
inline |
uint16 inet::sctp::SCTP::getEphemeralPort | ( | ) |
To be called from SCTPAssociation: reserves an ephemeral port for the connection.
Referenced by inet::sctp::SCTPAssociation::process_ASSOCIATE().
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by inet::sctp::SCTPAssociation::process_TIMEOUT_INIT_REXMIT().
|
inline |
Referenced by inet::sctp::SCTPAssociation::process_TIMEOUT_INIT_REXMIT().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by inet::sctp::SCTPAssociation::pmRttMeasurement().
|
inline |
|
inline |
|
inline |
|
overridevirtual |
|
overridevirtual |
|
inlineoverridevirtual |
void inet::sctp::SCTP::printInfoAssocMap | ( | ) |
Referenced by addForkedAssociation(), addLocalAddress(), addLocalAddressToAllRemoteAddresses(), addRemoteAddress(), inet::sctp::SCTPAssociation::cloneAssociation(), findAssocForMessage(), findAssocWithVTag(), handleMessage(), removeAssociation(), removeLocalAddressFromAllRemoteAddresses(), removeRemoteAddressFromAllAssociations(), inet::sctp::SCTPAssociation::sendInit(), and updateSockPair().
void inet::sctp::SCTP::printVTagMap | ( | ) |
Referenced by findAssocWithVTag().
|
overrideprotectedvirtual |
void inet::sctp::SCTP::removeAssociation | ( | SCTPAssociation * | assoc | ) |
Referenced by finish(), handleMessage(), inet::sctp::SCTPAssociation::process_RCV_Message(), inet::sctp::SCTPAssociation::process_TIMEOUT_HEARTBEAT(), inet::sctp::SCTPAssociation::process_TIMEOUT_RTX(), inet::sctp::SCTPAssociation::process_TIMEOUT_SHUTDOWN(), and inet::sctp::SCTPAssociation::updateCounters().
void inet::sctp::SCTP::removeLocalAddressFromAllRemoteAddresses | ( | SCTPAssociation * | assoc, |
L3Address | address, | ||
std::vector< L3Address > | remAddresses | ||
) |
Referenced by inet::sctp::SCTPAssociation::processAsconfAckArrived().
void inet::sctp::SCTP::removeRemoteAddressFromAllAssociations | ( | SCTPAssociation * | assoc, |
L3Address | address, | ||
std::vector< L3Address > | locAddresses | ||
) |
Referenced by inet::sctp::SCTPAssociation::processAsconfArrived().
|
virtual |
Referenced by sendAbortFromMain(), sendShutdownCompleteFromMain(), and inet::sctp::SCTPAssociation::sendToIP().
|
protected |
Referenced by handleMessage().
|
protected |
Referenced by handleMessage().
|
inline |
|
inline |
|
inline |
|
inline |
void inet::sctp::SCTP::updateSockPair | ( | SCTPAssociation * | assoc, |
L3Address | localAddr, | ||
L3Address | remoteAddr, | ||
int32 | localPort, | ||
int32 | remotePort | ||
) |
To be called from SCTPAssociation when socket pair changes.
Referenced by addForkedAssociation(), inet::sctp::SCTPAssociation::process_ASSOCIATE(), inet::sctp::SCTPAssociation::process_OPEN_PASSIVE(), and inet::sctp::SCTPAssociation::processInitArrived().
bool inet::sctp::SCTP::addIP |
std::list<SCTPAssociation *> inet::sctp::SCTP::assocList |
AssocStatMap inet::sctp::SCTP::assocStatMap |
Referenced by inet::sctp::SCTPAssociation::addAuthChunkIfNecessary(), inet::sctp::SCTPAssociation::createForwardTsnChunk(), inet::sctp::SCTPAssociation::createSack(), finish(), inet::sctp::SCTPAssociation::makeRoomForTsn(), inet::sctp::SCTPAssociation::pathStatusIndication(), inet::sctp::SCTPAssociation::process_RCV_Message(), inet::sctp::SCTPAssociation::process_SEND(), inet::sctp::SCTPAssociation::process_TIMEOUT_RTX(), inet::sctp::SCTPAssociation::processAddInAndOutResetRequestArrived(), inet::sctp::SCTPAssociation::processAsconfArrived(), inet::sctp::SCTPAssociation::processDataArrived(), inet::sctp::SCTPAssociation::processOutAndResponseArrived(), inet::sctp::SCTPAssociation::processResetResponseArrived(), inet::sctp::SCTPAssociation::pushUlp(), removeAssociation(), inet::sctp::SCTPAssociation::retransmitAsconf(), inet::sctp::SCTPAssociation::retransmitCookieEcho(), inet::sctp::SCTPAssociation::sendAbort(), inet::sctp::SCTPAssociation::sendAddOutgoingStreamsRequest(), inet::sctp::SCTPAssociation::sendAsconf(), inet::sctp::SCTPAssociation::sendAsconfAck(), inet::sctp::SCTPAssociation::sendCookieAck(), inet::sctp::SCTPAssociation::sendCookieEcho(), inet::sctp::SCTPAssociation::sendHeartbeat(), inet::sctp::SCTPAssociation::sendHeartbeatAck(), inet::sctp::SCTPAssociation::sendInvalidStreamError(), inet::sctp::SCTPAssociation::sendOnPath(), inet::sctp::SCTPAssociation::sendSack(), inet::sctp::SCTPAssociation::sendShutdown(), inet::sctp::SCTPAssociation::sendStreamResetRequest(), and ~SCTP().
bool inet::sctp::SCTP::auth |
|
protected |
Referenced by handleMessage(), and initialize().
|
protected |
Referenced by getEphemeralPort(), and initialize().
uint32 inet::sctp::SCTP::numGapReports |
uint32 inet::sctp::SCTP::numPacketsDropped |
Referenced by finish(), handleMessage(), and initialize().
uint32 inet::sctp::SCTP::numPacketsReceived |
Referenced by finish(), handleMessage(), and initialize().
uint64 inet::sctp::SCTP::numPktDropReports |
Referenced by finish(), initialize(), and inet::sctp::SCTPAssociation::sendPacketDrop().
bool inet::sctp::SCTP::pktdrop |
|
protected |
Referenced by handleMessage(), and initialize().
bool inet::sctp::SCTP::sackNow |
SctpAppAssocMap inet::sctp::SCTP::sctpAppAssocMap |
Referenced by addForkedAssociation(), findAssocForApp(), findAssocForFd(), getAssoc(), handleMessage(), removeAssociation(), and ~SCTP().
SctpAssocMap inet::sctp::SCTP::sctpAssocMap |
Referenced by addForkedAssociation(), addLocalAddress(), addLocalAddressToAllRemoteAddresses(), addRemoteAddress(), findAssocForMessage(), finish(), handleMessage(), printInfoAssocMap(), removeAssociation(), removeLocalAddressFromAllRemoteAddresses(), removeRemoteAddressFromAllAssociations(), and updateSockPair().
SctpVTagMap inet::sctp::SCTP::sctpVTagMap |
Referenced by findAssocWithVTag(), printVTagMap(), and ~SCTP().
|
protected |
SocketOptions* inet::sctp::SCTP::socketOptions |
Referenced by finish(), and handleMessage().
simtime_t inet::sctp::SCTP::testTimeout |
Referenced by initialize().
UDPSocket inet::sctp::SCTP::udpSocket |
Referenced by bindPortForUDP(), sendAbortFromMain(), and inet::sctp::SCTPAssociation::sendToIP().