From 10e22bd6f4ebc93e9467fec98a27585a34fcb5d8 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 22 Mar 2016 14:47:38 +0100 Subject: call: Introduce a structure for representing a call Right now a call has two legs, the initial one and the remote. In general this will allow a SIP to SIP, SIP to MNCC and MNCC to MNCC structure in the future. --- src/Makefile.am | 3 ++- src/call.c | 24 ++++++++++++++++++++++++ src/call.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/main.c | 2 ++ 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 src/call.c create mode 100644 src/call.h diff --git a/src/Makefile.am b/src/Makefile.am index 4052dea..0c04d50 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,9 +3,10 @@ bin_PROGRAMS = osmo-sip-connector AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(SOFIASIP_CFLAGS) noinst_HEADERS = \ - evpoll.h vty.h mncc_protocol.h app.h mncc.h sip.h + evpoll.h vty.h mncc_protocol.h app.h mncc.h sip.h call.h osmo_sip_connector_SOURCES = \ + call.c \ sip.c \ mncc.c \ evpoll.c \ diff --git a/src/call.c b/src/call.c new file mode 100644 index 0000000..464530f --- /dev/null +++ b/src/call.c @@ -0,0 +1,24 @@ +/* + * (C) 2016 by Holger Hans Peter Freyther + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +#include "call.h" + + +LLIST_HEAD(g_call_list); diff --git a/src/call.h b/src/call.h new file mode 100644 index 0000000..4e8e662 --- /dev/null +++ b/src/call.h @@ -0,0 +1,45 @@ +#pragma once + +#include + +struct sip_agent; +struct mncc_connection; + +struct call_leg; + +/** + * One instance of a call with two legs. The initial + * field will always be used by the entity that has + * launched the call. + */ +struct call { + struct llist_head entry; + + struct call_leg *initial; + struct call_leg *remote; +}; + +enum { + CALL_TYPE_NONE, + CALL_TYPE_SIP, + CALL_TYPE_MNCC, +}; + +struct call_leg { + int type; +}; + +struct sip_call_leg { + struct call_leg base; + + struct sip_agent *agent; +}; + +struct mncc_call_leg { + struct call_leg base; + + struct mncc_connection *conn; +}; + +extern struct llist_head g_call_list; +void calls_init(void); diff --git a/src/main.c b/src/main.c index d62e652..3e5e08a 100644 --- a/src/main.c +++ b/src/main.c @@ -25,6 +25,7 @@ #include "logging.h" #include "mncc.h" #include "app.h" +#include "call.h" #include #include @@ -147,6 +148,7 @@ int main(int argc, char **argv) exit(1); } + calls_init(); /* marry sofia-sip to glib and glib to libosmocore */ loop = g_main_loop_new(NULL, FALSE); -- cgit v1.2.3