diff options
author | Chris Hiszpanski <chris@liburtc.org> | 2021-04-29 01:30:50 -0700 |
---|---|---|
committer | Chris Hiszpanski <chris@liburtc.org> | 2021-05-04 00:58:39 -0700 |
commit | 2745c093dca7105672fd540f9d060a0ef1a1ce69 (patch) | |
tree | 9a0ddb52056f85e48ae6c3ad168db5983c36c6e9 /src | |
parent | 79f4f70de1a6014d53b245b8069c833ce943f943 (diff) |
Adds signaling to demo
Adds simple HTTP/1.0 signaling to demo. Demo long-polls demo server
(demo.liburtc.org) for an offer and posts an answer. Similarily,
long-polls and posts candidates.
Diffstat (limited to 'src')
-rw-r--r-- | src/urtc.c | 10 | ||||
-rw-r--r-- | src/urtc.h | 12 |
2 files changed, 11 insertions, 11 deletions
@@ -425,20 +425,20 @@ int urtc_add_ice_candidate(struct peerconn *pc, const char *cand) { return -URTC_ERR_NOT_IMPLEMENTED; } -int urtc_create_answer(struct peerconn *pc, char **answer) { - return -URTC_ERR_NOT_IMPLEMENTED; +int urtc_create_answer(struct peerconn *pc, char *answer, size_t size) { + return sdp_serialize(answer, size, &pc->ldesc); } -int urtc_create_offer(struct peerconn *pc, char **offer) { +int urtc_create_offer(struct peerconn *pc, char *offer, size_t size) { return -URTC_ERR_NOT_IMPLEMENTED; } int urtc_set_remote_description(struct peerconn *pc, const char *desc) { - return -URTC_ERR_NOT_IMPLEMENTED; + return sdp_parse(&pc->rdesc, desc); } int urtc_set_local_description(struct peerconn *pc, const char *desc) { - return -URTC_ERR_NOT_IMPLEMENTED; + return sdp_parse(&pc->ldesc, desc); } void urtc_peerconn_destroy(struct peerconn *pc) { @@ -151,12 +151,12 @@ int urtc_add_ice_candidate(urtc_peerconn_t *pc, const char *cand); * Akin to `createAnswer` method of `RTCPeerConnection` in WebRTC JS API. * * \param pc Peer connection - * \param answer Pointer to string pointer pointing to generated answer. - * Memory internally managed (caller need not and must not free). + * \param answer Destination pointer for generated answer. + * \param size Bytes available at destination. * * \return 0 on success, negative on error. */ -int urtc_create_answer(urtc_peerconn_t *pc, char **answer); +int urtc_create_answer(urtc_peerconn_t *pc, char *answer, size_t size); /** * Creates a local description for an offering peer connection @@ -170,12 +170,12 @@ int urtc_create_answer(urtc_peerconn_t *pc, char **answer); * Akin to `createOffer` method of `RTCPeerConnection` in WebRTC JS API. * * \param pc Peer connection - * \param offer Pointer to string pointer pointing to generated offer. - * Memory interally managed (caller need no and must not free). + * \param offer Destination pointer for generated offer. + * \param size Bytes available at destination. * * \return 0 on success, negative on error. */ -int urtc_create_offer(urtc_peerconn_t *pc, char **offer); +int urtc_create_offer(urtc_peerconn_t *pc, char *offer, size_t size); /** * Sets local description for peer connection |