1#ifndef NET_SCTPSocket_h__
2#define NET_SCTPSocket_h__
8#include <netinet/sctp.h>
39 SCTPSocket( uint16_t numOutStreams = 10, uint16_t maxInStreams = 65535, uint16_t maxAttempts = 4,
40 uint16_t maxInitTimeout = 0 );
49 int bind(
const std::vector<std::string>& localAddresses,
unsigned short localPort = 0);
52 int connect(
const std::vector<std::string>& foreignAddresses,
unsigned short foreignPort = 0);
63 int send(
const void* data,
size_t length, uint16_t stream,
unsigned ttl = 0,
unsigned context = 0,
unsigned ppid = 0,
66 int sendUnordered(
const void* data,
size_t length, uint16_t stream,
unsigned ttl = 0,
unsigned context = 0,
70 int receive(
void* data,
size_t maxLen, uint16_t& stream);
74 int timedReceive(
void* data,
size_t maxLen, uint16_t& stream,
int timeout);
77 void listen(
int backlog = 5);
82 void setInitValues( uint16_t ostr, uint16_t istr, uint16_t att, uint16_t time);
void bind(unsigned short localPort=0)
InternetSocket(int sockfd)
create socket from a SocketHandle returned by an accept() call
void connect(std::string_view foreignAddress, unsigned short foreignPort)
establish a connection with the given foreign address and port
unsigned outStreams() const
int sendUnordered(const void *data, size_t length, uint16_t stream, unsigned ttl=0, unsigned context=0, unsigned ppid=0, abortFlag abort=KEEPALIVE, switchAddressFlag switchAddr=KEEP_PRIMARY)
SCTPSocket(uint16_t numOutStreams=10, uint16_t maxInStreams=65535, uint16_t maxAttempts=4, uint16_t maxInitTimeout=0)
unsigned fragmentationPoint() const
void setInitValues(uint16_t ostr, uint16_t istr, uint16_t att, uint16_t time)
int connect(const std::vector< std::string > &foreignAddresses, unsigned short foreignPort=0)
unsigned inStreams() const
Handle timedAccept(int timeout) const
SocketHandle< SCTPSocket > Handle
Handle for a new socket returned by accept.
int receive(void *data, size_t maxLen, uint16_t &stream)
void listen(int backlog=5)
int send(const void *data, size_t length, uint16_t stream, unsigned ttl=0, unsigned context=0, unsigned ppid=0, abortFlag abort=KEEPALIVE, switchAddressFlag switchAddr=KEEP_PRIMARY)
int timedReceive(void *data, size_t maxLen, uint16_t &stream, int timeout)
int bind(const std::vector< std::string > &localAddresses, unsigned short localPort=0)
std::string primaryAddress() const
int timedReceive(void *buffer, size_t len, int timeout)
receive data from a bound socket, return after the given timespan
int send(const void *buffer, size_t len)
send data through a connected socket
int receive(void *buffer, size_t len)
receive data from a bound socket
A simple class to provide strict ownership of socket handles.