summaryrefslogtreecommitdiff
path: root/tinyrtc.h
diff options
context:
space:
mode:
authorChris Hiszpanski <chris.hiszpanski@verkada.com>2022-05-22 01:36:30 -0700
committerChris Hiszpanski <chris.hiszpanski@verkada.com>2022-05-22 01:36:30 -0700
commit8a4e7fabafd8d42b0b2cbdbd766bea49a62bfae1 (patch)
treec432758df4318d4370dd874b185888af67084655 /tinyrtc.h
parent97261b79b20e4e53ef3a5b7a37d1ffb0b5665bcb (diff)
Added tcp host candidate
Diffstat (limited to 'tinyrtc.h')
-rw-r--r--tinyrtc.h46
1 files changed, 43 insertions, 3 deletions
diff --git a/tinyrtc.h b/tinyrtc.h
index 205ae1b..ff29e15 100644
--- a/tinyrtc.h
+++ b/tinyrtc.h
@@ -70,21 +70,61 @@ struct trtc_ice_candidate_t {
/// CALLBACKS //////////////////////////////////////////////////////////////
-typedef int (trtc_on_ice_candidate_t)(const struct trtc_ice_candidate_t c, void *arg);
+typedef void (trtc_on_ice_candidate_t)(const struct trtc_ice_candidate_t c, void *arg);
/// RTC PEER CONNECTION API ////////////////////////////////////////////////
+/**
+ * Initialize library. Must call once before calling other functions.
+ */
+void trtc_init();
+
+/**
+ * Create new peer connection
+ *
+ * \param cfg[in] Configuration.
+ *
+ * \return Peer connection. NULL if all peer connections are already in use.
+ */
struct trtc_peerconn_t* trtc_peer_connection(struct trtc_config_t cfg);
+void trtc_peer_connection_destroy(struct trtc_peerconn_t* pc);
-int trtc_add_ice_candidate(struct trtc_peerconn_t *pc, const struct trtc_ice_candidate_t c);
+/**
+ * Adds remote ICE candidate to local ICE agent
+ *
+ * \param pc[in] Peer connection.
+ * \param c[in] ICE candidate from remote peer.
+ *
+ * \return 0 on success. -1 on error.
+ */
+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);
+/**
+ * Create SDP answer in response to a received SDP offer.
+ *
+ * \param pc[in] Peer connection.
+ *
+ * \return SDP answer. NULL on error.
+ */
const char * trtc_create_answer(struct trtc_peerconn_t *pc);
-int trtc_set_local_description(struct trtc_peerconn_t *pc, const char *sdp);
+/**
+ * Sets callback to call for each discovered local ICE candidate
+ *
+ * \param pc[in] Peer connection.
+ * \param cb[in] Callback function.
+ * \param arg[in] User-specified argument to pass to callback function.
+ *
+ * \return 0 on success. -1 on error.
+ */
+int trtc_set_on_ice_candidate(
+ struct trtc_peerconn_t* pc, trtc_on_ice_candidate_t* cb, void* arg);
+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