adding control_ng stubs

git.mgm/mediaproxy-ng/2.2
Richard Fuchs 12 years ago
parent 189c19eb03
commit ab24a79de9

@ -26,7 +26,7 @@ CPPFLAGS+= `dpkg-buildflags --get CPPFLAGS`
LDFLAGS+= `dpkg-buildflags --get LDFLAGS`
SRCS= main.c kernel.c poller.c aux.c control.c streambuf.c call.c control_udp.c redis.c \
bencode.c cookie_cache.c udp_listener.c
bencode.c cookie_cache.c udp_listener.c control_ng.c
OBJS= $(SRCS:.c=.o)

@ -0,0 +1,30 @@
#include "control_ng.h"
#include "obj.h"
#include "poller.h"
#include "bencode.h"
static void control_ng_incoming(int fd, void *p, uintptr_t x) {
}
struct control_ng *control_ng_new(struct poller *p, struct in6_addr ip, u_int16_t port, struct callmaster *m) {
struct control_ng *c;
if (!p || !m)
return NULL;
c = obj_alloc0("control_ng", sizeof(*c), NULL);
c->callmaster = m;
cookie_cache_init(&c->cookie_cache);
if (udp_listener_init(&c->udp_listener, p, ip, port, control_ng_incoming, &c->obj))
goto fail2;
return c;
fail2:
obj_put(c);
return NULL;
}

@ -0,0 +1,22 @@
#ifndef _CONTROL_NG_H_
#define _CONTROL_NG_H_
#include "obj.h"
#include "cookie_cache.h"
#include "udp_listener.h"
struct poller;
struct callmaster;
struct control_ng {
struct obj obj;
struct callmaster *callmaster;
struct cookie_cache cookie_cache;
struct udp_listener udp_listener;
};
struct control_ng *control_ng_new(struct poller *, struct in6_addr, u_int16_t, struct callmaster *);
#endif

@ -12,6 +12,7 @@
#include "poller.h"
#include "control.h"
#include "control_udp.h"
#include "control_ng.h"
#include "aux.h"
#include "log.h"
#include "call.h"
@ -67,6 +68,8 @@ static u_int32_t listenp;
static u_int16_t listenport;
static struct in6_addr udp_listenp;
static u_int16_t udp_listenport;
static struct in6_addr ng_listenp;
static u_int16_t ng_listenport;
static int tos;
static int table;
static int no_fallback;
@ -198,16 +201,17 @@ fail:
static void options(int *argc, char ***argv) {
static char *ipv4s;
static char *adv_ipv4s;
static char *ipv6s;
static char *adv_ipv6s;
static char *listenps;
static char *listenudps;
static char *redisps;
static int version;
static GOptionEntry e[] = {
char *ipv4s;
char *adv_ipv4s;
char *ipv6s;
char *adv_ipv6s;
char *listenps;
char *listenudps;
char *listenngs;
char *redisps;
int version;
GOptionEntry e[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Print build time and exit", NULL },
{ "table", 't', 0, G_OPTION_ARG_INT, &table, "Kernel table to use", "INT" },
{ "no-fallback",'F', 0, G_OPTION_ARG_NONE, &no_fallback, "Only start when kernel module is available", NULL },
@ -217,6 +221,7 @@ static void options(int *argc, char ***argv) {
{ "advertised-ip6",'A',0,G_OPTION_ARG_STRING, &adv_ipv6s, "IPv6 address to advertise", "IP6" },
{ "listen-tcp", 'l', 0, G_OPTION_ARG_STRING, &listenps, "TCP port to listen on", "[IP:]PORT" },
{ "listen-udp", 'u', 0, G_OPTION_ARG_STRING, &listenudps, "UDP port to listen on", "[IP46:]PORT" },
{ "listen-ng", 'n', 0, G_OPTION_ARG_STRING, &listenngs, "UDP port to listen on, NG protocol", "[IP46:]PORT" },
{ "tos", 'T', 0, G_OPTION_ARG_INT, &tos, "TOS value to set on streams", "INT" },
{ "timeout", 'o', 0, G_OPTION_ARG_INT, &timeout, "RTP timeout", "SECS" },
{ "silent-timeout",'s',0,G_OPTION_ARG_INT, &silent_timeout,"RTP timeout for muted", "SECS" },
@ -243,8 +248,8 @@ static void options(int *argc, char ***argv) {
if (!ipv4s)
die("Missing option --ip\n");
if (!listenps && !listenudps)
die("Missing option --listen-tcp or --listen-udp\n");
if (!listenps && !listenudps && !listenngs)
die("Missing option --listen-tcp, --listen-udp or --listen-ng\n");
ipv4 = inet_addr(ipv4s);
if (ipv4 == -1)
@ -273,6 +278,10 @@ static void options(int *argc, char ***argv) {
if (parse_ip6_port(&udp_listenp, &udp_listenport, listenudps))
die("Invalid IP or port (--listen-udp)\n");
}
if (listenngs) {
if (parse_ip6_port(&ng_listenp, &ng_listenport, listenngs))
die("Invalid IP or port (--listen-ng)\n");
}
if (tos < 0 || tos > 255)
die("Invalid TOS value\n");
@ -364,6 +373,7 @@ void create_everything(struct main_context *ctx) {
struct callmaster_config mc;
struct control *c;
struct control_udp *cu;
struct control_ng *cn;
int kfd = -1;
void *dlh;
const char **strp;
@ -422,6 +432,13 @@ void create_everything(struct main_context *ctx) {
die("Failed to open UDP control connection port\n");
}
cn = NULL;
if (ng_listenport) {
cn = control_ng_new(ctx->p, ng_listenp, ng_listenport, ctx->m);
if (!cn)
die("Failed to open UDP control connection port\n");
}
if (redis_ip) {
dlh = dlopen(MP_PLUGIN_DIR "/mediaproxy-redis.so", RTLD_NOW | RTLD_GLOBAL);
if (!dlh && errno == ENOENT)

Loading…
Cancel
Save