OpenTok C SDK
session.h
Go to the documentation of this file.
1 
7 #ifndef SESSION_H
8 #define SESSION_H
9 
10 #include "capabilities.h"
11 #include "config.h"
12 #include "publisher.h"
13 #include "subscriber.h"
14 #include "stream.h"
15 
16 OTC_BEGIN_DECL
17 
18 #ifdef DOXYGEN_OTC_SESSION_TYPEDEF
19 
21 typedef struct otc_session otc_session;
22 #endif
23 
24 #ifndef OTC_SESSION_FWD_DECL
25 #define OTC_SESSION_FWD_DECL
26 typedef struct otc_session otc_session;
27 #endif
28 
32 
33 #define ENCRYPTION_SECRET_MINIMUM_LENGTH 8
34 #define ENCRYPTION_SECRET_MAXIMUM_LENGTH 256
35 
42  1004,
44  1026,
47  1022,
49  1006,
51  1027,
54  1023,
57  1021,
61  1015,
65  2000,
67  1005,
69  1461,
71  1010,
74  1503,
76  1011,
78  1113,
82  1413,
85  1414,
90  1112,
94  2001,
96  6000,
98  6004,
100 };
101 
115 };
116 
126  char** ice_url;
127  char** ice_user;
129  char** ice_credential;
137 };
138 
159 };
160 
183  void (*on_connected)(otc_session* session, void* user_data);
184 
192  void (*on_disconnected)(otc_session* session, void* user_data);
193 
205  void* user_data,
206  const otc_connection* connection);
207 
219  void* user_data,
220  const otc_connection* connection);
221 
233  void (*on_stream_received)(otc_session* session,
234  void* user_data,
235  const otc_stream* stream);
236 
246  void (*on_stream_dropped)(otc_session* session,
247  void* user_data,
248  const otc_stream* stream);
262  void* user_data,
263  const otc_stream* stream,
264  otc_bool has_audio);
265 
277  void* user_data,
278  const otc_stream* stream,
279  otc_bool has_video);
293  void* user_data,
294  const otc_stream* stream,
295  otc_bool has_captions);
296 
309  void* user_data,
310  const otc_stream* stream,
311  int width,
312  int height);
313 
324  void* user_data,
325  const otc_stream* stream,
326  enum otc_stream_video_type type);
345  void (*on_signal_received)(otc_session* session,
346  void* user_data,
347  const char* type,
348  const char* signal,
349  const otc_connection* connection);
350 
360 
369  void (*on_reconnected)(otc_session* session, void* user_data);
370 
384  void (*on_archive_started)(otc_session* session,
385  void* user_data,
386  const char* archive_id,
387  const char* name);
388 
398  void (*on_archive_stopped)(otc_session* session,
399  void* user_data,
400  const char* archive_id);
412  void (*on_error)(otc_session* session,
413  void* user_data,
414  const char* error_string,
415  enum otc_session_error_code error);
416 
429  void (*on_mute_forced)(otc_session *session,
430  void *user_data,
431  otc_on_mute_forced_info *mute_info);
432 
436  void* user_data;
437 
442  void* reserved;
443 };
444 
467 OTC_DECL(otc_session*)
468 otc_session_new(const char* apikey,
469  const char* session_id,
470  const struct otc_session_callbacks* callbacks);
471 
497 
509 OTC_DECL(otc_status)
511  otc_session_settings* settings,
512  otc_bool suppress);
513 
519 OTC_DECL(otc_status)
521  otc_session_settings* settings,
522  const struct otc_custom_ice_config* custom_ice_config);
523 
529 OTC_DECL(otc_status)
531  const char* proxy_url);
532 
538 OTC_DECL(otc_status)
540  otc_bool ip_whitelist);
541 
557 OTC_DECL(otc_status)
559  otc_bool enable);
560 
564 OTC_DECL(otc_status)
566 
588 OTC_DECL(otc_session*)
589 otc_session_new_with_settings(const char* apikey,
590  const char* session_id,
591  const struct otc_session_callbacks* callbacks,
592  otc_session_settings* settings);
593 
599 OTC_DECL(otc_status) otc_session_delete(otc_session* session);
600 
613 OTC_DECL(otc_status)
614 otc_session_connect(otc_session* session, const char* token);
615 
630 OTC_DECL(otc_status) otc_session_disconnect(otc_session* session);
631 
643 OTC_DECL(otc_status)
644 otc_session_publish(otc_session* session, otc_publisher* publisher);
645 
657 OTC_DECL(otc_status)
658 otc_session_unpublish(otc_session* session, otc_publisher* publisher);
659 
672 OTC_DECL(otc_status)
673 otc_session_subscribe(otc_session* session, otc_subscriber* subscriber);
674 
687 OTC_DECL(otc_status)
688 otc_session_unsubscribe(otc_session* session, otc_subscriber* subscriber);
689 
707 OTC_DECL(otc_status)
709  const char* type,
710  const char* signal);
711 
747 OTC_DECL(otc_status)
749  const char** excluded_streams_ids,
750  const int excluded_streams_len);
751 
777 OTC_DECL(otc_status)
779 
780 
801 OTC_DECL(otc_status)
803  const char *stream_id_to_mute);
804 
805 
825 OTC_DECL(otc_status)
827  const char* type,
828  const char* signal,
829  const otc_connection* connection);
830 
850 OTC_DECL(otc_status)
852  const char* type,
853  const char* signal,
854  struct otc_signal_options signal_options);
855 
878 OTC_DECL(otc_status)
880  otc_session* session,
881  const char* type,
882  const char* signal,
883  const otc_connection* connection,
884  struct otc_signal_options signal_options);
885 
901 OTC_DECL(otc_status)
902 otc_session_report_issue(struct otc_session* session,
903  const char* issue_description,
904  char** issue_id);
905 
909 OTC_DECL(char*) otc_session_get_id(const otc_session* session);
910 
919 OTC_DECL(otc_connection*)
921 
932 OTC_DECL(struct otc_session_capabilities)
934 
944 OTC_DECL(void*) otc_session_get_user_data(const otc_session* session);
945 
960 OTC_DECL(otc_status)
961 otc_session_set_encryption_secret(otc_session* session, const char* secret);
962 
963 OTC_END_DECL
964 
965 #endif // SESSION_H
Definition: session.h:43
int otc_status
Definition: base.h:153
struct otc_publisher otc_publisher
Definition: publisher.h:29
Definition: session.h:84
char * otc_session_get_id(const otc_session *session)
otc_status otc_session_settings_set_custom_ice_config(otc_session_settings *settings, const struct otc_custom_ice_config *custom_ice_config)
void(* on_connected)(otc_session *session, void *user_data)
Definition: session.h:183
Definition: session.h:174
Definition: session.h:64
Definition: session.h:87
struct otc_subscriber otc_subscriber
Definition: subscriber.h:28
char ** ice_url
Definition: session.h:126
otc_status otc_session_settings_set_proxy_url(otc_session_settings *settings, const char *proxy_url)
OpenTok Subscriber.
void(* on_connection_dropped)(otc_session *session, void *user_data, const otc_connection *connection)
Definition: session.h:218
void(* on_signal_received)(otc_session *session, void *user_data, const char *type, const char *signal, const otc_connection *connection)
Definition: session.h:345
otc_session_error_code
Definition: session.h:40
void * user_data
Definition: session.h:436
otc_status otc_session_send_signal_to_connection(otc_session *session, const char *type, const char *signal, const otc_connection *connection)
Definition: session.h:46
Definition: session.h:60
Definition: session.h:68
otc_session_settings * otc_session_settings_new(void)
otc_status otc_session_settings_set_single_peer_connection(otc_session_settings *settings, otc_bool enable)
Enables or disables Single Peer Connection (SPC) for a session.
Definition: session.h:124
Audio/Video stream.
otc_status otc_session_disconnect(otc_session *session)
void(* on_stream_dropped)(otc_session *session, void *user_data, const otc_stream *stream)
Definition: session.h:246
otc_status otc_session_force_mute_all(otc_session *session, const char **excluded_streams_ids, const int excluded_streams_len)
otc_status otc_session_delete(otc_session *session)
struct otc_session otc_session
Definition: session.h:21
otc_status otc_session_connect(otc_session *session, const char *token)
otc_session * otc_session_new_with_settings(const char *apikey, const char *session_id, const struct otc_session_callbacks *callbacks, otc_session_settings *settings)
void(* on_connection_created)(otc_session *session, void *user_data, const otc_connection *connection)
Definition: session.h:204
Definition: session.h:81
otc_status otc_session_settings_delete(otc_session_settings *settings)
Definition: session.h:77
Definition: session.h:53
void * reserved
Definition: session.h:442
Definition: session.h:145
Definition: session.h:48
struct otc_stream otc_stream
Definition: stream.h:18
void(* on_disconnected)(otc_session *session, void *user_data)
Definition: session.h:192
void(* on_error)(otc_session *session, void *user_data, const char *error_string, enum otc_session_error_code error)
Definition: session.h:412
otc_bool force_turn
Definition: session.h:130
otc_status otc_session_settings_set_ip_whitelist(otc_session_settings *settings, otc_bool ip_whitelist)
void(* on_archive_started)(otc_session *session, void *user_data, const char *archive_id, const char *name)
Definition: session.h:384
Definition: session.h:106
Definition: base.h:133
Definition: session.h:73
Definition: session.h:66
void(* on_stream_video_type_changed)(otc_session *session, void *user_data, const otc_stream *stream, enum otc_stream_video_type type)
Definition: session.h:323
otc_status otc_session_disable_force_mute(otc_session *session)
void(* on_stream_received)(otc_session *session, void *user_data, const otc_stream *stream)
Definition: session.h:233
otc_stream_video_type
Definition: stream.h:24
Definition: session.h:89
Definition: session.h:56
otc_status otc_session_force_mute_stream(const otc_session *session, const char *stream_id_to_mute)
void(* on_reconnection_started)(otc_session *session, void *user_data)
Definition: session.h:359
struct otc_session_capabilities otc_session_get_capabilities(const otc_session *session)
Definition: session.h:70
struct otc_connection otc_connection
Definition: connection.h:19
otc_status otc_session_send_signal_with_options(otc_session *session, const char *type, const char *signal, struct otc_signal_options signal_options)
otc_status otc_session_subscribe(otc_session *session, otc_subscriber *subscriber)
struct otc_session_settings otc_session_settings
Definition: session.h:31
int otc_bool
Definition: base.h:127
Definition: session.h:41
void(* on_stream_has_audio_changed)(otc_session *session, void *user_data, const otc_stream *stream, otc_bool has_audio)
Definition: session.h:261
otc_status otc_session_set_encryption_secret(otc_session *session, const char *secret)
Sets the end-to-end encryption secret that will be used by all publishers and subscribers in the sess...
void(* on_reconnected)(otc_session *session, void *user_data)
Definition: session.h:369
OpenTok Publisher.
otc_status otc_session_send_signal(otc_session *session, const char *type, const char *signal)
otc_session * otc_session_new(const char *apikey, const char *session_id, const struct otc_session_callbacks *callbacks)
otc_status otc_session_unsubscribe(otc_session *session, otc_subscriber *subscriber)
otc_bool retry_after_reconnect
Definition: session.h:158
otc_status otc_session_settings_set_connection_events_suppressed(otc_session_settings *settings, otc_bool suppress)
void(* on_archive_stopped)(otc_session *session, void *user_data, const char *archive_id)
Definition: session.h:398
char ** ice_credential
Definition: session.h:129
otc_connection * otc_session_get_connection(const otc_session *session)
int num_ice_servers
Definition: session.h:125
char ** ice_user
Definition: session.h:127
otc_bool use_custom_turn_only
Definition: session.h:134
otc_bool force_mute
Definition: session.h:111
otc_bool publish
Definition: session.h:107
void(* on_stream_has_video_changed)(otc_session *session, void *user_data, const otc_stream *stream, otc_bool has_video)
Definition: session.h:276
otc_status otc_session_publish(otc_session *session, otc_publisher *publisher)
void * otc_session_get_user_data(const otc_session *session)
otc_status otc_session_unpublish(otc_session *session, otc_publisher *publisher)
void(* on_stream_video_dimensions_changed)(otc_session *session, void *user_data, const otc_stream *stream, int width, int height)
Definition: session.h:308
void(* on_stream_has_captions_changed)(otc_session *session, void *user_data, const otc_stream *stream, otc_bool has_captions)
Definition: session.h:292
void(* on_mute_forced)(otc_session *session, void *user_data, otc_on_mute_forced_info *mute_info)
Definition: session.h:429
otc_bool subscribe
Definition: session.h:109
otc_status otc_session_report_issue(struct otc_session *session, const char *issue_description, char **issue_id)
otc_status otc_session_send_signal_to_connection_with_options(otc_session *session, const char *type, const char *signal, const otc_connection *connection, struct otc_signal_options signal_options)