summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Pessi <Pekka.Pessi@nokia.com>2011-02-01 01:46:18 +0200
committerPekka Pessi <Pekka.Pessi@nokia.com>2011-02-02 17:22:06 +0200
commit5544102fb3ecfca6d77b0ba049169cc60052c82b (patch)
tree10db1f3114063f9308986c8a3200d16093a107fc
parent2ac200c8e3e4a0e573b2ffda6e5de834bf56c8c9 (diff)
tpsip-base-connection: add nua callback
Move the nua callback module src/sip-connection-sofia.c to tpsip/base-connection-sofia.c, using the new callback from sip-connection.c.
-rw-r--r--src/Makefile.am4
-rw-r--r--src/sip-connection-sofia.h48
-rw-r--r--src/sip-connection.c5
-rw-r--r--tpsip/Makefile.am1
-rw-r--r--tpsip/base-connection-sofia.c (renamed from src/sip-connection-sofia.c)23
-rw-r--r--tpsip/base-connection.h9
-rw-r--r--tpsip/sofia-decls.h4
7 files changed, 27 insertions, 67 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index ca15a87..82dce7f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -98,9 +98,7 @@ libtpsip_convenience_la_SOURCES = \
text-factory.c \
sip-connection-helpers.h \
sip-connection-helpers.c \
- sip-connection-private.h \
- sip-connection-sofia.h \
- sip-connection-sofia.c
+ sip-connection-private.h
nodist_libtpsip_convenience_la_SOURCES = \
$(BUILT_SOURCES)
diff --git a/src/sip-connection-sofia.h b/src/sip-connection-sofia.h
deleted file mode 100644
index a56b1cb..0000000
--- a/src/sip-connection-sofia.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * sip-connection-sofia.h - Header for TpsipConnection Sofia event handling
- * Copyright (C) 2006-2008 Nokia Corporation
- * @author Kai Vehmanen <first.surname@nokia.com>
- * @author Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
- *
- * This work is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This work 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this work; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __TPSIP_CONNECTION_SOFIA_H__
-#define __TPSIP_CONNECTION_SOFIA_H__
-
-#include <tpsip/sofia-decls.h>
-#include <tpsip/event-target.h>
-#include "sip-connection.h"
-
-G_BEGIN_DECLS
-
-/**
- * Callback for events delivered by the SIP stack.
- *
- * See libsofia-sip-ua/nua/nua.h documentation.
- */
-void tpsip_connection_sofia_callback (nua_event_t event,
- int status,
- char const *phrase,
- nua_t *nua,
- TpsipConnection *conn,
- nua_handle_t *nh,
- TpsipEventTarget *target,
- sip_t const *sip,
- tagi_t tags[]);
-
-G_END_DECLS
-
-#endif /* #ifndef __TPSIP_CONNECTION_SOFIA_H__*/
diff --git a/src/sip-connection.c b/src/sip-connection.c
index 4be3340..95de79d 100644
--- a/src/sip-connection.c
+++ b/src/sip-connection.c
@@ -46,7 +46,6 @@
#include "sip-connection-enumtypes.h"
#include "sip-connection-helpers.h"
#include "sip-connection-private.h"
-#include "sip-connection-sofia.h"
#include <sofia-sip/msg_header.h>
@@ -1051,8 +1050,8 @@ tpsip_connection_start_connecting (TpBaseConnection *base,
/* step: create stack instance */
priv->sofia_nua = nua_create (root,
- tpsip_connection_sofia_callback,
- self,
+ tpsip_base_connection_sofia_callback,
+ TPSIP_BASE_CONNECTION (self),
SOATAG_AF(SOA_AF_IP4_IP6),
SIPTAG_FROM_STR(sip_address),
NUTAG_URL(local_url),
diff --git a/tpsip/Makefile.am b/tpsip/Makefile.am
index 6312f83..da8fb28 100644
--- a/tpsip/Makefile.am
+++ b/tpsip/Makefile.am
@@ -29,6 +29,7 @@ BUILT_SOURCES = \
libtpsip_la_SOURCES = \
base-connection.c \
+ base-connection-sofia.c \
codec-param-formats.c \
event-target.c \
handles.c \
diff --git a/src/sip-connection-sofia.c b/tpsip/base-connection-sofia.c
index 29772fe..4c04eae 100644
--- a/src/sip-connection-sofia.c
+++ b/tpsip/base-connection-sofia.c
@@ -20,12 +20,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "sip-connection-sofia.h"
+#include "config.h"
+#include <tpsip/base-connection.h>
#include <sofia-sip/su_tag_io.h>
#define DEBUG_FLAG TPSIP_DEBUG_EVENTS
-#include "debug.h"
+#include "src/debug.h"
static void
priv_r_shutdown(int status,
@@ -104,15 +105,15 @@ priv_r_get_params (int status,
* See libsofia-sip-ua/nua/nua.h documentation.
*/
void
-tpsip_connection_sofia_callback (nua_event_t event,
- int status,
- char const *phrase,
- nua_t *nua,
- TpsipConnection *conn,
- nua_handle_t *nh,
- TpsipEventTarget *target,
- sip_t const *sip,
- tagi_t tags[])
+tpsip_base_connection_sofia_callback (nua_event_t event,
+ int status,
+ char const *phrase,
+ nua_t *nua,
+ TpsipBaseConnection *conn,
+ nua_handle_t *nh,
+ TpsipEventTarget *target,
+ sip_t const *sip,
+ tagi_t tags[])
{
DEBUG("event %s: %03d %s",
nua_event_name (event), status, phrase);
diff --git a/tpsip/base-connection.h b/tpsip/base-connection.h
index ed693a8..b444aa2 100644
--- a/tpsip/base-connection.h
+++ b/tpsip/base-connection.h
@@ -26,6 +26,7 @@
#include <telepathy-glib/base-connection.h>
#include <telepathy-glib/contacts-mixin.h>
+#include <tpsip/sofia-decls.h>
#include <tpsip/event-target.h>
G_BEGIN_DECLS
@@ -78,6 +79,14 @@ void tpsip_base_connection_add_auth_handler (TpsipBaseConnection *self,
void tpsip_base_connection_save_event (TpsipBaseConnection *self,
nua_saved_event_t ret_saved [1]);
+/** Callback for events delivered by the SIP stack. */
+void tpsip_base_connection_sofia_callback (nua_event_t event,
+ int status, char const *phrase,
+ nua_t *nua, TpsipBaseConnection *conn,
+ nua_handle_t *nh, TpsipEventTarget *target,
+ sip_t const *sip,
+ tagi_t tags[]);
+
G_END_DECLS
#endif /* #ifndef __TPSIP_BASE_CONNECTION_H__*/
diff --git a/tpsip/sofia-decls.h b/tpsip/sofia-decls.h
index 62197d6..d58b3fe 100644
--- a/tpsip/sofia-decls.h
+++ b/tpsip/sofia-decls.h
@@ -33,10 +33,10 @@
* pointing to an event target object attached to this handle.
*/
-#define NUA_MAGIC_T struct _TpsipConnection
+#define NUA_MAGIC_T struct _TpsipBaseConnection
#define NUA_HMAGIC_T struct _TpsipEventTarget
#define SU_ROOT_MAGIC_T struct _TpsipConnectionManager
-#define SU_TIMER_ARG_T struct _TpsipConnection
+#define SU_TIMER_ARG_T struct _TpsipBaseConnection
#define SU_WAKEUP_ARG_T void
#define TPSIP_DEFAULT_STUN_PORT 3478