From 5ea5dcddfaf6263f424feb8c65f5c2627e5f5bb6 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 22 Jan 2013 15:47:23 -0500 Subject: [PATCH] call_offer()/answer stubs --- daemon/call.c | 17 +++++++++++++++++ daemon/call.h | 5 +++++ daemon/control_ng.c | 15 ++++++++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index ac2cb90d5..f864998bd 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -22,6 +22,7 @@ #include "streambuf.h" #include "redis.h" #include "xt_MEDIAPROXY.h" +#include "bencode.h" @@ -2113,3 +2114,19 @@ struct callstream *callstream_new(struct call *ca, int num) { return s; } + + +const char *call_offer(bencode_item_t *input, struct callmaster *m, bencode_item_t *output) { + const char *sdp; + int sdp_len; + + sdp = bencode_dictionary_get_string(input, "sdp", &sdp_len); + if (!sdp) + return "No SDP body in message"; + + return NULL; +} + +const char *call_answer(bencode_item_t *input, struct callmaster *m, bencode_item_t *output) { + return NULL; +} diff --git a/daemon/call.h b/daemon/call.h index 39cf86f5b..1dce0de3c 100644 --- a/daemon/call.h +++ b/daemon/call.h @@ -13,6 +13,7 @@ #include "control_udp.h" #include "obj.h" #include "aux.h" +#include "bencode.h" struct poller; struct control_stream; @@ -149,6 +150,10 @@ static inline char *call_strdup(struct call *c, const char *s) { return r; } +const char *call_offer(bencode_item_t *, struct callmaster *, bencode_item_t *); +const char *call_answer(bencode_item_t *, struct callmaster *, bencode_item_t *); + + #endif diff --git a/daemon/control_ng.c b/daemon/control_ng.c index 11caf0d38..4fdfba711 100644 --- a/daemon/control_ng.c +++ b/daemon/control_ng.c @@ -4,6 +4,7 @@ #include "bencode.h" #include "log.h" #include "cookie_cache.h" +#include "call.h" static void control_ng_incoming(struct obj *obj, char *buf, int buf_len, struct sockaddr_in6 *sin, char *addr) { @@ -38,7 +39,7 @@ static void control_ng_incoming(struct obj *obj, char *buf, int buf_len, struct reply = cookie_cache_lookup(&c->cookie_cache, cookie); if (reply) { mylog(LOG_INFO, "Detected command from %s:%u as a duplicate", addr, ntohs(sin->sin6_port)); - reply_len = strlen(reply); + reply_len = strlen(reply); /* XXX fails for embedded nulls */ resp = NULL; goto send_only; } @@ -55,12 +56,20 @@ static void control_ng_incoming(struct obj *obj, char *buf, int buf_len, struct mylog(LOG_INFO, "Got valid command from %s:%u: %.*s [%.*s]", addr, ntohs(sin->sin6_port), cmd_len, cmd, data_len, data); + errstr = NULL; if (!strmemcmp(cmd, cmd_len, "ping")) bencode_dictionary_add_string(resp, "result", "pong"); - else { + else if (!strmemcmp(cmd, cmd_len, "offer")) { + errstr = call_offer(dict, c->callmaster, resp); + } + else if (!strmemcmp(cmd, cmd_len, "answer")) { + errstr = call_answer(dict, c->callmaster, resp); + } + else errstr = "Unrecognized command"; + + if (errstr) goto err_send; - } goto send_out;