diff options
author | Chris Hiszpanski <chris.hiszpanski@verkada.com> | 2022-05-22 01:36:30 -0700 |
---|---|---|
committer | Chris Hiszpanski <chris.hiszpanski@verkada.com> | 2022-05-22 01:36:30 -0700 |
commit | 8a4e7fabafd8d42b0b2cbdbd766bea49a62bfae1 (patch) | |
tree | c432758df4318d4370dd874b185888af67084655 /tinyrtc.h | |
parent | 97261b79b20e4e53ef3a5b7a37d1ffb0b5665bcb (diff) |
Added tcp host candidate
Diffstat (limited to 'tinyrtc.h')
-rw-r--r-- | tinyrtc.h | 46 |
1 files changed, 43 insertions, 3 deletions
@@ -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 |