class SCTPSocket

SCTP Socket. More...

Full nameCoral::SCTPSocket
Definition#include <sctpsocket.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Protected Types

Protected Methods

Protected Members


Detailed Description

This class manages a SCTP socket (SCTP instance).

enum SCTPSocketFlags { SSF_GlobalQueue = (1 << 0), SSF_AutoConnect = (1 << 1), SSF_Listening = (1 << 31) }

SCTPSocketFlags

SCTP socket flags.

 SCTPSocket (const cardinal flags = 0)

SCTPSocket

Constructor.

Parameters:
flagsSCTP socket flags.

 ~SCTPSocket ()

~SCTPSocket

Destructor.

inline unsigned short  getID ()

getID

[const]

Get internal instance ID.

Returns: Instance ID.

int  bind (const unsigned short localPort, const unsigned short noOfInStreams, const unsigned short noOfOutStreams, const SocketAddress** localAddressList)

bind

Bind socket to local port and address(es).

Parameters:
localPortLocal port.
noOfInStreamsNumber of incoming streams.
noOfOutStreamsNumber of outgoing streams.
localAddressListNULL-terminated array of local addresses.

void  unbind (const bool sendAbort = false)

unbind

Release socket binding.

Parameters:
sendAborttrue to send abort to all UDP-like associations; false for graceful shutdown (default).

See also: bind

SCTPAssociation*  associate (const unsigned short noOfOutStreams, const SocketAddress& destinationAddress, const bool blocking = true)

associate

Establish new association.

Parameters:
noOfOutStreamsNumber of outgoing streams.
destinationAddressDestination address.
blockingtrue to wait for establishment (default); false otherwise.

Returns: Association or NULL in case of failure.

void  listen (const unsigned int backlog)

listen

Set socket to listen mode: accept new incoming assocations.

Parameters:
backlogMaximum number of incoming connections to accept simultaneously.

SCTPAssociation*  accept (SocketAddress*** addressArray = NULL, const bool blocking = true)

accept

Wait for incoming association.

Parameters:
addressArrayReference to store NULL-terminated array of peer addresses. The addresses are allocated automatically and have to be freed using deleteAddressList(). Set NULL to skip creation of the address array.
blockingtrue to wait for new association (default); false otherwise.

Returns: New association or NULL in case of failure.

See also: SocketAddress#deleteAddressList

SCTPAssociation*  peelOff (const unsigned int assocID)

peelOff

Peel automatically established association in UDP-like mode off.

Parameters:
assocIDAssociation ID.

Returns: Association peeled of or NULL, if there is no such association.

SCTPAssociation*  peelOff (const SocketAddress& destinationAddress)

peelOff

Peel automatically established association in UDP-like mode off.

Parameters:
assocIDAssociation ID.

Returns: Association peeled of or NULL, if there is no such association.

bool  getLocalAddresses (SocketAddress**& addressArray)

getLocalAddresses

Get socket's local addresses.

Parameters:
addressArrayReference to store NULL-terminated array of local addresses. The addresses are allocated automatically and have to be freed using deleteAddressList().

Returns: true, if addressEntries are sufficient; false otherwise.

See also: SocketAddress#deleteAddressList

bool  getRemoteAddresses (SocketAddress**& addressArray, unsigned int assocID)

getRemoteAddresses

Get socket's remote addresses for given association ID.

Parameters:
addressArrayReference to store NULL-terminated array of local addresses. The addresses are allocated automatically and have to be freed using deleteAddressList().
assocIDAssociation ID.

Returns: true, if addressEntries are sufficient; false otherwise.

See also: SocketAddress#deleteAddressList

int  receive (char* buffer, size_t& bufferSize, int& flags, unsigned int& assocID, unsigned short& streamID, unsigned int& protoID)

receive

Receive data.

Parameters:
bufferBuffer to store data to.
bufferSizeSize of data buffer; this will be overwritten with actual size of data content.
flagsFlags; this will be overwritten with actual reception flags.
assocIDVariable to store association ID to.
streamIDVariable to store stream ID to.
protoIDVariable to store protocol ID to.
addressArrayReference to store NULL-terminated array of peer addresses. The addresses are allocated automatically and have to be freed using deleteAddressList(). Set NULL to skip creation of the address array.
statusVariable to store SCTPNotification data to.

Returns: error code (0 for success).

int  receiveFrom (char* buffer, size_t& bufferSize, int& flags, unsigned int& assocID, unsigned short& streamID, unsigned int& protoID, SocketAddress*** addressArray, SCTPNotification& notification)

receiveFrom

Receive data.

Parameters:
bufferBuffer to store data to.
bufferSizeSize of data buffer; this will be overwritten with actual size of data content.
flagsFlags; this will be overwritten with actual reception flags.
assocIDVariable to store association ID to.
streamIDVariable to store stream ID to.
protoIDVariable to store protocol ID to.
addressArrayReference to store NULL-terminated array of peer addresses. The addresses are allocated automatically and have to be freed using deleteAddressList(). Set NULL to skip creation of the address array.
statusVariable to store SCTPNotification data to.

Returns: error code (0 for success).

See also: SocketAddress#deleteAddressList

int  sendTo (const char* buffer, const size_t length, const int flags, const unsigned short streamID, const unsigned int protoID, const SocketAddress& destinationAddress, const cardinal noOfOutgoingStreams = 1)

sendTo

Send data.

Parameters:
bufferData to be sent.
lengthLength of data to be sent.
flagsFlags.
streamIDStream ID.
protoIDProtocol ID.
destinationAddressDestination address.
noOfOutgoingStreamsFor AutoConnect mode: Number of outgoing streams for newly created connections.

Returns: error code (0 for success).

inline unsigned int  getNotificationFlags ()

getNotificationFlags

[const]

Get notification flags.

Returns: Notification flags.

inline void  setNotificationFlags (const unsigned int notificationFlags)

setNotificationFlags

Get notification flags.

Parameters:
notificationFlagsNotification flags.

void  getInstanceParameters (SCTP_Instance_Parameters& instanceParameters)

getInstanceParameters

Get instance parameters.

Parameters:
instanceParametersReference to store instance parameters.

bool  setInstanceParameters (const SCTP_Instance_Parameters& instanceParameters)

setInstanceParameters

Set instance parameters.

Parameters:
instanceParametersInstance parameters.

Returns: true, if successful; false otherwise.

bool  getAssociationParameters (const unsigned int assocID, SCTP_Association_Status& associationParameters)

getAssociationParameters

Get association parameters.

Parameters:
assocIDAssociation ID.
associationParametersReference to store association parameters.

Returns: true, if successful; false otherwise.

bool  setAssociationParameters (const unsigned int assocID, const SCTP_Association_Status& associationParameters)

setAssociationParameters

Set association parameters.

Parameters:
assocIDAssociation ID.
associationParametersAssociation parameters.

Returns: true, if successful; false otherwise.

bool  getPathParameters (const unsigned int assocID, const int pathIndex, SCTP_PathStatus& pathParameters)

getPathParameters

Get path parameters.

Parameters:
assocIDPath ID.
pathIndexPath index (-1 for primary).
pathParametersReference to store path parameters.

Returns: true, if successful; false otherwise.

bool  setPathParameters (const unsigned int assocID, const int pathIndex, const SCTP_PathStatus& pathParameters)

setPathParameters

Set path parameters.

Parameters:
assocIDPath ID.
pathIndexPath index (-1 for primary).
pathParametersPath parameters.

Returns: true, if successful; false otherwise.

SocketAddress*  getPrimaryAddress (const unsigned int assocID)

getPrimaryAddress

Get primary address of given association.

Parameters:
assocIDAssociation ID.

Returns: Primary address. This address has to be deleted after usage.

bool  setPrimary (const unsigned int assocID, const SocketAddress& primary)

setPrimary

Set primary address of given association.

Parameters:
assocIDAssociation ID.
primaryPrimary address.

Returns: true for success; false otherwise.

bool  setPeerPrimary (const unsigned int assocID, const SocketAddress& primary)

setPeerPrimary

Set peer primary address of given association.

Parameters:
assocIDAssociation ID.
primaryPeer primary address.

Returns: true for success; false otherwise.

bool  addAddress (const unsigned int assocID, const SocketAddress& addAddress)

addAddress

Add address to given association.

Parameters:
assocIDAssociation ID (0 for all UDP-like associations).
addAddressAddress to be added.

Returns: true for success; false otherwise.

bool  deleteAddress (const unsigned int assocID, const SocketAddress& delAddress)

deleteAddress

Delete address from given association.

Parameters:
assocIDAssociation ID (0 for all UDP-like associations).
delAddressAddress to be deleted.

Returns: true for success; false otherwise.

inline card64  getAutoClose ()

getAutoClose

[const]

Get AutoClose parameter.

Returns: Timeout in microseconds.

inline void  setAutoClose (const card64 timeout)

setAutoClose

Set AutoClose parameter.

Parameters:
timeoutTimeout in microseconds.

bool  setSendBuffer (const size_t size)

setSendBuffer

Set send buffer size for all UDP-like associations.

Parameters:
sizeSend buffer size.

bool  setReceiveBuffer (const size_t size)

setReceiveBuffer

Set receive buffer size for all UDP-like associations.

Parameters:
sizeReceive buffer size.

inline card8  getDefaultTrafficClass ()

getDefaultTrafficClass

[const]

Get default traffic class.

Returns: Default traffic class.

bool  setTrafficClass (const card8 trafficClass, const int streamID = -1)

setTrafficClass

Set traffic class for all UDP-like associations.

Parameters:
trafficClassTraffic class.
streamIDStream ID (-1 for all streams, default).

enum UpdateConditionTypes { UCT_Read = 0, UCT_Write = 1, UCT_Except = 2 }

UpdateConditionTypes

Update condition types.

inline Condition*  getUpdateCondition (const cardinal type)

getUpdateCondition

Get pointer to update condition.

Parameters:
typeUpdate condition type.

Returns: Update condition.

SCTPAssociation*  getAssociationForAssociationID (const unsigned int assocID, const bool activeOnly = true)

getAssociationForAssociationID

[protected]

int  getErrorCode (const unsigned int assocID)

getErrorCode

[protected]

int  internalReceive (SCTPNotificationQueue& queue, char* buffer, size_t& bufferSize, int& flags, unsigned int& assocID, unsigned short& streamID, unsigned int& protoID, SCTPNotification& notification, const unsigned int notificationFlags)

internalReceive

[protected]

int  internalSend (const char* buffer, const size_t length, const int flags, const unsigned int assocID, const unsigned short streamID, const unsigned int protoID, Condition* waitCondition)

internalSend

[protected]

IncomingConnection (struct)

IncomingConnection

[protected]

SCTPNotificationQueue GlobalQueue

GlobalQueue

[protected]

Condition EstablishCondition

EstablishCondition

[protected]

Condition ReadUpdateCondition

ReadUpdateCondition

[protected]

Condition WriteUpdateCondition

WriteUpdateCondition

[protected]

Condition ExceptUpdateCondition

ExceptUpdateCondition

[protected]

IncomingConnection* ConnectionRequests

ConnectionRequests

[protected]

multimap<unsigned int, SCTPAssociation*> AssociationList

AssociationList

[protected]

unsigned short InstanceName

InstanceName

[protected]

unsigned short LocalPort

LocalPort

[protected]

unsigned short NoOfInStreams

NoOfInStreams

[protected]

unsigned short NoOfOutStreams

NoOfOutStreams

[protected]

unsigned int NoOfLocalAddresses

NoOfLocalAddresses

[protected]

unsigned char LocalAddressList[SCTP_MAX_NUM_ADDRESSES][SCTP_MAX_IP_LEN]

LocalAddressList[SCTP_MAX_NUM_ADDRESSES][SCTP_MAX_IP_LEN]

[protected]

cardinal Flags

Flags

[protected]

unsigned int NotificationFlags

NotificationFlags

[protected]

unsigned int CorrelationID

CorrelationID

[protected]

card64 AutoCloseTimeout

AutoCloseTimeout

[protected]