# class SctpSocket

Abstract SCTP Socket. More...

Contains pure virtuals
Full name | `TelEngine::SctpSocket`
Definition | `#include <yateclass.h>`
Inherits | TelEngine::Socket [public ]
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- inline SctpSocket ()
- inline explicit SctpSocket (SOCKET fd)
- virtual ~SctpSocket ()
- virtual bool bindx (ObjList& addresses)
- virtual bool connectx (ObjList& addresses)
- virtual int sendTo (void* buffer, int length, int stream, SocketAddr& addr, int flags)
- virtual Socket* accept (SocketAddr& addr)
- virtual int sendMsg (const void* buf, int length, int stream, int& flags)
- virtual int recvMsg (void* buf, int length, SocketAddr& addr, int& stream, int& flags)
- virtual bool setStreams (int inbound, int outbound)
- virtual bool subscribeEvents ()
- virtual bool getStreams (int& inbound, int& outbound)
- virtual bool setPayload (u_int32_t payload)

## Detailed Description

The SctpSocket interface provides access to SCTP specific functions

inline SctpSocket ()

### SctpSocket

Constructor

inline explicit SctpSocket (SOCKET fd)

### SctpSocket

Constructor

Parameters:

fd | File descriptor of an existing handle

~SctpSocket ()

### ~SctpSocket

[virtual]

Destructor

bool bindx (ObjList& addresses)

### bindx

[pure virtual]

Bind this socket to multiple addresses

Parameters:

addresses | The list of addresses (SocketAddr)

Returns: True if the socket bind succeded

bool connectx (ObjList& addresses)

### connectx

[pure virtual]

Connect this socket to multiple addresses

Parameters:

addresses | the list of addresses (SocketAddr)

Returns: True if the socket connect succeded

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

### sendTo

[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

Reimplemented from Socket.

Socket* accept (SocketAddr& addr)

### accept

[virtual]

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.

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

### sendMsg

[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

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

### recvMsg

[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

bool setStreams (int inbound, int outbound)

### setStreams

[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

bool subscribeEvents ()

### 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

bool getStreams (int& inbound, int& outbound)

### getStreams

[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

bool setPayload (u_int32_t payload)

### setPayload

[pure virtual]

Set the SCTP payload protocol identifier (RFC 4960)

Parameters:

payload | Payload identifier code

Returns: True if set successfully

Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.