summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPekka Pessi <Pekka.Pessi@nokia.com>2011-02-02 19:52:11 +0200
committerPekka Pessi <Pekka.Pessi@nokia.com>2011-02-07 21:57:11 +0200
commit331154bb38f00852103bfcf5c95320ee1305f50f (patch)
tree335155fa6ca77ef555c77067be95d956c53ba611 /src
parent262656c55e4112d36005426cd5985df3c94a74f7 (diff)
Move src/debug to tpsip/debug
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/debug.c145
-rw-r--r--src/debug.h79
-rw-r--r--src/media-factory.c2
-rw-r--r--src/protocol.c2
-rw-r--r--src/sip-connection-helpers.c2
-rw-r--r--src/sip-connection-manager.c2
-rw-r--r--src/sip-connection.c2
-rw-r--r--src/sip-media-channel.c2
-rw-r--r--src/sip-media-session.c2
-rw-r--r--src/sip-media-stream.c2
-rw-r--r--src/sip-text-channel.c2
-rw-r--r--src/telepathy-sofiasip.c5
-rw-r--r--src/text-factory.c2
14 files changed, 13 insertions, 238 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a8c6c4e..0ec9a9d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -86,8 +86,6 @@ libtpsip_convenience_la_SOURCES = \
sip-connection.c \
sip-connection-manager.h \
sip-connection-manager.c \
- debug.h \
- debug.c \
media-factory.h \
media-factory.c \
protocol.h \
diff --git a/src/debug.c b/src/debug.c
deleted file mode 100644
index dc20fa5..0000000
--- a/src/debug.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * debug.h - Debug helpers for Telepathy-SofiaSIP, implementation
- * Copyright (C) 2007-2008 Nokia Corporation
- *
- * 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
- */
-
-#include "config.h"
-
-#ifdef ENABLE_DEBUG
-
-#include <stdarg.h>
-
-#include <glib.h>
-
-#include <telepathy-glib/debug.h>
-#include <telepathy-glib/debug-sender.h>
-
-#include "debug.h"
-
-static TpsipDebugFlags tpsip_debug_flags = 0;
-
-static const GDebugKey tpsip_debug_keys[] = {
- { "media-channel", TPSIP_DEBUG_MEDIA },
- { "connection", TPSIP_DEBUG_CONNECTION },
- { "im", TPSIP_DEBUG_IM },
- { "events", TPSIP_DEBUG_EVENTS },
- { "sofia", TPSIP_DEBUG_SOFIA },
-};
-
-void tpsip_debug_set_flags_from_env ()
-{
- const gchar *flags_string;
-
- flags_string = g_getenv ("TPSIP_DEBUG");
- if (flags_string == NULL)
- flags_string = g_getenv ("SOFIASIP_DEBUG");
-
- if (flags_string != NULL)
- {
- tp_debug_set_flags (flags_string);
-
- tpsip_debug_set_flags (g_parse_debug_string (flags_string,
- tpsip_debug_keys,
- G_N_ELEMENTS(tpsip_debug_keys)));
- }
-}
-
-void tpsip_debug_set_flags (TpsipDebugFlags new_flags)
-{
- tpsip_debug_flags |= new_flags;
-}
-
-gboolean tpsip_debug_flag_is_set (TpsipDebugFlags flag)
-{
- return (flag & tpsip_debug_flags) ? TRUE : FALSE;
-}
-
-static GHashTable *flag_to_domains = NULL;
-
-static const gchar *
-debug_flag_to_domain (TpsipDebugFlags flag)
-{
- if (G_UNLIKELY (flag_to_domains == NULL))
- {
- guint i;
-
- flag_to_domains = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL, g_free);
-
- for (i = 0; i < G_N_ELEMENTS(tpsip_debug_keys); i++)
- {
- GDebugKey key = (GDebugKey) tpsip_debug_keys[i];
- gchar *val;
-
- val = g_strdup_printf ("%s/%s", G_LOG_DOMAIN, key.key);
- g_hash_table_insert (flag_to_domains,
- GUINT_TO_POINTER (key.value), val);
- }
- }
-
- return g_hash_table_lookup (flag_to_domains, GUINT_TO_POINTER (flag));
-}
-
-void
-tpsip_debug_free (void)
-{
- if (flag_to_domains == NULL)
- return;
-
- g_hash_table_destroy (flag_to_domains);
- flag_to_domains = NULL;
-}
-
-static void
-log_to_debug_sender (TpsipDebugFlags flag,
- GLogLevelFlags level,
- const gchar *message)
-{
- TpDebugSender *dbg;
- GTimeVal now;
-
- dbg = tp_debug_sender_dup ();
-
- g_get_current_time (&now);
-
- tp_debug_sender_add_message (dbg, &now, debug_flag_to_domain (flag),
- level, message);
-
- g_object_unref (dbg);
-}
-
-void tpsip_log (TpsipDebugFlags flag,
- GLogLevelFlags level,
- const gchar *format,
- ...)
-{
- gchar *message;
- va_list args;
-
- va_start (args, format);
- message = g_strdup_vprintf (format, args);
- va_end (args);
-
- log_to_debug_sender (flag, level, message);
-
- if (flag & tpsip_debug_flags)
- g_log (G_LOG_DOMAIN, level, "%s", message);
-
- g_free (message);
-}
-
-#endif /* ENABLE_DEBUG */
diff --git a/src/debug.h b/src/debug.h
deleted file mode 100644
index 6e91e47..0000000
--- a/src/debug.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * debug.h - Debug helpers for Telepathy-SofiaSIP, headers
- * Copyright (C) 2007-2008 Nokia Corporation
- *
- * 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 __DEBUG_H__
-#define __DEBUG_H__
-
-#include "config.h"
-
-#ifdef ENABLE_DEBUG
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-typedef enum
-{
- TPSIP_DEBUG_CONNECTION = 1 << 0,
- TPSIP_DEBUG_MEDIA = 1 << 1,
- TPSIP_DEBUG_IM = 1 << 2,
- TPSIP_DEBUG_EVENTS = 1 << 3,
- TPSIP_DEBUG_SOFIA = 1 << 4,
-} TpsipDebugFlags;
-
-void tpsip_debug_set_flags_from_env ();
-void tpsip_debug_set_flags (TpsipDebugFlags flags);
-gboolean tpsip_debug_flag_is_set (TpsipDebugFlags flag);
-void tpsip_log (TpsipDebugFlags flag, GLogLevelFlags level,
- const gchar *format, ...) G_GNUC_PRINTF (3, 4);
-void tpsip_debug_free (void);
-
-G_END_DECLS
-
-#ifdef DEBUG_FLAG
-
-#define DEBUG(format, ...) \
- tpsip_log(DEBUG_FLAG, G_LOG_LEVEL_DEBUG, "%s: " format, \
- G_STRFUNC, ##__VA_ARGS__)
-#define WARNING(format, ...) \
- tpsip_log(DEBUG_FLAG, G_LOG_LEVEL_WARNING, "%s: " format, \
- G_STRFUNC, ##__VA_ARGS__)
-#define MESSAGE(format, ...) \
- tpsip_log(DEBUG_FLAG, G_LOG_LEVEL_MESSAGE, "%s: " format, \
- G_STRFUNC, ##__VA_ARGS__)
-
-/* #define DEBUGGING tpsip_debug_flag_is_set(DEBUG_FLAG) */
-
-#endif /* DEBUG_FLAG */
-
-#else /* ENABLE_DEBUG */
-
-#ifdef DEBUG_FLAG
-
-#define DEBUG(format, ...)
-#define WARNING(format, ...)
-#define MESSAGE(format, ...)
-
-#endif /* DEBUG_FLAG */
-
-#define tpsip_debug_free() G_STMT_START { } G_STMT_END
-
-#endif /* ENABLE_DEBUG */
-
-#endif /* __DEBUG_H__ */
diff --git a/src/media-factory.c b/src/media-factory.c
index 14e13b7..6f1d9ff 100644
--- a/src/media-factory.c
+++ b/src/media-factory.c
@@ -33,7 +33,7 @@
#include <sofia-sip/sip_status.h>
#define DEBUG_FLAG TPSIP_DEBUG_CONNECTION
-#include "debug.h"
+#include "tpsip/debug.h"
typedef enum {
TPSIP_MEDIA_CHANNEL_CREATE_WITH_AUDIO = 1 << 0,
diff --git a/src/protocol.c b/src/protocol.c
index df9a890..f4aa767 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -30,7 +30,7 @@
#include <sofia-sip/su_glib.h>
#define DEBUG_FLAG TPSIP_DEBUG_CONNECTION
-#include "debug.h"
+#include "tpsip/debug.h"
#include "media-factory.h"
#include "sip-connection.h"
#include "sip-connection-helpers.h"
diff --git a/src/sip-connection-helpers.c b/src/sip-connection-helpers.c
index da192eb..0761492 100644
--- a/src/sip-connection-helpers.c
+++ b/src/sip-connection-helpers.c
@@ -42,7 +42,7 @@
#include "sip-connection-private.h"
#define DEBUG_FLAG TPSIP_DEBUG_CONNECTION
-#include "debug.h"
+#include "tpsip/debug.h"
/* Default keepalive timeout in seconds,
* a value obtained from Sofia-SIP documentation */
diff --git a/src/sip-connection-manager.c b/src/sip-connection-manager.c
index ecb882e..cf8e954 100644
--- a/src/sip-connection-manager.c
+++ b/src/sip-connection-manager.c
@@ -43,7 +43,7 @@
#include "sip-connection.h"
#define DEBUG_FLAG TPSIP_DEBUG_CONNECTION
-#include "debug.h"
+#include "tpsip/debug.h"
G_DEFINE_TYPE(TpsipConnectionManager, tpsip_connection_manager,
diff --git a/src/sip-connection.c b/src/sip-connection.c
index 2751a44..866aba7 100644
--- a/src/sip-connection.c
+++ b/src/sip-connection.c
@@ -50,7 +50,7 @@
#include <sofia-sip/msg_header.h>
#define DEBUG_FLAG TPSIP_DEBUG_CONNECTION
-#include "debug.h"
+#include "tpsip/debug.h"
G_DEFINE_TYPE_WITH_CODE (TpsipConnection, tpsip_connection,
TPSIP_TYPE_BASE_CONNECTION,
diff --git a/src/sip-media-channel.c b/src/sip-media-channel.c
index cf07564..66b3970 100644
--- a/src/sip-media-channel.c
+++ b/src/sip-media-channel.c
@@ -38,7 +38,7 @@
#include <tpsip/event-target.h>
#define DEBUG_FLAG TPSIP_DEBUG_MEDIA
-#include "debug.h"
+#include "tpsip/debug.h"
#include <tpsip/base-connection.h>
diff --git a/src/sip-media-session.c b/src/sip-media-session.c
index 988a990..3808f53 100644
--- a/src/sip-media-session.c
+++ b/src/sip-media-session.c
@@ -46,7 +46,7 @@
#include "signals-marshal.h"
#define DEBUG_FLAG TPSIP_DEBUG_MEDIA
-#include "debug.h"
+#include "tpsip/debug.h"
/* The timeout for outstanding re-INVITE transactions in seconds.
* Chosen to match the allowed cancellation timeout for proxies
diff --git a/src/sip-media-stream.c b/src/sip-media-stream.c
index d3826bb..f87e502 100644
--- a/src/sip-media-stream.c
+++ b/src/sip-media-stream.c
@@ -48,7 +48,7 @@
#include "signals-marshal.h"
#define DEBUG_FLAG TPSIP_DEBUG_MEDIA
-#include "debug.h"
+#include "tpsip/debug.h"
#define same_boolean(old, new) ((!(old)) == (!(new)))
diff --git a/src/sip-text-channel.c b/src/sip-text-channel.c
index 71be195..f55f597 100644
--- a/src/sip-text-channel.c
+++ b/src/sip-text-channel.c
@@ -45,7 +45,7 @@
#include <sofia-sip/sip_status.h>
#define DEBUG_FLAG TPSIP_DEBUG_IM
-#include "debug.h"
+#include "tpsip/debug.h"
static gboolean
tpsip_text_channel_nua_r_message_cb (TpsipTextChannel *self,
diff --git a/src/telepathy-sofiasip.c b/src/telepathy-sofiasip.c
index a19b752..dfdf5e8 100644
--- a/src/telepathy-sofiasip.c
+++ b/src/telepathy-sofiasip.c
@@ -24,8 +24,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <config.h>
-#include "debug.h"
+#include "config.h"
+
+#include "tpsip/debug.h"
#include "sip-connection-manager.h"
#include <telepathy-glib/run.h>
diff --git a/src/text-factory.c b/src/text-factory.c
index 4b8d0b3..04d0e68 100644
--- a/src/text-factory.c
+++ b/src/text-factory.c
@@ -35,7 +35,7 @@
#include <sofia-sip/sip_status.h>
#define DEBUG_FLAG TPSIP_DEBUG_IM
-#include "debug.h"
+#include "tpsip/debug.h"
static void channel_manager_iface_init (gpointer g_iface, gpointer iface_data);