summaryrefslogtreecommitdiff
path: root/tinyrtc.h
diff options
context:
space:
mode:
Diffstat (limited to 'tinyrtc.h')
-rw-r--r--tinyrtc.h74
1 files changed, 45 insertions, 29 deletions
diff --git a/tinyrtc.h b/tinyrtc.h
index 1d66b78..205ae1b 100644
--- a/tinyrtc.h
+++ b/tinyrtc.h
@@ -29,46 +29,62 @@
#ifndef TINYRTC_H
#define TINYRTC_H
-struct peerconn_t {
-};
+#define TRTC_MAX_ICE_CANDIDATE_SIZE 256
+#define TRTC_MAX_ICE_SERVER_CREDENTIAL_SIZE 128
+#define TRTC_MAX_ICE_SERVERS 2
+#define TRTC_MAX_ICE_SERVER_URL_SIZE 128
+#define TRTC_MAX_ICE_SERVER_URLS 3
+#define TRTC_MAX_ICE_SERVER_USERNAME_SIZE 128
+#define TRTC_MAX_ICE_CANDIDATE_USERNAME_FRAGMENT_SIZE 8
+#define TRTC_MAX_ICE_CANDIDATE_SDP_MID_SIZE 32
+#define TRTC_MAX_PEER_CONNECTIONS 5
+#define TRTC_MAX_SDP_SIZE 4096
+#define TRTC_MAX_ICE_UFRAG_SIZE 5
+#define TRTC_MAX_ICE_PWD_SIZE 32
-struct rtc_ice_server_t {
- char credential[128]; // XXX only password type supported
- char urls[3][128];
- char username[128];
-};
-struct configuration_t {
- struct rtc_ice_server_t ice_servers[3];
-};
+/// PRIVATE TYPE DEFINITIONS ///////////////////////////////////////////////
-struct ice_candidate_t {
- char candidate[256];
- int sdp_mline_index;
- char sdp_mid[32];
- char username_fragment[8];
-};
+struct trtc_peerconn_t;
-typedef int (on_ice_candidate_t)(const struct ice_candidate_t c, void *arg);
-struct peerconn_t* rtc_peer_connection(struct configuration_t cfg) {
- return 0;
-}
+/// PUBLIC TYPE DEFINITIONS ////////////////////////////////////////////////
-int add_ice_candidate(struct peerconn_t *pc, const struct ice_candidate_t c) {
- return -1;
+struct trtc_ice_server_t {
+ char credential[TRTC_MAX_ICE_SERVER_CREDENTIAL_SIZE];
+ char urls[3][TRTC_MAX_ICE_SERVER_URL_SIZE];
+ char username[TRTC_MAX_ICE_SERVER_USERNAME_SIZE];
};
-int create_answer(struct peerconn_t *pc) {
- return -1;
+struct trtc_config_t {
+ struct trtc_ice_server_t ice_servers[TRTC_MAX_ICE_SERVERS];
};
-int set_local_description(struct peerconn_t *pc, const char *sdp) {
- return -1;
+struct trtc_ice_candidate_t {
+ char candidate[TRTC_MAX_ICE_CANDIDATE_SIZE];
+ int sdp_mline_index;
+ char sdp_mid[TRTC_MAX_ICE_CANDIDATE_SDP_MID_SIZE];
+ char username_fragment[TRTC_MAX_ICE_CANDIDATE_USERNAME_FRAGMENT_SIZE];
};
-int set_remote_description(struct peerconn_t *pc, const char *sdp) {
- return -1;
-};
+
+/// CALLBACKS //////////////////////////////////////////////////////////////
+
+typedef int (trtc_on_ice_candidate_t)(const struct trtc_ice_candidate_t c, void *arg);
+
+
+/// RTC PEER CONNECTION API ////////////////////////////////////////////////
+
+struct trtc_peerconn_t* trtc_peer_connection(struct trtc_config_t cfg);
+
+int trtc_add_ice_candidate(struct trtc_peerconn_t *pc, const struct trtc_ice_candidate_t c);
+
+int trtc_add_track(struct trtc_peerconn_t *pc);
+
+const char * trtc_create_answer(struct trtc_peerconn_t *pc);
+
+int trtc_set_local_description(struct trtc_peerconn_t *pc, const char *sdp);
+
+int trtc_set_remote_description(struct trtc_peerconn_t *pc, const char *sdp);
#endif