Yate: SctpSocket Class Reference

Yate

Public Member Functions | List of all members
SctpSocket Class Referenceabstract

Abstract SCTP Socket. More...

`#include <yateclass.h>`

Inheritance diagram for SctpSocket:

## Public Member Functions
| SctpSocket ()
| SctpSocket (SOCKET fd)
virtual | ~SctpSocket ()
virtual bool | bindx (ObjList &addresses)=0
virtual bool | connectx (ObjList &addresses)=0
virtual int | sendTo (void *buffer, int length, int stream, SocketAddr &addr, int flags)=0
virtual Socket * | accept (SocketAddr &addr)
virtual int | sendMsg (const void *buf, int length, int stream, int &flags)=0
virtual int | recvMsg (void *buf, int length, SocketAddr &addr, int &stream, int &flags)=0
virtual bool | setStreams (int inbound, int outbound)=0
virtual bool | subscribeEvents ()=0
virtual bool | getStreams (int &inbound, int &outbound)=0
virtual bool | setPayload (u_int32_t payload)=0
Public Member Functions inherited from Socket
| Socket ()
| Socket (SOCKET handle)
| Socket (int domain, int type, int protocol=0)
virtual | ~Socket ()
virtual bool | create (int domain, int type, int protocol=0)
virtual bool | terminate ()
void | attach (SOCKET handle)
SOCKET | detach ()
SOCKET | handle () const
virtual bool | canRetry () const
virtual bool | inProgress () const
virtual bool | valid () const
virtual bool | setOption (int level, int name, const void *value=0, socklen_t length=0)
bool | setIpv6OnlyOption (bool on)
virtual bool | getOption (int level, int name, void *buffer, socklen_t *length)
virtual bool | setParams (const NamedList &params)
virtual bool | getParams (const String &params, NamedList &result)
virtual bool | setTOS (int tos)
bool | setTOS (const char *tos, int defTos=Normal)
virtual int | getTOS ()
virtual bool | setBlocking (bool block=true)
virtual bool | setReuse (bool reuse=true, bool exclusive=false, bool setPort=false)
virtual bool | setLinger (int seconds=-1)
virtual bool | bind (struct sockaddr *addr, socklen_t addrlen)
virtual bool | bind (struct sockaddr *addr, socklen_t addrlen, const char *iface, int ifLen=-1)
bool | bind (const SocketAddr &addr)
virtual bool | bindIface (const char *iface, int ifLen=-1, int family=SocketAddr::Unknown)
virtual bool | listen (unsigned int backlog=0)
virtual Socket * | accept (struct sockaddr *addr=0, socklen_t *addrlen=0)
SOCKET | acceptHandle (struct sockaddr *addr=0, socklen_t *addrlen=0)
bool | updateError ()
virtual bool | canSelect () const
virtual bool | connect (struct sockaddr *addr, socklen_t addrlen)
bool | connect (const SocketAddr &addr)
virtual bool | connectAsync (struct sockaddr *addr, socklen_t addrlen, unsigned int toutUs, bool *timeout=0)
bool | connectAsync (const SocketAddr &addr, unsigned int toutUs, bool *timeout=0)
virtual bool | shutdown (bool stopReads, bool stopWrites)
virtual bool | getSockName (struct sockaddr *addr, socklen_t *addrlen)
bool | getSockName (SocketAddr &addr)
virtual bool | getPeerName (struct sockaddr *addr, socklen_t *addrlen)
bool | getPeerName (SocketAddr &addr)
virtual bool | getBoundIface (String &buf)
virtual int | sendTo (const void *buffer, int length, const struct sockaddr *addr, socklen_t adrlen, int flags=0)
int | sendTo (const void *buffer, int length, const SocketAddr &addr, int flags=0)
virtual int | send (const void *buffer, int length, int flags=0)
virtual int | writeData (const void *buffer, int length)
virtual int | recvFrom (void *buffer, int length, struct sockaddr *addr=0, socklen_t *adrlen=0, int flags=0)
int | recvFrom (void *buffer, int length, SocketAddr &addr, int flags=0)
virtual int | recv (void *buffer, int length, int flags=0)
virtual int | readData (void *buffer, int length)
virtual bool | select (bool *readok, bool *writeok, bool *except, struct timeval *timeout=0)
bool | select (bool *readok, bool *writeok, bool *except, int64_t timeout)
bool | installFilter (SocketFilter *filter)
void | removeFilter (SocketFilter *filter, bool delobj=false)
void | clearFilters (bool del=true)
virtual void | timerTick (const Time &when)
Public Member Functions inherited from Stream
virtual | ~Stream ()
int | error () const
int | writeData (const char *str)
int | writeData (const String &str)
int | writeData (const DataBlock &buf)
virtual int64_t | length ()
virtual int64_t | seek (SeekPos pos, int64_t offset=0)
int64_t | seek (int64_t offset)

## Additional Inherited Members
Public Types inherited from Socket
enum | TOS { Normal = 0 , LowDelay = IPTOS_LOWDELAY , MaxThroughput = IPTOS_THROUGHPUT , MaxReliability = IPTOS_RELIABILITY , MinCost = IPTOS_MINCOST }
enum | DSCP { DefaultPHB = 0x00 , CS0 = 0x00 , CS1 = 0x20 , CS2 = 0x40 , CS3 = 0x60 , CS4 = 0x80 , CS5 = 0xa0 , CS6 = 0xc0 , CS7 = 0xe0 , AF11 = 0x28 , AF12 = 0x30 , AF13 = 0x38 , AF21 = 0x48 , AF22 = 0x50 , AF23 = 0x58 , AF31 = 0x68 , AF32 = 0x70 , AF33 = 0x78 , AF41 = 0x88 , AF42 = 0x90 , AF43 = 0x98 , ExpeditedFwd = 0xb8 , VoiceAdmit = 0xb0 }
enum | Features { FProtoIpv6 = 0x0001 , FIpv6Only = 0x0002 , FBindToIface = 0x0004 , FEfficientSelect = 0x0008 , FExclusiveAddrUse = 0x0010 , FReusePort = 0x0020 }
Public Types inherited from Stream
enum | SeekPos { SeekBegin , SeekEnd , SeekCurrent }
Static Public Member Functions inherited from Socket
static SOCKET | invalidHandle ()
static int | socketError ()
static const TokenDict * | tosValues ()
static bool | efficientSelect ()
static bool | canSelect (SOCKET handle)
static bool | createPair (Socket &sock1, Socket &sock2, int domain=AF_UNIX)
static unsigned int | features ()
Static Public Member Functions inherited from Stream
static bool | allocPipe (Stream *&reader, Stream *&writer)
static bool | allocPair (Stream *&str1, Stream *&str2)
static bool | supportsPipes ()
static bool | supportsPairs ()
Protected Member Functions inherited from Socket
void | copyError ()
bool | checkError (int retcode, bool strict=false)
bool | applyFilters (const void *buffer, int length, int flags, const struct sockaddr *addr=0, socklen_t adrlen=0, bool rx=true)
Protected Member Functions inherited from Stream
| Stream ()
void | clearError ()
Protected Attributes inherited from Socket
SOCKET | m_handle
ObjList | m_filters
Protected Attributes inherited from Stream
int | m_error

## Detailed Description

Abstract SCTP Socket.

The SctpSocket interface provides access to SCTP specific functions

## Constructor & Destructor Documentation

## ◆ SctpSocket() [1/2]

SctpSocket | ( |  | ) |
| inline

Constructor

## ◆ SctpSocket() [2/2]

SctpSocket | ( | SOCKET | fd | ) |
| inlineexplicit

Constructor

Parameters

  fd | File descriptor of an existing handle

References Socket::Socket().

## ◆ ~SctpSocket()

virtual ~SctpSocket | ( |  | ) |
| virtual

Destructor

## Member Function Documentation

## ◆ accept()

virtual Socket * accept | ( | SocketAddr & | addr | ) |
| inlinevirtual

Accept an incoming connection

Parameters

  addr | The socket address of the incoming connection

Returns
  A new SctpSocket if an incoming connection was detected

Reimplemented from Socket.

References Socket::Socket().

## ◆ bindx()

virtual bool bindx | ( | ObjList & | addresses | ) |
| pure virtual

Bind this socket to multiple addresses

Parameters

  addresses | The list of addresses (SocketAddr)

Returns
  True if the socket bind succeded

## ◆ connectx()

virtual bool connectx | ( | ObjList & | addresses | ) |
| pure virtual

Connect this socket to multiple addresses

Parameters

  addresses | the list of addresses (SocketAddr)

Returns
  True if the socket connect succeded

## ◆ getStreams()

virtual bool getStreams | ( | int & | inbound,
|  | int & | outbound )
| pure virtual

Get the number of negotiated streams

Parameters

  inbound | Number of inbound streams
  outbound | Number of outbound streams

Returns
  True if operation has succeded

## ◆ recvMsg()

virtual int recvMsg | ( | void * | buf,
|  | int | length,
|  | SocketAddr & | addr,
|  | int & | stream,
|  | int & | flags )
| pure virtual

Receive data from a connected socket

Parameters

  buf | The buffer where the data will be stored
  length | The buffer length
  addr | Gets the remote address from which the data was received
  stream | Gets the stream number on which the data was read
  flags | Flags, gets altered on return

Returns
  The number of bytes read

References Stream::length().

## ◆ sendMsg()

virtual int sendMsg | ( | const void * | buf,
|  | int | length,
|  | int | stream,
|  | int & | flags )
| pure virtual

Send a buffer of data over a connected socket

Parameters

  buf | The data to send
  length | Data length
  stream | The stream number to send over
  flags | Flags, gets altered on return

Returns
  The number of bytes sent

References Stream::length().

## ◆ sendTo()

virtual int sendTo | ( | void * | buffer,
|  | int | length,
|  | int | stream,
|  | SocketAddr & | addr,
|  | int | flags )
| pure virtual

Send a message over a connected or unconnected socket

Parameters

  buffer | Buffer for data transfer
  length | Length of the buffer
  stream | The stream number
  addr | Address to send the message to, if NULL will behave like send()
  flags | Operating system specific bit flags that change the behaviour

Returns
  Number of bytes transferred, socketError() if an error occurred

References Stream::length().

## ◆ setPayload()

virtual bool setPayload | ( | u_int32_t | payload | ) |
| pure virtual

Set the SCTP payload protocol identifier (RFC 4960)

Parameters

  payload | Payload identifier code

Returns
  True if set successfully

## ◆ setStreams()

virtual bool setStreams | ( | int | inbound,
|  | int | outbound )
| pure virtual

Set the number of streams

Parameters

  inbound | The number of inbound streams
  outbound | The number of outbound streams

Returns
  True if the number of streams was set

## ◆ subscribeEvents()

virtual bool subscribeEvents | ( |  | ) |
| pure virtual

Subscribe to SCTP events This method should be called if we need to find from which stream the data came

Returns
  True if subscription has succeeded

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

- yateclass.h