30 #include <sys/types.h>
31 #include <sys/socket.h>
32 #include <sys/select.h>
33 #include <netinet/in.h>
34 #include <arpa/inet.h>
52 int janus_sctp_init(
void);
55 void janus_sctp_deinit(
void);
58 #define BUFFER_SIZE (1<<16)
59 #define NUMBER_OF_CHANNELS (150)
60 #define NUMBER_OF_STREAMS (300)
62 #define DATA_CHANNEL_PPID_CONTROL 50
63 #define DATA_CHANNEL_PPID_DOMSTRING 51
64 #define DATA_CHANNEL_PPID_BINARY_PARTIAL 52
65 #define DATA_CHANNEL_PPID_BINARY 53
66 #define DATA_CHANNEL_PPID_DOMSTRING_PARTIAL 54
68 #define DATA_CHANNEL_CLOSED 0
69 #define DATA_CHANNEL_CONNECTING 1
70 #define DATA_CHANNEL_OPEN 2
71 #define DATA_CHANNEL_CLOSING 3
73 #define DATA_CHANNEL_FLAGS_SEND_REQ 0x00000001
74 #define DATA_CHANNEL_FLAGS_SEND_RSP 0x00000002
75 #define DATA_CHANNEL_FLAGS_SEND_ACK 0x00000004
80 typedef struct janus_sctp_channel {
101 typedef struct janus_sctp_association {
111 struct janus_sctp_channel channels[NUMBER_OF_CHANNELS];
113 struct janus_sctp_channel *stream_channel[NUMBER_OF_STREAMS];
115 uint16_t stream_buffer[NUMBER_OF_STREAMS];
117 uint32_t stream_buffer_counter;
123 uint16_t remote_port;
131 GQueue *pending_messages;
138 volatile gint destroyed;
141 } janus_sctp_association;
144 #define DATA_CHANNEL_OPEN_REQUEST 3
145 #define DATA_CHANNEL_OPEN_RESPONSE 1
146 #define DATA_CHANNEL_ACK 2
148 #define DATA_CHANNEL_RELIABLE 0x00
149 #define DATA_CHANNEL_RELIABLE_UNORDERED 0x80
150 #define DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT 0x01
151 #define DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT_UNORDERED 0x81
152 #define DATA_CHANNEL_PARTIAL_RELIABLE_TIMED 0x02
153 #define DATA_CHANNEL_PARTIAL_RELIABLE_TIMED_UNORDERED 0x82
156 typedef struct janus_datachannel_open_request {
160 uint8_t channel_type;
164 uint32_t reliability_params;
166 uint16_t label_length;
168 uint16_t protocol_length;
172 } janus_datachannel_open_request;
174 typedef struct janus_datachannel_open_response {
182 uint16_t reverse_stream;
183 } janus_datachannel_open_response;
185 typedef struct janus_datachannel_ack {
188 } janus_datachannel_ack;
201 void janus_sctp_association_destroy(janus_sctp_association *sctp);
207 void janus_sctp_data_from_dtls(janus_sctp_association *sctp,
char *buf,
int len);
216 void janus_sctp_send_data(janus_sctp_association *sctp,
char *label,
char *protocol, gboolean textdata,
char *buf,
int len);
Semaphors, Mutexes and Conditions.
GMutex janus_mutex
Janus mutex implementation.
Definition: mutex.h:73
Reference counter mechanism.
Janus DTLS-SRTP handle.
Definition: dtls.h:66
Janus ICE handle.
Definition: ice.h:354
guint64 handle_id
Handle identifier, guaranteed to be non-zero.
Definition: ice.h:358
Definition: refcount.h:78