Browse Source

call_offer()/answer stubs

git.mgm/mediaproxy-ng/2.2
Richard Fuchs 13 years ago
parent
commit
5ea5dcddfa
3 changed files with 34 additions and 3 deletions
  1. +17
    -0
      daemon/call.c
  2. +5
    -0
      daemon/call.h
  3. +12
    -3
      daemon/control_ng.c

+ 17
- 0
daemon/call.c View File

@ -22,6 +22,7 @@
#include "streambuf.h" #include "streambuf.h"
#include "redis.h" #include "redis.h"
#include "xt_MEDIAPROXY.h" #include "xt_MEDIAPROXY.h"
#include "bencode.h"
@ -2113,3 +2114,19 @@ struct callstream *callstream_new(struct call *ca, int num) {
return s; 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;
}

+ 5
- 0
daemon/call.h View File

@ -13,6 +13,7 @@
#include "control_udp.h" #include "control_udp.h"
#include "obj.h" #include "obj.h"
#include "aux.h" #include "aux.h"
#include "bencode.h"
struct poller; struct poller;
struct control_stream; struct control_stream;
@ -149,6 +150,10 @@ static inline char *call_strdup(struct call *c, const char *s) {
return r; 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 #endif

+ 12
- 3
daemon/control_ng.c View File

@ -4,6 +4,7 @@
#include "bencode.h" #include "bencode.h"
#include "log.h" #include "log.h"
#include "cookie_cache.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) { 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); reply = cookie_cache_lookup(&c->cookie_cache, cookie);
if (reply) { if (reply) {
mylog(LOG_INFO, "Detected command from %s:%u as a duplicate", addr, ntohs(sin->sin6_port)); 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; resp = NULL;
goto send_only; 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); 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")) if (!strmemcmp(cmd, cmd_len, "ping"))
bencode_dictionary_add_string(resp, "result", "pong"); 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"; errstr = "Unrecognized command";
if (errstr)
goto err_send; goto err_send;
}
goto send_out; goto send_out;


Loading…
Cancel
Save