Commit 265f911e authored by Slava Monich's avatar Slava Monich

[mms-engine] Move some functionality to libglibutil and libgofono

parent 01f165ad
......@@ -16,8 +16,9 @@ include ../mms-lib/Config.mak
# Required packages
#
PKGS = gio-unix-2.0 gio-2.0
LIB_PKGS = libwspcodec gmime-2.6 libsoup-2.4 dconf $(RESIZE_PKG) $(PKGS)
PKGS = gio-unix-2.0 gio-2.0 libglibutil
LIB_PKGS = libwspcodec gmime-2.6 libgofono libsoup-2.4 dconf
LIB_PKGS += $(RESIZE_PKG) $(PKGS)
#
# Default target
......
......@@ -286,6 +286,7 @@ int main(int argc, char* argv[])
int result = RET_ERR;
MMSAppOptions opt = {0};
mms_lib_init(argv[0]);
gofono_log.name = "mms-ofono";
mms_log_default.name = MMS_APP_LOG_PREFIX;
mms_lib_default_config(&opt.config);
mms_settings_sim_data_default(&opt.settings);
......
TEMPLATE = app
CONFIG += link_pkgconfig
PKGCONFIG += gmime-2.6 gio-unix-2.0 gio-2.0 glib-2.0 libsoup-2.4 dconf libwspcodec ImageMagick
PKGCONFIG += gmime-2.6 gio-unix-2.0 gio-2.0 glib-2.0 libsoup-2.4 dconf
PKGCONFIG += libwspcodec libgofono libglibutil
DBUS_INTERFACE_DIR = $$_PRO_FILE_PWD_
MMS_LIB_DIR = $$_PRO_FILE_PWD_/../mms-lib
MMS_OFONO_DIR = $$_PRO_FILE_PWD_/../mms-ofono
......
......@@ -3,7 +3,7 @@
.PHONY: clean all debug release
# Required packages
PKGS = glib-2.0 gio-2.0 gio-unix-2.0
PKGS = libglibutil glib-2.0 gio-2.0 gio-unix-2.0
#
# Default target
......
......@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG += staticlib
CONFIG -= qt
CONFIG += link_pkgconfig
PKGCONFIG += glib-2.0 gio-2.0 gio-unix-2.0
PKGCONFIG += libglibutil glib-2.0 gio-2.0 gio-unix-2.0
DBUS_SPEC_DIR = $$_PRO_FILE_PWD_/spec
INCLUDEPATH += include
INCLUDEPATH += ../mms-lib/include
......
......@@ -12,7 +12,7 @@ include Config.mak
# Required packages
#
PKGS = gmime-2.6 glib-2.0 libsoup-2.4 libwspcodec
PKGS = libglibutil libwspcodec gmime-2.6 libsoup-2.4 glib-2.0
#
# Default target
......@@ -36,7 +36,7 @@ SRC = \
mms_handler.c \
mms_lib_util.c \
mms_file_util.c \
mms_log.c mms_message.c \
mms_message.c \
mms_settings.c \
mms_task.c \
mms_task_ack.c \
......
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -30,25 +31,21 @@ typedef enum _MMS_CONNECTION_STATE {
MMS_CONNECTION_STATE_CLOSED /* Connection has been closed */
} MMS_CONNECTION_STATE;
/* Delegate (one per connection) */
typedef struct mms_connection_delegate MMSConnectionDelegate;
struct mms_connection_delegate {
void (*fn_connection_state_changed)(
MMSConnectionDelegate* delegate,
MMSConnection* connection);
};
typedef
void
(*MMSConnectionStateChangeFunc)(
MMSConnection* connection,
void* data);
/* Connection data. The delegate field may be changed by the client at
* any time. */
/* Connection object */
struct mms_connection {
GObject parent;
char* imsi;
char* mmsc;
char* mmsproxy;
char* netif;
const char* imsi;
const char* mmsc;
const char* mmsproxy;
const char* netif;
gboolean user_connection;
MMS_CONNECTION_STATE state;
MMSConnectionDelegate* delegate;
};
/* Connection class for implementation */
......@@ -59,6 +56,8 @@ typedef struct mms_connection_class {
GType mms_connection_get_type(void);
#define MMS_TYPE_CONNECTION (mms_connection_get_type())
#define MMS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
MMS_TYPE_CONNECTION, MMSConnection))
MMSConnection*
mms_connection_ref(
......@@ -76,6 +75,21 @@ MMS_CONNECTION_STATE
mms_connection_state(
MMSConnection* connection);
gulong
mms_connection_add_state_change_handler(
MMSConnection* connection,
MMSConnectionStateChangeFunc fn,
void* data);
void
mms_connection_signal_state_change(
MMSConnection* connection);
void
mms_connection_remove_handler(
MMSConnection* connection,
gulong id);
void
mms_connection_close(
MMSConnection* connection);
......
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -35,7 +36,7 @@
log(mms_connman_log)\
log(mms_connection_log)
MMS_LIB_LOG_MODULES(MMS_LOG_MODULE_DECL)
MMS_LIB_LOG_MODULES(GLOG_MODULE_DECL)
#endif /* JOLLA_MMS_LIB_LOG_H */
......
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -31,8 +32,9 @@
#include <fcntl.h>
#include <glib.h>
#include <glib-object.h>
#include <gutil_types.h>
typedef GLogModule MMSLogModule;
#ifndef O_BINARY
# define O_BINARY (0)
......@@ -56,7 +58,6 @@ typedef struct mms_settings MMSSettings;
typedef struct mms_settings_sim_data MMSSettingsSimData;
typedef struct mms_handler MMSHandler;
typedef struct mms_connman MMSConnMan;
typedef struct mms_log_module MMSLogModule;
typedef struct mms_dispatcher MMSDispatcher;
typedef struct mms_connection MMSConnection;
typedef struct mms_message MMSPdu;
......
This diff is collapsed.
TEMPLATE = lib
CONFIG += staticlib
CONFIG += link_pkgconfig
PKGCONFIG += gmime-2.6 glib-2.0 libsoup-2.4 libwspcodec
PKGCONFIG += libglibutil libwspcodec gmime-2.6 glib-2.0 libsoup-2.4
INCLUDEPATH += include
QMAKE_CFLAGS += -Wno-unused-parameter
......@@ -38,7 +38,6 @@ SOURCES += \
src/mms_handler.c \
src/mms_message.c \
src/mms_lib_util.c \
src/mms_log.c \
src/mms_settings.c \
src/mms_task.c \
src/mms_task_ack.c \
......
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -21,37 +22,75 @@
G_DEFINE_TYPE(MMSConnection, mms_connection, G_TYPE_OBJECT);
#define MMS_CONNECTION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), MMS_TYPE_CONNECTION, MMSConnectionClass))
#define MMS_CONNECTION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), MMS_TYPE_CONNECTION, MMSConnection))
enum mms_connection_signal {
SIGNAL_STATE_CHANGED,
SIGNAL_COUNT
};
#define SIGNAL_STATE_CHANGED_NAME "state-changed"
static guint mms_connection_signals[SIGNAL_COUNT] = { 0 };
MMSConnection*
mms_connection_ref(
MMSConnection* conn)
MMSConnection* self)
{
if (conn) g_object_ref(MMS_CONNECTION(conn));
return conn;
if (self) g_object_ref(MMS_CONNECTION(self));
return self;
}
void
mms_connection_unref(
MMSConnection* conn)
MMSConnection* self)
{
if (conn) g_object_unref(MMS_CONNECTION(conn));
if (self) g_object_unref(MMS_CONNECTION(self));
}
const char*
mms_connection_state_name(
MMSConnection* conn)
MMSConnection* self)
{
static const char* names[] = {"????","OPENING","FAILED","OPEN","CLOSED"};
return names[mms_connection_state(conn)];
return names[mms_connection_state(self)];
}
MMS_CONNECTION_STATE
mms_connection_state(
MMSConnection* conn)
MMSConnection* self)
{
return self ? self->state : MMS_CONNECTION_STATE_INVALID;
}
gulong
mms_connection_add_state_change_handler(
MMSConnection* self,
MMSConnectionStateChangeFunc fn,
void* data)
{
return conn ? conn->state : MMS_CONNECTION_STATE_INVALID;
return (self && fn) ? g_signal_connect(self,SIGNAL_STATE_CHANGED_NAME,
G_CALLBACK(fn), data) : 0;
}
void
mms_connection_signal_state_change(
MMSConnection* self)
{
if (self) {
mms_connection_ref(self);
g_signal_emit(self, mms_connection_signals[SIGNAL_STATE_CHANGED], 0);
mms_connection_unref(self);
}
}
void
mms_connection_remove_handler(
MMSConnection* self,
gulong id)
{
if (self && id) {
g_signal_handler_disconnect(self, id);
}
}
void
......@@ -62,44 +101,40 @@ mms_connection_close(
}
/**
* Final stage of deinitialization
* Per instance initializer
*/
static
void
mms_connection_finalize(
GObject* object)
mms_connection_init(
MMSConnection* self)
{
MMSConnection* conn = MMS_CONNECTION(object);
MMS_VERBOSE_("%p", conn);
MMS_ASSERT(!conn->delegate);
g_free(conn->imsi);
g_free(conn->mmsc);
g_free(conn->mmsproxy);
g_free(conn->netif);
G_OBJECT_CLASS(mms_connection_parent_class)->finalize(object);
MMS_VERBOSE_("%p", self);
}
/**
* Per class initializer
* Final stage of deinitialization
*/
static
void
mms_connection_class_init(
MMSConnectionClass* klass)
mms_connection_finalize(
GObject* object)
{
GObjectClass* object_class = G_OBJECT_CLASS(klass);
object_class->finalize = mms_connection_finalize;
MMS_VERBOSE_("%p", object);
G_OBJECT_CLASS(mms_connection_parent_class)->finalize(object);
}
/**
* Per instance initializer
* Per class initializer
*/
static
void
mms_connection_init(
MMSConnection* conn)
mms_connection_class_init(
MMSConnectionClass* klass)
{
MMS_VERBOSE_("%p", conn);
G_OBJECT_CLASS(klass)->finalize = mms_connection_finalize;
mms_connection_signals[SIGNAL_STATE_CHANGED] =
g_signal_new(SIGNAL_STATE_CHANGED_NAME, G_OBJECT_CLASS_TYPE(klass),
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
}
/*
......
......@@ -39,12 +39,12 @@ struct mms_dispatcher {
MMSHandler* handler;
MMSConnMan* cm;
MMSConnection* connection;
MMSConnectionDelegate connection_delegate;
MMSDispatcherDelegate* delegate;
GQueue* tasks;
guint next_run_id;
guint network_idle_id;
gulong handler_done_id;
gulong connection_changed_id;
gboolean started;
};
......@@ -57,9 +57,6 @@ typedef struct mms_dispatcher_idle_callback {
inline static MMSDispatcher*
mms_dispatcher_from_task_delegate(MMSTaskDelegate* delegate)
{ return MMS_CAST(delegate,MMSDispatcher,task_delegate); }
inline static MMSDispatcher*
mms_dispatcher_from_connection_delegate(MMSConnectionDelegate* delegate)
{ return MMS_CAST(delegate,MMSDispatcher,connection_delegate); }
static
void
......@@ -98,8 +95,10 @@ mms_dispatcher_drop_connection(
{
if (disp->connection) {
MMS_ASSERT(!mms_connection_is_active(disp->connection));
mms_connection_remove_handler(disp->connection,
disp->connection_changed_id);
disp->connection_changed_id = 0;
mms_connection_unref(disp->connection);
disp->connection->delegate = NULL;
disp->connection = NULL;
if (disp->network_idle_id) {
g_source_remove(disp->network_idle_id);
......@@ -242,9 +241,49 @@ mms_dispatcher_next_run_schedule(
mms_dispatcher_next_run);
}
/**
* Connection state callback
*/
static
void
mms_dispatcher_connection_state_changed(
MMSConnection* conn,
void* data)
{
MMSDispatcher* disp = data;
MMS_CONNECTION_STATE state = mms_connection_state(conn);
MMS_DEBUG("%s %s", conn->imsi, mms_connection_state_name(conn));
MMS_ASSERT(conn == disp->connection);
if (state == MMS_CONNECTION_STATE_FAILED ||
state == MMS_CONNECTION_STATE_CLOSED) {
GList* entry;
mms_dispatcher_close_connection(disp);
for (entry = disp->tasks->head; entry; entry = entry->next) {
MMSTask* task = entry->data;
switch (task->state) {
case MMS_TASK_STATE_NEED_CONNECTION:
case MMS_TASK_STATE_NEED_USER_CONNECTION:
case MMS_TASK_STATE_TRANSMITTING:
if (!strcmp(conn->imsi, task->imsi)) {
mms_task_network_unavailable(task, TRUE);
}
default:
break;
}
}
mms_dispatcher_drop_connection(disp);
mms_dispatcher_check_if_done(disp);
}
if (!disp->active_task) {
mms_dispatcher_next_run_schedule(disp);
}
}
/**
* Set the delegate that receives dispatcher notifications.
* One delegate per dispatcher.
*
* TODO: Replace this delegate stuff wuth glib signals
*/
void
mms_dispatcher_set_delegate(
......@@ -325,7 +364,10 @@ mms_dispatcher_pick_next_task(
disp->connection = mms_connman_open_connection(
disp->cm, task->imsi, FALSE);
if (disp->connection) {
disp->connection->delegate = &disp->connection_delegate;
MMS_ASSERT(!disp->connection_changed_id);
disp->connection_changed_id =
mms_connection_add_state_change_handler(disp->connection,
mms_dispatcher_connection_state_changed, disp);
g_queue_delete_link(disp->tasks, entry);
return task;
} else {
......@@ -583,44 +625,6 @@ mms_dispatcher_cancel(
}
}
/**
* Connection delegate callbacks
*/
static
void
mms_dispatcher_delegate_connection_state_changed(
MMSConnectionDelegate* delegate,
MMSConnection* conn)
{
MMSDispatcher* disp = mms_dispatcher_from_connection_delegate(delegate);
MMS_CONNECTION_STATE state = mms_connection_state(conn);
MMS_DEBUG("%s %s", conn->imsi, mms_connection_state_name(conn));
MMS_ASSERT(conn == disp->connection);
if (state == MMS_CONNECTION_STATE_FAILED ||
state == MMS_CONNECTION_STATE_CLOSED) {
GList* entry;
mms_dispatcher_close_connection(disp);
for (entry = disp->tasks->head; entry; entry = entry->next) {
MMSTask* task = entry->data;
switch (task->state) {
case MMS_TASK_STATE_NEED_CONNECTION:
case MMS_TASK_STATE_NEED_USER_CONNECTION:
case MMS_TASK_STATE_TRANSMITTING:
if (!strcmp(conn->imsi, task->imsi)) {
mms_task_network_unavailable(task, TRUE);
}
default:
break;
}
}
mms_dispatcher_drop_connection(disp);
mms_dispatcher_check_if_done(disp);
}
if (!disp->active_task) {
mms_dispatcher_next_run_schedule(disp);
}
}
/**
* Task delegate callbacks
*/
......@@ -683,8 +687,6 @@ mms_dispatcher_new(
mms_dispatcher_delegate_task_queue;
disp->task_delegate.fn_task_state_changed =
mms_dispatcher_delegate_task_state_changed;
disp->connection_delegate.fn_connection_state_changed =
mms_dispatcher_delegate_connection_state_changed;
disp->handler_done_id = mms_handler_add_done_callback(handler,
mms_dispatcher_handler_done, disp);
return disp;
......
This diff is collapsed.
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -21,7 +22,7 @@
#endif
/* Logging */
#define MMS_LOG_MODULE_NAME mms_task_log
#define MMS_LOG_MODULE_NAME MMS_TASK_LOG
#include "mms_lib_log.h"
MMS_LOG_MODULE_DEFINE("mms-task");
......
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -84,6 +85,7 @@ typedef struct mms_task_class {
} MMSTaskClass;
GType mms_task_get_type(void);
#define MMS_TASK_LOG mms_task_log
#define MMS_TYPE_TASK (mms_task_get_type())
#define MMS_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
MMS_TYPE_TASK, MMSTaskClass))
......
......@@ -23,7 +23,7 @@
/* Logging */
#define MMS_LOG_MODULE_NAME mms_task_decode_log
#include "mms_lib_log.h"
MMS_LOG_MODULE_DEFINE("mms-task-decode");
MMS_LOG_MODULE_DEFINE2("mms-task-decode", MMS_TASK_LOG);
/* Class definition */
typedef MMSTaskClass MMSTaskDecodeClass;
......
......@@ -28,7 +28,7 @@
#define MMS_LOG_MODULE_NAME mms_task_encode_log
#include "mms_lib_log.h"
#include "mms_error.h"
MMS_LOG_MODULE_DEFINE("mms-task-encode");
MMS_LOG_MODULE_DEFINE2("mms-task-encode", MMS_TASK_LOG);
/* Class definition */
typedef MMSTaskClass MMSTaskEncodeClass;
......
......@@ -30,9 +30,9 @@
#endif
/* Logging */
#define MMS_LOG_MODULE_NAME mms_task_http_log
#define MMS_LOG_MODULE_NAME MMS_TASK_HTTP_LOG
#include "mms_lib_log.h"
MMS_LOG_MODULE_DEFINE("mms-task-http");
MMS_LOG_MODULE_DEFINE2("mms-task-http", MMS_TASK_LOG);
/* HTTP task state */
typedef enum _mms_http_state {
......
......@@ -45,6 +45,7 @@ typedef struct mms_task_http_class {
} MMSTaskHttpClass;
GType mms_task_http_get_type(void);
#define MMS_TASK_HTTP_LOG mms_task_http_log
#define MMS_TYPE_TASK_HTTP (mms_task_http_get_type())
#define MMS_TASK_HTTP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
MMS_TYPE_TASK_HTTP, MMSTaskHttpClass))
......
......@@ -23,7 +23,7 @@
#define MMS_LOG_MODULE_NAME mms_task_notification_log
#include "mms_lib_log.h"
#include "mms_error.h"
MMS_LOG_MODULE_DEFINE("mms-task-notification");
MMS_LOG_MODULE_DEFINE2("mms-task-notification", MMS_TASK_LOG);
/* Class definition */
typedef MMSTaskClass MMSTaskNotificationClass;
......
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -18,7 +19,7 @@
/* Logging */
#define MMS_LOG_MODULE_NAME mms_task_publish_log
#include "mms_lib_log.h"
MMS_LOG_MODULE_DEFINE("mms-task-publish");
MMS_LOG_MODULE_DEFINE2("mms-task-publish", MMS_TASK_LOG);
/* Class definition */
typedef MMSTaskClass MMSTaskPublishClass;
......
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -22,7 +23,7 @@
#define MMS_LOG_MODULE_NAME mms_task_retrieve_log
#include "mms_lib_log.h"
#include "mms_error.h"
MMS_LOG_MODULE_DEFINE("mms-task-retrieve");
MMS_LOG_MODULE_DEFINE2("mms-task-retrieve", MMS_TASK_HTTP_LOG);
/* Class definition */
typedef MMSTaskHttpClass MMSTaskRetrieveClass;
......
......@@ -23,7 +23,7 @@
#define MMS_LOG_MODULE_NAME mms_task_send_log
#include "mms_lib_log.h"
#include "mms_error.h"
MMS_LOG_MODULE_DEFINE("mms-task-send");
MMS_LOG_MODULE_DEFINE2("mms-task-send", MMS_TASK_HTTP_LOG);
/* Class definition */
typedef MMSTaskHttpClass MMSTaskSendClass;
......
......@@ -4,7 +4,6 @@ all:
%:
@$(MAKE) -C test_media_type $*
@$(MAKE) -C test_mms_codec $*
@$(MAKE) -C test_mms_log $*
@$(MAKE) -C test_delivery_ind $*
@$(MAKE) -C test_read_ind $*
@$(MAKE) -C test_read_report $*
......
......@@ -25,7 +25,7 @@ include ../../Config.mak
# Required packages
#
PKGS += gmime-2.6 glib-2.0 libsoup-2.4
PKGS += gmime-2.6 glib-2.0 libsoup-2.4 libglibutil
LIB_PKGS += $(PKGS) libwspcodec $(RESIZE_PKG)
#
......
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -43,10 +44,7 @@ test_connection_test_state_change_cb(
test->state != MMS_CONNECTION_STATE_FAILED &&
test->state != change->state) {
test->state = change->state;
if (test->delegate &&
test->delegate->fn_connection_state_changed) {
test->delegate->fn_connection_state_changed(test->delegate, test);
}
mms_connection_signal_state_change(test);
}
mms_connection_unref(change->test);
g_free(change);
......
......@@ -3,7 +3,7 @@
# This script requires lcov to be installed
#
TESTS="test_media_type test_mms_codec test_mms_log test_delivery_ind \
TESTS="test_media_type test_mms_codec test_delivery_ind \
test_read_ind test_read_report test_resize test_retrieve \
test_retrieve_cancel test_retrieve_no_proxy test_send"
FLAVOR="release"
......
# -*- Mode: makefile-gmake -*-
EXE = test_mms_log
SRC = $(EXE).c
include ../common/Makefile
/*
* Copyright (C) 2014 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*
*/
#include "mms_log.h"
#define RET_OK (0)
#define RET_ERR (1)
typedef struct test_desc {
const char* name;
MMSLogModule** mods;
int nmods;
const int* results; /* nmods elements */
int default_level;
char** opts;
int nopts;
gboolean test_success;
} TestDesc;
const MMS_LOG_MODULE_DEFINE_(log_defaults,NULL);
/* Test1: default level + 2 modules */
MMS_LOG_MODULE_DEFINE_(mod1a, "test-a");
MMS_LOG_MODULE_DEFINE_(mod1b, "test-b");
static MMSLogModule* mods1[] = { &mod1a, &mod1b };