From 30973cf9e5b779333142fa84574964996478888d Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Thu, 4 Sep 2008 17:20:42 +0000 Subject: [PATCH] *** empty log message *** --- mbuni/ChangeLog | 1 + mbuni/extras/pgsql-queue/mms_pgsql_queue.c | 36 ++--- mbuni/mmlib/Makefile.am | 4 +- mbuni/mmlib/mms_cfg.c | 16 +-- mbuni/mmlib/mms_cfg.def | 5 + mbuni/mmlib/mms_eventlogger.c | 146 +++++++++++++++++++++ mbuni/mmlib/mms_eventlogger.h | 51 +++++++ mbuni/mmlib/mms_mm7soap.c | 2 +- mbuni/mmlib/mms_mmbox.c | 30 ++--- mbuni/mmlib/mms_msg.c | 56 ++++---- mbuni/mmlib/mms_queue.c | 40 +++--- mbuni/mmlib/mms_uaprof.c | 16 +-- mbuni/mmlib/mms_util.c | 16 +-- mbuni/mmlib/mms_util.h | 1 + mbuni/mmsbox/bearerbox.c | 26 ++-- mbuni/mmsbox/dlr.c | 4 +- mbuni/mmsbox/mmsbox.c | 26 ++-- mbuni/mmsbox/mmsbox_cfg.c | 58 ++++---- mbuni/mmsc/mms_detokenize_shell.c | 6 +- mbuni/mmsc/mmsc.c | 12 +- mbuni/mmsc/mmsc_cfg.c | 27 ++-- mbuni/mmsc/mmsfromemail.c | 38 +++--- mbuni/mmsc/mmsglobalsender.c | 22 ++-- mbuni/mmsc/mmsmobilesender.c | 26 ++-- mbuni/mmsc/mmsproxy.c | 68 +++++----- mbuni/mmsc/mmsrelay.c | 14 +- mbuni/mmsc/mmssend.c | 6 +- 27 files changed, 486 insertions(+), 267 deletions(-) create mode 100644 mbuni/mmlib/mms_eventlogger.c create mode 100644 mbuni/mmlib/mms_eventlogger.h diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index 416c930..8f61609 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,5 +1,6 @@ 2008-09-04 P. A. Bagyenda * Minor fix/addition for Content-ID handling + * Generalised event logger module (to facilitate alarms, etc) 2008-09-02 P. A. Bagyenda * Added admin interface to mmsbox (can now start/stop and see status of any mmsc connection) 2008-09-01 P. A. Bagyenda diff --git a/mbuni/extras/pgsql-queue/mms_pgsql_queue.c b/mbuni/extras/pgsql-queue/mms_pgsql_queue.c index 94600be..9f3f889 100644 --- a/mbuni/extras/pgsql-queue/mms_pgsql_queue.c +++ b/mbuni/extras/pgsql-queue/mms_pgsql_queue.c @@ -35,7 +35,7 @@ static int pgq_init_module(Octstr *conninfo, int max_threads) if (n <= 0) n = DEFAULT_CONNECTIONS; - info(0, "pgsql_queue_init: Number of DB connections set to %d", (int)n); + mms_info(0, "pgsql_queue", NULL, "init: Number of DB connections set to %d", (int)n); free_conns = gwlist_create(); gwlist_add_producer(free_conns); for (i = 0; iattempts = num_attempts; if (mms_validate_address(e->from) != 0) { - warning(0, "mms_queueread: Mal-formed address [%s] in queue entry %s/%s! " + mms_warning(0, "pgsql_queue", NULL, "mms_queueread: Mal-formed address [%s] in queue entry %s/%s! " "Attempting fixup.", octstr_get_cstr(e->from), mms_queuedir, qf); _mms_fixup_address(&e->from, NULL,NULL,1); } @@ -328,7 +328,7 @@ static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int sho octstr_destroy(t); if (e->msgtype < 0) { e->msgtype = 0; - error(0, "mms_queueread: Unknown MMS message type (%s) in queue entry %s/%s, skipped!\n", + mms_error(0, "pgsql_queue", NULL, "mms_queueread: Unknown MMS message type (%s) in queue entry %s/%s, skipped!\n", res, mms_queuedir, qf); } break; @@ -342,7 +342,7 @@ static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int sho case 'Z': t = octstr_create(res); if (mms_validate_address(t) != 0) { - warning(0, "mms_queueread: Mal-formed address [%s] in queue entry %s/%s! " + mms_warning(0, "pgsql_queue", NULL, "mms_queueread: Mal-formed address [%s] in queue entry %s/%s! " "Attempting fixup.", res, mms_queuedir, qf); _mms_fixup_address(&t, NULL,NULL,1); } @@ -397,7 +397,7 @@ static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int sho if (e->hdrs == NULL) e->hdrs = http_create_empty_headers(); if ((ptmp = index(res, ':')) == NULL) - error(0, "Incorrectly formatted line header [id=%ld] in queue file %s/%s!", + mms_error(0, "pgsql_queue", NULL, "Incorrectly formatted header [id=%ld] in queue entry %s/%s!", hid, mms_queuedir, qf); else { char *value = ptmp + 1; @@ -409,7 +409,7 @@ static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int sho } break; default: - error(0, "Unknown QF header %c in file %s/%s, skipped!", item[0], mms_queuedir, qf); + mms_error(0, "pgsql_queue", NULL, "Unknown QF header %c in entry %s/%s, skipped!", item[0], mms_queuedir, qf); break; } } @@ -490,7 +490,7 @@ static int writeenvelope(MmsEnvelope *e, int newenv) r = PQexec(qfs->conn, cmd); if (PQresultStatus(r) != PGRES_COMMAND_OK) - error(0, "pgwriteenvelope: Failed to update queue entry %s in %s: %s", + mms_error(0, "pgsql_queue", NULL, "pgwriteenvelope: Failed to update queue entry %s in %s: %s", e->xqfname, qfs->dir, PQresultErrorMessage(r)); PQclear(r); @@ -498,7 +498,7 @@ static int writeenvelope(MmsEnvelope *e, int newenv) /* then the rest... */ s = (char *)mms_message_type_to_cstr(e->msgtype); if (!s) { - error(0, "mms_queuewrite: Unknown MMS message type %d! Skipped\n", e->msgtype); + mms_error(0, "pgsql_queue", NULL, "mms_queuewrite: Unknown MMS message type %d! Skipped\n", e->msgtype); s = ""; } _puthdr(qfs->conn, qfs->qid, "T", s); @@ -670,7 +670,7 @@ static Octstr *pgq_queue_add(Octstr *from, List *to, if (PQresultStatus(r) != PGRES_COMMAND_OK) { - error(0, "mms_queue_add: Failed to add data for queue entry %s in %s: %s", + mms_error(0, "pgsql_queue", NULL, "mms_queue_add: Failed to add data for queue entry %s in %s: %s", e->xqfname, qfs->dir, PQresultErrorMessage(r)); PQclear(r); @@ -774,7 +774,7 @@ static MmsMsg *pgq_queue_getdata(MmsEnvelope *e) if (PQresultStatus(r) != PGRES_TUPLES_OK || (n = PQntuples(r)) < 1) { PQclear(r); - error(0, "mms_queue_getdata: Failed to load data for queue entry %s in %s", + mms_error(0, "pgsql_queue", NULL, "mms_queue_getdata: Failed to load data for queue entry %s in %s", e->xqfname, qfs->dir); return NULL; } @@ -791,14 +791,14 @@ static MmsMsg *pgq_queue_getdata(MmsEnvelope *e) PQclear(r); if (ms == NULL) { - error(0, "mms_queue_getdata: Failed to read data for queue entry %s in %s", + mms_error(0, "pgsql_queue", NULL, "mms_queue_getdata: Failed to read data for queue entry %s in %s", e->xqfname, qfs->dir); return NULL; } m = mms_frombinary(ms, octstr_imm("")); if (!m) - error(0, "mms_queue_getdata: Failed to decode data for queue entry %s in %s", + mms_error(0, "pgsql_queue", NULL, "mms_queue_getdata: Failed to decode data for queue entry %s in %s", e->xqfname, qfs->dir); octstr_destroy(ms); @@ -847,9 +847,9 @@ static void pgq_queue_run(char *dir, gw_assert(num_threads > 0); - info(0, "pgsql_queue: Queue runner on [%s] startup...", dir); + mms_info(0, "pgsql_queue", NULL, "Queue runner on [%s] startup...", dir); if (sleepsecs < MIN_QRUN_INTERVAL) { - warning(0, "minimum queue run interval for PG Queue module is %d secs.", MIN_QRUN_INTERVAL); + mms_warning(0, "pgsql_queue", NULL, "minimum queue run interval for PG Queue module is %d secs.", MIN_QRUN_INTERVAL); sleepsecs = MIN_QRUN_INTERVAL; } @@ -896,7 +896,7 @@ static void pgq_queue_run(char *dir, gwthread_sleep(sleepsecs); } while (1); - info(0, "pgsql_queue: Queue runner on [%s] shutdown, started...", dir); + mms_info(0, "pgsql_queue", NULL, "Queue runner on [%s] shutdown, started...", dir); gwlist_remove_producer(items_list); for (i=0;iname, field)) - info(0, "field `%s' is not expected within group `%s' at line %d in conf file - skipped", + mms_info(0, "mms_cfg", NULL, "field `%s' is not expected within group `%s' at line %d in conf file - skipped", octstr_get_cstr(field), octstr_get_cstr(grp->name), lineno); else if (dict_put_once(grp->fields, field, octstr_duplicate(value)) == 0) - error(0, "Duplicate field `%s' at line %d in conf file, ignored", + mms_error(0, "mms_cfg", NULL, "Duplicate field `%s' at line %d in conf file, ignored", octstr_get_cstr(field), lineno); } @@ -135,7 +135,7 @@ mCfg *mms_cfg_read(Octstr *file) gw_assert(file); if ((sf = octstr_read_file(octstr_get_cstr(file))) == NULL) { - error(errno, "failed to read config from `%s'", octstr_get_cstr(file)); + mms_error(errno, "mms_cfg", NULL, "failed to read config from `%s'", octstr_get_cstr(file)); return NULL; } @@ -168,7 +168,7 @@ mCfg *mms_cfg_read(Octstr *file) octstr_strip_blanks(field); fixup_value(value, i+1); #if 0 - info(0, "field/value: [%s - %s]", octstr_get_cstr(field), + mms_info(0, "mms_cfg", NULL, "field/value: [%s - %s]", octstr_get_cstr(field), octstr_get_cstr(value)); #endif @@ -177,7 +177,7 @@ mCfg *mms_cfg_read(Octstr *file) int ismulti = is_multigroup(value); if (ismulti < 0) { - info(0, "Skipping unknown group `%s' at line %d of conf file", + mms_info(0, "mms_cfg", NULL, "Skipping unknown group `%s' at line %d of conf file", octstr_get_cstr(value), i+1); skip = 1; } else { @@ -225,7 +225,7 @@ mCfg *mms_cfg_read(Octstr *file) if (cfg->cfg_funcs == NULL || cfg->cfg_funcs->read == NULL || (cfg->xcfg = cfg->cfg_funcs->read(init)) == NULL) { - error(0, "Failed to load cfg reader library from conf!"); + mms_error(0, "mms_cfg", NULL, "Failed to load cfg reader library from conf!"); mms_cfg_destroy(cfg); cfg = NULL; } @@ -383,7 +383,7 @@ int mms_cfg_get_bool(mCfg *cfg, mCfgGrp *grp, Octstr *name, int *bool) octstr_case_compare(val, octstr_imm("0")) == 0) *bool = 0; else { - error(0, "Unable to convert value `%s' to boolean for field `%s' in group `%s'", + mms_error(0, "mms_cfg", NULL, "Unable to convert value `%s' to boolean for field `%s' in group `%s'", octstr_get_cstr(val), octstr_get_cstr(name), octstr_get_cstr(grp->name)); ret = -1; } diff --git a/mbuni/mmlib/mms_cfg.def b/mbuni/mmlib/mms_cfg.def index 763b64b..08f3e3b 100644 --- a/mbuni/mmlib/mms_cfg.def +++ b/mbuni/mmlib/mms_cfg.def @@ -108,6 +108,9 @@ SINGLE_GROUP(mbuni, OCTSTR(admin-allow-ip) OCTSTR(admin-deny-ip) + + OCTSTR(event-logger-module) + OCTSTR(event-logger-module-parameters) ) MULTI_GROUP(mmsproxy, @@ -134,6 +137,7 @@ MULTI_GROUP(mms-vasp, OCTSTR(mms-to-email-handler) OCTSTR(mms-to-local-copy-handler) OCTSTR(send-uaprof) + ) MULTI_GROUP(send-mms-user, @@ -171,6 +175,7 @@ MULTI_GROUP(mmsc, OCTSTR(mmsc-library) OCTSTR(custom-settings) OCTSTR(no-sender-address) + ) MULTI_GROUP(mms-service, diff --git a/mbuni/mmlib/mms_eventlogger.c b/mbuni/mmlib/mms_eventlogger.c new file mode 100644 index 0000000..61a34d9 --- /dev/null +++ b/mbuni/mmlib/mms_eventlogger.c @@ -0,0 +1,146 @@ +/* + * Mbuni - Open Source MMS Gateway + * + * Event logger module + * + * Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com + * + * Paul Bagyenda + * + * This program is free software, distributed under the terms of + * the GNU General Public License, with a few exceptions granted (see LICENSE) + */ +#include "mms_eventlogger.h" +#include "mms_util.h" + +static Octstr *shell_cmd; + +/* So that below compiles fine. */ +#undef error +#undef warning +#undef info +static void default_logger(enum mbuni_event_type_t type, int level, const char *file, + int line, + const char *interface, Octstr *id, + Octstr *msg) +{ + void (*f)(int, const char *,...); + switch(type) { + case MBUNI_INFO: + f = info; + break; + case MBUNI_WARNING: + f = warning; + break; + default: /* including error. */ + f = error; + break; + } + + f(level, "%s:%d [%s] [%s] %s", + file, line, + interface ? interface : "n/a", + id ? octstr_get_cstr(id) : "n/a", + octstr_get_cstr(msg)); +} + + +static void shell_logger(enum mbuni_event_type_t type, int level, const char *file, + int line, + const char *interface, Octstr *id, + Octstr *msg) +{ + char *xtype; + Octstr *cmd, *xid = octstr_duplicate(id); + + gw_assert(shell_cmd); + + switch(type) { + case MBUNI_INFO: + xtype = "INFO"; + break; + case MBUNI_WARNING: + xtype = "WARNING"; + break; + + default: /* including error. */ + xtype = "ERROR"; + break; + } + + escape_shell_chars(msg); + escape_shell_chars(id); + + + cmd = octstr_format("%S '%s' %d '%s' '%s' %d '%S' '%S'", + shell_cmd, xtype, level, interface ? interface : "", file, line, xid ? xid : octstr_imm(""), msg); + system(octstr_get_cstr(cmd)); + + octstr_destroy(cmd); + octstr_destroy(xid); +} + +static int init_default_logger(Octstr *param) +{ + return 0; +} + +static int init_shell_logger(Octstr *cmd) +{ + shell_cmd = octstr_duplicate(cmd); + return 0; +} + + +static int cleanup_shell_logger(void) +{ + octstr_destroy(shell_cmd); + shell_cmd = NULL; + return 0; +} + + + +static MmsEventLoggerFuncs default_handler = {init_default_logger, default_logger}, *log_handler = &default_handler; + +MmsEventLoggerFuncs shell_event_logger = { + init_shell_logger, + shell_logger, + cleanup_shell_logger +}; + +int mms_event_logger_init(MmsEventLoggerFuncs *funcs, Octstr *init_param) +{ + if (funcs && (funcs->init == NULL || + funcs->init(init_param) == 0)) { + log_handler = funcs; + + return 0; + } + + return -1; +} + +extern void mms_event_logger(enum mbuni_event_type_t type, int level, const char *file, + int line, char *interface, Octstr *id, + char *fmt,...) +{ + Octstr *x; + va_list ap; + + va_start(ap, fmt); + x = octstr_format_valist(fmt, ap); + + va_end(ap); + + log_handler->log_event(type, level, file, line, interface, id, x); + + octstr_destroy(x); +} + +void mms_event_logger_cleanup(void) +{ + if (log_handler->cleanup) + log_handler->cleanup(); +} + diff --git a/mbuni/mmlib/mms_eventlogger.h b/mbuni/mmlib/mms_eventlogger.h new file mode 100644 index 0000000..309b4b6 --- /dev/null +++ b/mbuni/mmlib/mms_eventlogger.h @@ -0,0 +1,51 @@ +/* + * Mbuni - Open Source MMS Gateway + * + * Event logger module + * + * Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com + * + * Paul Bagyenda + * + * This program is free software, distributed under the terms of + * the GNU General Public License, with a few exceptions granted (see LICENSE) + */ +#ifndef __MMS_EVENTLOGGER__INCLUDED__ +#define __MMS_EVENTLOGGER__INCLUDED__ + +#include +#include "gwlib/gwlib.h" + +typedef enum mbuni_event_type_t {MBUNI_ERROR, MBUNI_INFO, MBUNI_WARNING} mbuni_event_type_t; +typedef struct MmsEventLoggerFuncs { + int (*init)(Octstr *init_param); + void (*log_event)(mbuni_event_type_t type, int level, const char *file, int line, + const char *interface, Octstr *id, + Octstr *msg); + int (*cleanup)(void); +} MmsEventLoggerFuncs; +/* A module should expose a module of the above type with name: logger */ + +extern int mms_event_logger_init(MmsEventLoggerFuncs *funcs, Octstr *init_param); +/* logger function: + * - interface is one of MM1, MM4, etc. + * - id is an id for the interface element (e.g. mmsc id) + */ +extern void mms_event_logger_cleanup(void); +extern void mms_event_logger(enum mbuni_event_type_t type, int level, const char *file, + int line, char *interface, Octstr *id, + char *fmt,...); + +#define mms_error(level,intf,id,fmt,...) mms_event_logger(MBUNI_ERROR, (level), __FILE__, __LINE__,(intf), (id),(fmt),##__VA_ARGS__) +#define mms_info(level,intf,id,fmt,...) mms_event_logger(MBUNI_INFO, (level), __FILE__, __LINE__,(intf), (id),(fmt),##__VA_ARGS__) +#define mms_warning(level,intf,id,fmt,...) mms_event_logger(MBUNI_WARNING, (level), __FILE__, __LINE__,(intf), (id),(fmt),##__VA_ARGS__) + + +MmsEventLoggerFuncs shell_event_logger; /* For logging using a shell command. */ + +/* Stop all from using gwlib info, error and warning functions */ +#define error use_mms_error_instead +#define warning use_mms_warning_instead +#define info use_mms_warning_instead + +#endif diff --git a/mbuni/mmlib/mms_mm7soap.c b/mbuni/mmlib/mms_mm7soap.c index ec16778..4060112 100644 --- a/mbuni/mmlib/mms_mm7soap.c +++ b/mbuni/mmlib/mms_mm7soap.c @@ -232,7 +232,7 @@ static int parse_header(xmlNodePtr node, List *headers, int *sigparent) if (!skip && tag >= 0 && hname != NULL) { http_header_add(headers, hname, octstr_get_cstr(value)); #if 1 - info(0, "parse.soap, h=%s, v=%s!", hname, octstr_get_cstr(value)); + mms_info(0, "parse.soap", NULL, "h=%s, v=%s!", hname, octstr_get_cstr(value)); #endif } octstr_destroy(value); diff --git a/mbuni/mmlib/mms_mmbox.c b/mbuni/mmlib/mms_mmbox.c index 13bbcd9..b630e04 100644 --- a/mbuni/mmlib/mms_mmbox.c +++ b/mbuni/mmlib/mms_mmbox.c @@ -92,7 +92,7 @@ static Octstr *user_mmbox_dir(char *mmbox_root, char *userid) if (mkdir(fbuf, S_IRWXU|S_IRWXG) < 0 && errno != EEXIST) { - error(0, "mmbox: failed to create dir [%s] " + mms_error(0, "mmbox", NULL, "Failed to create dir [%s] " "while initialising mmbox for %s: %s!", fbuf, userid, strerror(errno)); return NULL; @@ -106,7 +106,7 @@ static Octstr *user_mmbox_dir(char *mmbox_root, char *userid) if (mkdir(octstr_get_cstr(s), S_IRWXU|S_IRWXG) < 0 && errno != EEXIST) { - error(0, "mmbox: failed to create dir [%s] " + mms_error(0, "mmbox", NULL, "Failed to create dir [%s] " "while initialising mmbox for %s: %s!", octstr_get_cstr(s), userid, strerror(errno)); octstr_destroy(s); @@ -140,7 +140,7 @@ static int mkdf(char df[64], char *mmbox_home) if (mkdir(octstr_get_cstr(tmp), S_IRWXU|S_IRWXG) < 0 && errno != EEXIST) { - error(0, "mmbox.mkdf: failed to create dir [%s] " + mms_error(0, "mmbox", NULL, "failed to create dir [%s] " " in mmbox home %s: %s!", octstr_get_cstr(tmp), mmbox_home, strerror(errno)); octstr_destroy(tmp); @@ -159,7 +159,7 @@ static int mkdf(char df[64], char *mmbox_home) if (mkdir(octstr_get_cstr(tmp), S_IRWXU|S_IRWXG) < 0 && errno != EEXIST) { - error(0, "mmbox.mkdf: failed to create dir [%s] " + mms_error(0, "mmbox", NULL, "Failed to create dir [%s] " " in mmbox home %s: %s!", octstr_get_cstr(tmp), mmbox_home, strerror(errno)); octstr_destroy(tmp); @@ -198,7 +198,7 @@ static int open_mmbox_index(char *mmbox_dir, int shouldblock) i = 0; do if ((fd = open(fbuf, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)) < 0) { - error(0, "Failed to open mmbox index file [%s], error: %s!", + mms_error(0, "mmbox", NULL, "Failed to open mmbox index file [%s], error: %s!", fbuf, strerror(errno)); break; } else if (mm_lockfile(fd, fbuf, shouldblock) != 0) { @@ -264,12 +264,12 @@ static int update_mmbox_index(int fd, char *mmbox_dir, int cmd, tempfd = open(fbuf, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); if (tempfd < 0 ) { - error(0, "mmbox.update_index: Failed to open temp file %s: error = %s\n", + mms_error(0, "mmbox", NULL,"Failed to open temp file %s: error = %s\n", fbuf, strerror(errno)); goto done; } else if (mm_lockfile(tempfd, fbuf, 0) != 0) { /* Lock it. */ - error(0, "mmbox.update_index: Failed lock temp file %s: error = %s\n", + mms_error(0, "mmbox", NULL,"Failed lock temp file %s: error = %s\n", fbuf, strerror(errno)); close(tempfd); @@ -280,7 +280,7 @@ static int update_mmbox_index(int fd, char *mmbox_dir, int cmd, fp = fdopen(fd, "r"); if (!fp) { - error(0, "mmbox.update_index: Failed fdopen on tempfd, file %s: error = %s\n", + mms_error(0, "mmbox", NULL,"Failed fdopen on tempfd, file %s: error = %s\n", fbuf, strerror(errno)); @@ -401,7 +401,7 @@ Octstr *mms_mmbox_addmsg(char *mmbox_root, char *user, MmsMsg *msg, List *flag_c goto done; if ((dfd = mkdf(df, octstr_get_cstr(home))) < 0) { - error(0, "mmbox_add: failed to create data file, home=%s - %s!", + mms_error(0, "mmbox", NULL, "failed to create data file, home=%s - %s!", octstr_get_cstr(home), strerror(errno)); goto done; } @@ -479,7 +479,7 @@ int mms_mmbox_modmsg(char *mmbox_root, char *user, Octstr *msgref, s = octstr_read_file(octstr_get_cstr(fname)); if ( s == NULL || octstr_len(s) == 0) { - error(0, "mmbox.mod: failed to read data file [%s] - %s!", + mms_error(0, "mmbox", NULL, "Failed to read data file [%s] - %s!", octstr_get_cstr(fname), strerror(errno)); goto done; } @@ -487,7 +487,7 @@ int mms_mmbox_modmsg(char *mmbox_root, char *user, Octstr *msgref, m = mms_frombinary(s, octstr_imm("anon@anon")); if (!m) { - error(0, "mmbox.mod: failed to read data file [%s]!", + mms_error(0, "mmbox", NULL, "Failed to read data file [%s]!", octstr_get_cstr(fname)); goto done; } @@ -520,7 +520,7 @@ int mms_mmbox_modmsg(char *mmbox_root, char *user, Octstr *msgref, if ((nifd = update_mmbox_index(ifd, octstr_get_cstr(home), ITEM_MOD, sdf, nstate, flags, msize)) < 0) { /* Not good, we wrote but could not update the index file. scream. */ - error(0, "mmbox.mod: failed to update index file, home is %s!", + mms_error(0, "mmbox", NULL, "Failed to update index file, home is %s!", octstr_get_cstr(home)); goto done; } @@ -578,7 +578,7 @@ int mms_mmbox_delmsg(char *mmbox_root, char *user, Octstr *msgref) if ((nifd = update_mmbox_index(ifd, octstr_get_cstr(home), ITEM_DEL, sdf, NULL, NULL,0)) < 0) { - error(0, "mmbox.del: failed to update index file, home is %s!", + mms_error(0, "mmbox", NULL,"Failed to update index file, home is %s!", octstr_get_cstr(home)); goto done; } @@ -654,7 +654,7 @@ List *mms_mmbox_search(char *mmbox_root, char *user, if ((tmpfd = dup(ifd)) < 0 || (fp = fdopen(tmpfd, "r")) == NULL) { - error(0, "mmbox.search_index: %s Failed to dup descriptor for index " + mms_error(0, "mmbox", NULL, "%s Failed to dup descriptor for index " "file, fp = %p: error = %s\n", octstr_get_cstr(home), fp, strerror(errno)); goto done; @@ -780,7 +780,7 @@ int mms_mmbox_count(char *mmbox_root, char *user, unsigned long *msgcount, unsi if ((tmpfd = dup(ifd)) < 0 || (fp = fdopen(tmpfd, "r")) == NULL) { - error(0, "mmbox.count: %s Failed to dup descriptor for index " + mms_error(0, "mmbox", NULL, "%s Failed to dup descriptor for index " "file, fp = %p: error = %s\n", octstr_get_cstr(home), fp, strerror(errno)); goto done; diff --git a/mbuni/mmlib/mms_msg.c b/mbuni/mmlib/mms_msg.c index accbd5b..2be544a 100644 --- a/mbuni/mmlib/mms_msg.c +++ b/mbuni/mmlib/mms_msg.c @@ -128,7 +128,7 @@ static int decode_multipart(ParseContext *context, List *body) if (!content || !content_type) { int pleft = parse_octets_left(context); - warning(0, "Parse error reading mime body [hlen=%d, dlen=%d, left=%d]!", + mms_warning(0, NULL, NULL, "Parse error reading mime body [hlen=%d, dlen=%d, left=%d]!", hlen,dlen, pleft); mime_entity_destroy(x); octstr_destroy(content_type); @@ -255,7 +255,7 @@ static Octstr *decode_encoded_string_value(int ret, ParseContext *context, unsig } } else if (ret2 != WSP_FIELD_VALUE_NUL_STRING) { - warning(0, "Faulty header value for %s! [ret=%d,ret2=%d]\n", hname,ret,ret2); + mms_warning(0, "mms_msg", NULL, "Faulty header value for %s! [ret=%d,ret2=%d]\n", hname,ret,ret2); res = octstr_imm(""); } else res = parse_get_nul_string(context); @@ -281,7 +281,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, ret = wsp_field_value(context, &val); if (parse_error(context)) { - warning(0, "Faulty header [code = %d], skipping remaining headers.", field_type); + mms_warning(0, "mms_msg", NULL, "Faulty header [code = %d], skipping remaining headers.", field_type); parse_skip_to_limit(context); return -2; /* serious error, bail out */ } @@ -301,7 +301,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, if (decoded) _mms_fixup_address(&decoded, unified_prefix, strip_prefixes, 1); if (decoded == NULL || mms_validate_address(decoded)) - warning(0, "Faulty address [%s] format in field %s!", + mms_warning(0, "mms_msg", NULL, "Faulty address [%s] format in field %s!", octstr_get_cstr(decoded), hname); break; case MMS_HEADER_SUBJECT: @@ -323,7 +323,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, if (decoded) octstr_append(decoded, decode_encoded_string_value(ret2, context, hname)); else - warning(0, "Error decoding Header-Response-Text header value"); + mms_warning(0, "mms_msg", NULL, "Error decoding Header-Response-Text header value"); if (ret2 == WSP_FIELD_VALUE_DATA) { /* we need to skip to end of inner value-data. */ parse_skip_to_limit(context); parse_pop_limit(context); @@ -336,7 +336,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, case MMS_HEADER_MESSAGE_ID: case MMS_HEADER_REPLY_CHARGING_ID: if (ret != WSP_FIELD_VALUE_NUL_STRING) - warning(0, "Unexpected field value type %d for header %s\n", + mms_warning(0, "mms_msg", NULL, "Unexpected field value type %d for header %s\n", ret, hname); break; @@ -352,12 +352,12 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, if (decoded) octstr_append(decoded, t); else - warning(0, "error decoding value for header %s\n", + mms_warning(0, "mms_msg", NULL, "error decoding value for header %s\n", hname); octstr_destroy(t); } else if (ret != WSP_FIELD_VALUE_NUL_STRING) - warning(0, "Unexpected field value type %d for header %s\n", + mms_warning(0, "mms_msg", NULL, "Unexpected field value type %d for header %s\n", ret, hname); break; case MMS_HEADER_MMS_VERSION: @@ -402,7 +402,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, if (decoded && x) octstr_append_cstr(decoded, (char *)x); else - warning(0, "error decoding field_value_data value for header %s: val=%s\n", + mms_warning(0, "mms_msg", NULL, "error decoding field_value_data value for header %s: val=%s\n", hname, x ? (char *)x : (char *)"(null)"); } else ch = mms_response_status_to_cstr(val|0x80); @@ -448,7 +448,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, case MMS_HEADER_EXPIRY: case MMS_HEADER_REPLY_CHARGING_DEADLINE: if (ret != WSP_FIELD_VALUE_DATA) - warning(0, "Error in value format, field %s!", + mms_warning(0, "mms_msg", NULL, "Error in value format, field %s!", hname); else { int n = parse_get_char(context); @@ -471,7 +471,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, break; case MMS_HEADER_FROM: if (ret != WSP_FIELD_VALUE_DATA) - warning(0, "Error in value format, field %s!",hname); + mms_warning(0, "mms_msg", NULL, "Error in value format, field %s!",hname); else { int n = parse_get_char(context); @@ -484,14 +484,14 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, if (decoded) _mms_fixup_address(&decoded, unified_prefix, strip_prefixes, 1); if (decoded == NULL || mms_validate_address(decoded)) - warning(0, "Faulty address [%s] format in field %s!", + mms_warning(0, "mms_msg", NULL, "Faulty address [%s] format in field %s!", octstr_get_cstr(decoded), hname); } break; case MMS_HEADER_PREVIOUSLY_SENT_BY: case MMS_HEADER_PREVIOUSLY_SENT_DATE: if (ret != WSP_FIELD_VALUE_DATA) - warning(0, "Error in value format, field %s!",hname); + mms_warning(0, "mms_msg", NULL, "Error in value format, field %s!",hname); else { Octstr *t; decoded = wsp_unpack_integer_value(context); @@ -503,7 +503,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, if (decoded) octstr_append(decoded, t); else - warning(0, "error decoding value for header %s!", + mms_warning(0, "mms_msg", NULL, "error decoding value for header %s!", hname); octstr_destroy(t); } @@ -515,7 +515,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, case MMS_HEADER_ELEMENT_DESCRIPTOR: if (ret != WSP_FIELD_VALUE_DATA) - warning(0, "Faulty header value for %s!\n", hname); + mms_warning(0, "mms_msg", NULL, "Faulty header value for %s!\n", hname); else { /* We expect a content reference and a list of parameters. */ Octstr *cr = parse_get_nul_string(context); List *params = http_create_empty_headers(); @@ -556,19 +556,19 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, case MMS_HEADER_MBOX_TOTALS: case MMS_HEADER_MBOX_QUOTAS: if (ret != WSP_FIELD_VALUE_DATA) - warning(0, "Faulty header value for %s!\n", hname); + mms_warning(0, "mms_msg", NULL, "Faulty header value for %s!\n", hname); else { int n = parse_get_char(context); decoded = wsp_unpack_integer_value(context); if (decoded) octstr_format_append(decoded, " %s", (n == 0x80) ? "msgs" : "bytes"); else - warning(0, "error decoding value for header %s!\n", hname); + mms_warning(0, "mms_msg", NULL, "error decoding value for header %s!\n", hname); } break; case MMS_HEADER_MM_FLAGS: if (ret != WSP_FIELD_VALUE_DATA) - warning(0, "Faulty header value for %s!\n", hname); + mms_warning(0, "mms_msg", NULL, "Faulty header value for %s!\n", hname); else { int n = parse_get_char(context); char *s; @@ -594,7 +594,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, break; default: - warning(0, "MMS: Unknown header with code 0x%02x!", field_type); + mms_warning(0, "mms_msg", NULL, "MMS: Unknown header with code 0x%02x!", field_type); } if (ret == WSP_FIELD_VALUE_DATA) { @@ -609,7 +609,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, goto value_error; if (!hname) { - warning(0, "Unknown header number 0x%02x.", field_type); + mms_warning(0, "mms_msg", NULL, "Unknown header number 0x%02x.", field_type); goto value_error; } @@ -618,7 +618,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, return val; /* success (we hope) */ value_error: - warning(0, "Skipping faulty header [code=%d, val=%d]!", field_type, val); + mms_warning(0, "mms_msg", NULL, "Skipping faulty header [code=%d, val=%d]!", field_type, val); octstr_destroy(decoded); return -2; } @@ -687,7 +687,7 @@ static void mms_pack_well_known_field(Octstr *os, int field_type, Octstr *value) Octstr *s; i = octstr_parse_long(&l, value, 0, 10); if (i < 0) { - warning(0, "Bad counter for field %s!", + mms_warning(0, "mms_msg", NULL, "Bad counter for field %s!", mms_header_to_cstr(field_type)); i = 0; } @@ -738,7 +738,7 @@ static void mms_pack_well_known_field(Octstr *os, int field_type, Octstr *value) Octstr *s; i = octstr_parse_long(&l, value, 0, 10); if (i < 0) { - warning(0, "Bad counter for field %s!", + mms_warning(0, "mms_msg", NULL, "Bad counter for field %s!", mms_header_to_cstr(field_type)); i = 0; } @@ -831,7 +831,7 @@ static void mms_pack_well_known_field(Octstr *os, int field_type, Octstr *value) i = octstr_parse_long(&l, value, 0, 10); if (i <0) { - warning(0, "Bad counter indicator for field!"); + mms_warning(0, "mms_msg", NULL, "Bad counter indicator for field!"); i = 0; } @@ -893,7 +893,7 @@ static void mms_pack_well_known_field(Octstr *os, int field_type, Octstr *value) i = octstr_parse_long(&l, value, 0, 10); if (i <0) { - warning(0, "Bad quota value for field %s!", mms_header_to_cstr(field_type)); + mms_warning(0, "mms_msg", NULL, "Bad quota value for field %s!", mms_header_to_cstr(field_type)); i = 0; } @@ -948,7 +948,7 @@ static void mms_pack_well_known_field(Octstr *os, int field_type, Octstr *value) } break; default: - warning(0, "MMS: Unknown header with code 0x%02x!", field_type); + mms_warning(0, "mms_msg", NULL, "MMS: Unknown header with code 0x%02x!", field_type); } octstr_destroy(encoded); @@ -1023,7 +1023,7 @@ static int encode_msgheaders(Octstr *os, List *hdrs) octstr_destroy(ctype); } else if (mtype == MMS_MSGTYPE_SEND_REQ || mtype == MMS_MSGTYPE_RETRIEVE_CONF) - warning(0, "MMS: Content type missing in encode_headers!"); + mms_warning(0, "mms_msg", NULL, "MMS: Content type missing in encode_headers!"); return 0; @@ -1473,7 +1473,7 @@ MmsMsg *mms_frommime(MIMEEntity *mime) } else { m->message_type = mms_string_to_message_type(s); if (m->message_type < 0) { - error(0, "Unknown message type: %s while parsing mime entity.", octstr_get_cstr(s)); + mms_error(0, NULL, NULL, "Unknown message type: %s while parsing mime entity.", octstr_get_cstr(s)); octstr_destroy(s); goto failed; } diff --git a/mbuni/mmlib/mms_queue.c b/mbuni/mmlib/mms_queue.c index 2fc9472..55e7a88 100644 --- a/mbuni/mmlib/mms_queue.c +++ b/mbuni/mmlib/mms_queue.c @@ -254,7 +254,7 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho octstr_destroy(t); if (e->msgtype < 0) { e->msgtype = 0; - error(0, "mms_queueread: Unknown MMS message type (%s) in file %s, skipped!\n", + mms_error(0, "mms_queueread", NULL, "Unknown MMS message type (%s) in file %s, skipped!\n", res, xqf); } break; @@ -267,7 +267,7 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho case 'F': e->from = octstr_create(res); if (mms_validate_address(e->from) != 0) { - warning(0, "mms_queueread: Mal-formed address [%s] in file %s! " + mms_warning(0, "mms_queueread", NULL, "Mal-formed address [%s] in file %s! " "Attempting fixup.", res, xqf); _mms_fixup_address(&e->from, NULL, NULL, 1); } @@ -276,7 +276,7 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho t = octstr_create(res); if (mms_validate_address(t) != 0) { - warning(0, "mms_queueread: Mal-formed address [%s] in file %s! " + mms_warning(0, "mms_queueread", NULL, "Mal-formed address [%s] in file %s! " "Attempting fixup.", res, xqf); _mms_fixup_address(&t, NULL, NULL, 1); } @@ -346,7 +346,7 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho if (e->hdrs == NULL) e->hdrs = http_create_empty_headers(); if ((ptmp = index(res, ':')) == NULL) - error(0, "Incorrectly formatted line %s in queue file %s!", + mms_error(0, "mms_queue", NULL, "Incorrectly formatted line %s in queue file %s!", line, xqf); else { char *value = ptmp + 1; @@ -361,7 +361,7 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho okfile = 1; break; default: - error(0, "Unknown QF header %c in file %s!", ch, xqf); + mms_error(0, "mms_queue", NULL, "Unknown QF header %c in file %s!", ch, xqf); break; } octstr_destroy(s); @@ -375,7 +375,7 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho if (!okfile) { free_envelope(e,0); e = NULL; - error(0, "Corrupt queue control file: %s", xqf); + mms_error(0, "mms_queue", NULL, "Corrupt queue control file: %s", xqf); } return e; } @@ -409,12 +409,12 @@ static int writeenvelope(MmsEnvelope *e, int newenv) fd = open(octstr_get_cstr(tfname), O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); if (fd < 0 ) { - error(0, "mms_queueadd: Failed to open temp file %s: error = %s\n", + mms_error(0, "mms_queue", NULL, "Failed to open temp file %s: error = %s\n", octstr_get_cstr(tfname), strerror(errno)); res = -1; goto done; } else if (mm_lockfile(fd, octstr_get_cstr(tfname), 0) != 0) { /* Lock it. */ - error(0, "mms_queueadd: Failed lock temp file %s: error = %s\n", + mms_error(0, "mms_queue", NULL, "Failed lock temp file %s: error = %s\n", octstr_get_cstr(tfname), strerror(errno)); res = -1; goto done; @@ -425,7 +425,7 @@ static int writeenvelope(MmsEnvelope *e, int newenv) s = (char *)mms_message_type_to_cstr(e->msgtype); if (!s) { - error(0, "mms_queuewrite: Unknown MMS message type %d! Skipped\n", e->msgtype); + mms_error(0, "mms_queue", NULL, "Write: Unknown MMS message type %d! Skipped\n", e->msgtype); s = ""; } _putline(fd, "T", s); @@ -549,7 +549,7 @@ static int writeenvelope(MmsEnvelope *e, int newenv) qfs->subdir, qfs->name); if (rename(octstr_get_cstr(tfname), octstr_get_cstr(qfname)) < 0) { - error(0, "mms_queuewrite: Failed to rename %s to %s: error = %s\n", + mms_error(0, "mms_queue", NULL, "Failed to rename %s to %s: error = %s\n", octstr_get_cstr(qfname), octstr_get_cstr(tfname), strerror(errno)); close(fd); /* Close new one, keep old one. */ @@ -600,7 +600,7 @@ static int mkqf(char qf[QFNAMEMAX], char subdir[64], char *mms_queuedir) if (mkdir(csubdir, S_IRWXU|S_IRWXG) < 0 && errno != EEXIST) { - error(0, "make queue file: Failed to create dir %s - %s!", + mms_error(0, "mms_queue", NULL, "Failed to create dir %s - %s!", csubdir, strerror(errno)); return -1; } @@ -650,7 +650,7 @@ static int writemmsdata(Octstr *ms, char *df, char subdir[], char *mms_queuedir) fd = open(octstr_get_cstr(dfname), O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); if (fd < 0) { - error(0, "mms_queuadd: Failed to open data file %s: error = %s\n", + mms_error(0, "mms_queue", NULL, "Failed to open data file %s: error = %s\n", octstr_get_cstr(dfname), strerror(errno)); res = -1; goto done; @@ -660,7 +660,7 @@ static int writemmsdata(Octstr *ms, char *df, char subdir[], char *mms_queuedir) close(fd); if (n != 0) { - error(0, "mms_queuadd: Failed to write data file %s: error = %s\n", + mms_error(0, "mms_queue", NULL, "Failed to write data file %s: error = %s\n", octstr_get_cstr(dfname), strerror(errno)); unlink(octstr_get_cstr(dfname)); res = -1; @@ -737,7 +737,7 @@ static Octstr *mms_queue_add(Octstr *from, List *to, fd = mkqf(qf, subdir, directory); if (fd < 0) { - error(0, "mms_queue_add[%s]: Failed err=%s\n", directory, strerror(errno)); + mms_error(0, "mms_queue", NULL, "%s: Failed err=%s\n", directory, strerror(errno)); return NULL; } @@ -958,7 +958,7 @@ static int mms_queue_replacedata(MmsEnvelope *e, MmsMsg *m) Octstr *fname = octstr_format("%s/%s%c%s", qfs->dir, qfs->subdir, MDF, qfs->name + 1); Octstr *tmpf = octstr_format("%s/%s%S", qfs->dir, qfs->subdir, tfname); if (rename(octstr_get_cstr(tmpf), octstr_get_cstr(fname)) < 0) { - error(0, "mms_replacedata: Failed to write data file %s: error = %s\n", + mms_error(0, "mms_queue", NULL, "mms_replacedata: Failed to write data file %s: error = %s\n", octstr_get_cstr(tmpf), strerror(errno)); ret = -1; unlink(octstr_get_cstr(tmpf)); /* remove it. */ @@ -985,14 +985,14 @@ static MmsMsg *mms_queue_getdata(MmsEnvelope *e) fname = octstr_format("%s/%s%c%s", qfs->dir, qfs->subdir, MDF, qfs->name + 1); ms = octstr_read_file(octstr_get_cstr(fname)); if (!ms) { - error(0, "mms_queue_getdata: Failed to load data file for queue entry %s in %s", + mms_error(0, "mms_queue", NULL, "mms_queue_getdata: Failed to load data file for queue entry %s in %s", qfs->name, qfs->dir); octstr_destroy(fname); return NULL; } m = mms_frombinary(ms, octstr_imm("")); if (!m) { - error(0, "mms_queue_getdata: Failed to decode data file for queue entry %s in %s", + mms_error(0, "mms_queue", NULL, "mms_queue_getdata: Failed to decode data file for queue entry %s in %s", qfs->name, qfs->dir); octstr_destroy(fname); return NULL; @@ -1045,7 +1045,7 @@ static int run_dir(char *topdir, char *dir, struct Qthread_t *tlist, int num_thr dirp = opendir(xdir); if (!dirp) { - error(0, "mms_queue_run: Failed to read queue directory %s, error=%s", + mms_error(0, "mms_queue", NULL, "mms_queue_run: Failed to read queue directory %s, error=%s", xdir, strerror(errno)); ret = -1; goto done; @@ -1085,7 +1085,7 @@ static int run_dir(char *topdir, char *dir, struct Qthread_t *tlist, int num_thr if (!queued) { /* A problem. There are no sender threads! */ free_envelope(e, 0); - error(0, "mms_queue_run: No active sender queues for directory %s. Quiting.", + mms_error(0, "mms_queue", NULL, "mms_queue_run: No active sender queues for directory %s. Quiting.", xdir); ret = -2; break; @@ -1152,7 +1152,7 @@ static void mms_queue_run(char *dir, gwthread_sleep(sleepsecs); } while (!qstop); - info(0, "Queue runner [%s] goes down...", dir); + mms_info(0, "mms_queue", NULL, "Queue runner [%s] goes down...", dir); /* We are out of the queue, time to go away. */ for (i = 0; id_name, dir, strerror(errno)); continue; } prof = parse_uaprofile(xml); if (!prof) { - error(0, "mms_uaprof: Failed to parse UA prof doc %s in %s\n", dp->d_name, dir); + mms_error(0, "mms_uaprof", NULL, "Failed to parse UA prof doc %s in %s\n", dp->d_name, dir); goto loop; } @@ -406,7 +406,7 @@ static int mms_load_ua_profile_cache(char *dir) octstr_convert_range(key, 0, octstr_len(key), unreplace_slash); if (dict_put_once(profile_dict, key, prof) != 1) - warning(0, "mms_uaprof: Duplicate cache entry(%s)?\n", + mms_warning(0, "mms_uaprof", NULL, "Duplicate cache entry(%s)?\n", octstr_get_cstr(key)); #if 1 dump_profile(prof, key); @@ -445,7 +445,7 @@ static MmsUaProfile *profile_fetch(Octstr *profile_url) debug("mms.uaprof", 0, "Fetcher got %s", octstr_get_cstr(profile_url)); if (prof) { if (dict_put_once(profile_dict, profile_url, prof) != 1) - warning(0, "mms_uaprof: Duplicate ua profile fetched? (%s)?\n", + mms_warning(0, "mms_uaprof", NULL, "Duplicate ua profile fetched? (%s)?\n", octstr_get_cstr(profile_url)); else { Octstr *fname; @@ -460,12 +460,12 @@ static MmsUaProfile *profile_fetch(Octstr *profile_url) octstr_print(f, body); fclose(f); } else - error(0, "mms_uaprof: Failed to save profile data to cache file %s->%s\n", + mms_error(0, "mms_uaprof", NULL, "Failed to save profile data to cache file %s->%s\n", octstr_get_cstr(fname), strerror(errno)); octstr_destroy(fname); } } else - error(0, "mms_uaprof: Failed to parse UA prof url=%s\n", + mms_error(0, "mms_uaprof", NULL, "Failed to parse UA prof url=%s\n", octstr_get_cstr(profile_url)); } else prof = NULL; diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index f3c1b05..1a80ae8 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -727,7 +727,7 @@ int mms_sendtoemail(Octstr *from, Octstr *to, m = mms_tomime(msg,0); else if ((ret = mms_format_special(msg, trans_smil, txt, html, &m)) < 0 || m == NULL) { - warning(0, "MMS: send2email failed to format message (msg=%s,ret=%d)", + mms_warning(0, "send2email", NULL, "Failed to format message (msg=%s,ret=%d)", m ? "OK" : "Not transformed",ret); return -ret; } @@ -797,7 +797,7 @@ int mms_sendtoemail(Octstr *from, Octstr *to, http_header_add(newhdrs, "X-Mms-MM-Status-Code", s ? octstr_get_cstr(s) : "Unrecognised"); if (!s) - warning(0, "MMS Delivery report with missing Status!"); + mms_warning(0, NULL, NULL, "MMS Delivery report with missing Status!"); octstr_destroy(s); } else if (mtype == MMS_MSGTYPE_READ_REC_IND) { x = "MM4_read_reply_report.REQ"; @@ -1169,7 +1169,7 @@ int parse_cgivars(List *request_headers, Octstr *request_body, *cgivar_ctypes = gwlist_create(); if (!ctype) { - warning(0, "MMS: Parse CGI Vars: Missing Content Type!"); + mms_warning(0, NULL, NULL, "MMS: Parse CGI Vars: Missing Content Type!"); ret = -1; goto done; } @@ -1183,7 +1183,7 @@ int parse_cgivars(List *request_headers, Octstr *request_body, List *r = octstr_split(v, octstr_imm("=")); if (gwlist_len(r) == 0) - warning(0, "MMS: Parse CGI Vars: Missing CGI var name/value in POST data: %s", + mms_warning(0, NULL, NULL, "MMS: Parse CGI Vars: Missing CGI var name/value in POST data: %s", octstr_get_cstr(request_body)); else { HTTPCGIVar *x = gw_malloc(sizeof *x); @@ -1210,7 +1210,7 @@ int parse_cgivars(List *request_headers, Octstr *request_body, int i, n; if (!m) { - warning(0, "MMS: Parse CGI Vars: Failed to parse multipart/form-data body: %s", + mms_warning(0, NULL, NULL, "MMS: Parse CGI Vars: Failed to parse multipart/form-data body: %s", octstr_get_cstr(request_body)); ret = -1; goto done; @@ -1566,7 +1566,7 @@ static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *req /* First we get the auth type: */ if ((i = octstr_search_char(xauth_value, ' ', 0)) < 0) { - warning(0, "Mal-formed WWW-Authenticate header (%s) received while fetching %s!", + mms_warning(0, NULL, NULL, "Mal-formed WWW-Authenticate header (%s) received while fetching %s!", octstr_get_cstr(xauth_value), url ? octstr_get_cstr(url) : ""); status = -1; goto done; @@ -1588,7 +1588,7 @@ static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *req gwlist_destroy(l, (gwlist_item_destructor_t *)octstr_destroy); } else - warning(0, "Mal-formed Digest header (%s) while fetching (%s)!", + mms_warning(0, NULL, NULL, "Mal-formed Digest header (%s) while fetching (%s)!", octstr_get_cstr(xauth_value), url ? octstr_get_cstr(url) : ""); realm = get_stripped_param_value(xauth_value, octstr_imm("realm")); @@ -1974,7 +1974,7 @@ MIMEEntity *multipart_from_urls(List *url_list) http_destroy_headers(mh); mime_entity_destroy(mx); } else - error(0, "multipart_from_urls: Failed to load URL content for URL [%s]", + mms_error(0, "multipart_from_urls", NULL, "Failed to load URL content for URL [%s]", octstr_get_cstr(url)); octstr_destroy(rbody); http_destroy_headers(rph); diff --git a/mbuni/mmlib/mms_util.h b/mbuni/mmlib/mms_util.h index 016d7fe..673118d 100644 --- a/mbuni/mmlib/mms_util.h +++ b/mbuni/mmlib/mms_util.h @@ -23,6 +23,7 @@ #include "mms_mm7soap.h" #include "mms_cfg.h" #include "mms_mmbox.h" +#include "mms_eventlogger.h" /* supported 3GPP MMS version */ #define MAKE_VERSION(a,b,c) ((a)<<16 | (b)<<8 | (c)) diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c index 5507619..33b5b04 100644 --- a/mbuni/mmsbox/bearerbox.c +++ b/mbuni/mmsbox/bearerbox.c @@ -96,7 +96,7 @@ int mmsbox_send_report(Octstr *from, char *report_type, mms_dlr_url_get(msgid, report_type, mmc_gid, &url, &xtransid); if (!url || octstr_len(url) == 0) { - info(0, "Sending delivery-report skipped: `url' is empty, `group_id'=[%s], `msgid'=[%s]", + mms_info(0, "MM7", NULL, "Sending delivery-report skipped: `url' is empty, `group_id'=[%s], `msgid'=[%s]", octstr_get_cstr(mmc_gid), octstr_get_cstr(msgid)); return 0; } @@ -227,7 +227,7 @@ static int mm7soap_receive(MmsBoxHTTPClientInfo *h) octstr_destroy(value); http_destroy_headers(qh); } else { - error(0, + mms_error(0, "MM7", h->m->id, "Failed to convert received MM7/SOAP DeliverReq message from mmc=%s to MMS Message!", octstr_get_cstr(h->m->id)); status = 4000; @@ -263,7 +263,7 @@ static int mm7soap_receive(MmsBoxHTTPClientInfo *h) msgid = mm7_soap_header_value(mreq, octstr_imm("MessageID")); - info(0, "Sending delivery-report [FROM:%s] [VALUE:%s] [DESC:%s] [MSGID:%s]", + mms_info(0, "MM7", h->m->id, "Sending delivery-report [FROM:%s] [VALUE:%s] [DESC:%s] [MSGID:%s]", octstr_get_cstr(from), octstr_get_cstr(value), octstr_get_cstr(desc), octstr_get_cstr(h->m->id)); mmsbox_send_report(from, "delivery-report", NULL, @@ -574,7 +574,7 @@ static void dispatch_mm7_recv(List *rl) http_send_reply(h->client, HTTP_UNAUTHORIZED, hh, octstr_imm("Authentication failed")); http_destroy_headers(hh); - info(0, "MMSBox: Auth failed, incoming connection, MMC group=[%s]", + mms_info(0, "MM7", m->id, "Auth failed, incoming connection, MMC group=[%s]", m->id ? octstr_get_cstr(m->id) : "(none)"); } else if (h->m->type == SOAP_MMSC) ret = mm7soap_receive(h); @@ -632,7 +632,7 @@ void mmsc_receive_func(MmscGrp *m) } else { h.ua = http_header_value(h.headers, octstr_imm("User-Agent")); - error(0, "HTTP: Incoming IP denied MMSC[%s] ip=[%s], ua=[%s], disconnected", + mms_error(0, "MM7", m->id, "HTTP: Incoming IP denied MMSC[%s] ip=[%s], ua=[%s], disconnected", m->id ? octstr_get_cstr(m->id) : "(none)", h.ip ? octstr_get_cstr(h.ip) : "(none)", h.ua ? octstr_get_cstr(h.ua) : "(none)"); @@ -679,7 +679,7 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, Octstr *to, Octstr *body = NULL, *rbody = NULL, *url = NULL; Octstr *s, *distrib = NULL; - info(0, "MMSBox: Send[soap] to MMSC[%s], msg type [%s], from %s, to %s", + mms_info(0, "MM7", mmc->id, "MMSBox: Send[soap] to MMSC[%s], msg type [%s], from %s, to %s", mmc->id ? octstr_get_cstr(mmc->id) : "", mms_message_type_to_cstr(mtype), octstr_get_cstr(from), octstr_get_cstr(to)); @@ -736,7 +736,7 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, Octstr *to, if (detail == NULL) detail = mm7_soap_header_value(mresp, octstr_imm("faultcode")); ret = NULL; - info(0, "Send to MMSC[%s], failed, code=[%d=>%s], detail=[%s]", + mms_info(0, "MM7", mmc->id, "Send to MMSC[%s], failed, code=[%d=>%s], detail=[%s]", mmc ? octstr_get_cstr(mmc->id) : "", tstatus, tmp ? tmp : "", detail ? octstr_get_cstr(detail) : ""); @@ -749,7 +749,7 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, Octstr *to, octstr_destroy(detail); } else { ret = mm7_soap_header_value(mresp, octstr_imm("MessageID")); - info(0, "Sent to MMC[%s], code=[%d=>%s], msgid=[%s]", octstr_get_cstr(mmc->id), + mms_info(0, "MM7", NULL, "Sent to MMC[%s], code=[%d=>%s], msgid=[%s]", octstr_get_cstr(mmc->id), tstatus, mms_soap_status_to_cstr(tstatus), ret ? octstr_get_cstr(ret) : "(none)"); } @@ -787,7 +787,7 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, Octstr *to, char *msgtype; - info(0, "MMSBox: Send [eaif] to MMC[%s], msg type [%s], from %s, to %s", + mms_info(0, "MM7", mmc->id, "MMSBox: Send [eaif] to MMC[%s], msg type [%s], from %s, to %s", mmc ? octstr_get_cstr(mmc->id) : "", mms_message_type_to_cstr(mtype), octstr_get_cstr(from), octstr_get_cstr(to)); @@ -857,7 +857,7 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, Octstr *to, mms_log2("Sent", from, to, -1, ret, NULL, mmc->id, "MMSBox", NULL, NULL); #if 0 - info(0, "Sent to MMC[%s], code=[%d], resp=[%s] msgid [%s]", + mms_info(0, "MM7", mmc->id,"Sent to MMC[%s], code=[%d], resp=[%s] msgid [%s]", octstr_get_cstr(mmc->id), hstatus, resp ? octstr_get_cstr(resp) : "(none)", ret ? octstr_get_cstr(ret) : "(none)"); #endif @@ -894,7 +894,7 @@ static int mms_sendtommsc(MmscGrp *mmc, Octstr *from, Octstr *to, Octstr *transi from, to, transid, linkedid, vasid, service_code, m, hdrs, err, &retry); else - error(0, "MMC[%s] of unknown type, can't send!", + mms_error(0, "MM7", mmc->id, "MMC[%s] of unknown type, can't send!", mmc->id ? octstr_get_cstr(mmc->id) : ""); throughput = mmc->throughput; @@ -927,7 +927,7 @@ static int sendMsg(MmsEnvelope *e) Octstr *otransid = e->hdrs ? http_header_value(e->hdrs, octstr_imm("X-Mbuni-TransactionID")) : NULL; if ((msg = qfs->mms_queue_getdata(e)) == NULL) { - error(0, "MMSBox queue error: Failed to load message for queue id [%s]!", e->xqfname); + mms_error(0, "MM7", NULL, "MMSBox queue error: Failed to load message for queue id [%s]!", e->xqfname); goto done2; } @@ -1023,7 +1023,7 @@ static int sendMsg(MmsEnvelope *e) if (res == MMS_SEND_ERROR_FATAL) to->process = 0; /* No more attempts. */ - info(0, "%s MMSBox Outgoing Queue MMS Send: From %s, to %s, msgsize=%ld: msgid=[%s], err=%s", + mms_info(0, "MM7", NULL, "%s MMSBox Outgoing Queue MMS Send: From %s, to %s, msgsize=%ld: msgid=[%s], err=%s", SEND_ERROR_STR(res), octstr_get_cstr(e->from), octstr_get_cstr(to->rcpt), e->msize, new_msgid ? octstr_get_cstr(new_msgid) : NULL, diff --git a/mbuni/mmsbox/dlr.c b/mbuni/mmsbox/dlr.c index dd51d12..f7cb211 100644 --- a/mbuni/mmsbox/dlr.c +++ b/mbuni/mmsbox/dlr.c @@ -51,7 +51,7 @@ static int dlr_entry_fname(char *msgid, char *rtype, Octstr *mmc_gid, Octstr **e if (mkdir(fbuf, S_IRWXU|S_IRWXG) < 0 && errno != EEXIST) { - error(0, "mmsbox: failed to create dir [%s] " + mms_error(0, "mmsbox", NULL, "failed to create dir [%s] " "while initialising dlr dir for %s: %s!", fbuf, msgid, strerror(errno)); return -1; @@ -68,7 +68,7 @@ static int dlr_entry_fname(char *msgid, char *rtype, Octstr *mmc_gid, Octstr **e i = 0; do if ((fd = open(p, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)) < 0) { - error(0, "Failed to open DLR URL store file [%s], error: %s!", + mms_error(0, "mmsbox", NULL, "Failed to open DLR URL store file [%s], error: %s!", p, strerror(errno)); break; } else if (mm_lockfile(fd, p, 1) != 0) { diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 778a2f6..5eb9dbf 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -33,7 +33,7 @@ static void quit_now(int notused) { rstop = 1; - info(0, "shutdown in progress..."); + mms_info(0, "mmsbox", NULL, "shutdown in progress..."); /* Close all MMSC http ports, kill all MMSC threads, kill sendmms port... */ if (sendmms_port.port > 0) http_close_port(sendmms_port.port); @@ -44,7 +44,7 @@ static void quit_now(int notused) /* manage the SIGHUP signal */ static void relog_now(int notused) { - warning(0, "SIGHUP received, catching and re-opening logs"); + mms_warning(0, "mmsbox", NULL, "SIGHUP received, catching and re-opening logs"); log_reopen(); alog_reopen(); } @@ -458,7 +458,7 @@ static int fetch_serviceurl(MmsEnvelope *e, if (!ctype || !rb || (octstr_len(rb) == 0 && ms->omitempty) || ms->noreply) { - info(0, "MMSBox.service_request: Suppressed reply for service %s, " + mms_info(0, "mmsbox", NULL, "MMSBox.service_request: Suppressed reply for service %s, " "suppress-reply=%s, omit-empty=%s, reply-len=%ld, content-type=%s", octstr_get_cstr(ms->name), ms->noreply ? "true" : "false", ms->omitempty ? "true" : "false", @@ -542,9 +542,9 @@ static int mmsbox_service_dispatch(MmsEnvelope *e) res = fetch_serviceurl(e, ms, msg, me, keyword, &err); done: - + if (err && res != 0) - error(0, "MMSBox error: %s", octstr_get_cstr(err)); + mms_error(0, "mmsbox", NULL, "Error: %s", octstr_get_cstr(err)); if (res == -1 || res == 0) /* Fatal error, or success delete queue entry. */ for (i = 0, n = gwlist_len(e->to); i < n; i++) { @@ -593,8 +593,8 @@ int main(int argc, char *argv[]) octstr_destroy(fname); - info(0, "----------------------------------------"); - info(0, " " MM_NAME " MMSBox version %s starting", MMSC_VERSION); + mms_info(0, "mmsbox", NULL,"----------------------------------------"); + mms_info(0, "mmsbox", NULL," " MM_NAME " MMSBox version %s starting", MMSC_VERSION); signal(SIGHUP, relog_now); @@ -613,7 +613,7 @@ int main(int argc, char *argv[]) mmsbox_service_dispatch, queue_interval, maxthreads, &rstop); - info(0, "Shutdown started.."); + mms_info(0, "mmsbox", NULL,"Shutdown started.."); sleep(2); /* Wait for the sender thread, then quit. */ @@ -623,7 +623,7 @@ int main(int argc, char *argv[]) gwthread_join(sthread); mmsbox_settings_cleanup(); - info(0, "Shutdown complete.."); + mms_info(0, "mmsbox", NULL, "Shutdown complete.."); mms_lib_shutdown(); return 0; @@ -767,7 +767,7 @@ static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, ctype = http_header_value(rph, octstr_imm("Content-Type")); xcid = http_header_value(rph, octstr_imm("Content-ID")); } else - error(0, "MMSBOX: Failed to load url %s within SMIL content from service %s!", + mms_error(0, "mmsbox", NULL, "Failed to load url %s within SMIL content from service %s!", octstr_get_cstr(curl), svc_name ? octstr_get_cstr(svc_name) : "unknown"); if (rph) @@ -1144,7 +1144,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, octstr_get_cstr(qdir), "MMSBox", octstr_imm(MM_NAME)); - info(2, "MMSBox: Queued message from service [%s], [transid [%s]: %s", + mms_info(2, "mmsbox", NULL,"MMSBox: Queued message from service [%s], [transid [%s]: %s", octstr_get_cstr(svc_name), otransid ? octstr_get_cstr(otransid) : "", octstr_get_cstr(x)); @@ -1362,7 +1362,7 @@ static void dispatch_sendmms_recv(List *rl) rb = octstr_imm("Failed to send message"); http_send_reply(h->client, (res == 0) ? HTTP_OK : HTTP_BAD_REQUEST, hh, rb ? rb : octstr_imm("Sent")); - info(0, "MMSBox.mmssend: u=%s, %s [%s]", + mms_info(0, "mmsbox", NULL,"MMSBox.mmssend: u=%s, %s [%s]", u ? octstr_get_cstr(u->user) : "none", (res == 0) ? "Queued" : "Not Queued", rb ? octstr_get_cstr(rb) : ""); @@ -1383,7 +1383,7 @@ static void dispatch_sendmms_recv(List *rl) } if (err && res != 0) - error(0, "%s", octstr_get_cstr(err)); + mms_error(0, "mmsbox", NULL, "%s", octstr_get_cstr(err)); octstr_destroy(err); /* Free the ip and other stuff here. */ diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index e18ff4d..a710383 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -73,11 +73,11 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) int send_port_ssl = 0, admin_port_ssl = 0; List *l; int i, n, xx; - void *catchall = NULL; + void *catchall = NULL, *x; if ((cfg = mms_cfg_read(fname)) == NULL) { - error(0, "Couldn't read configuration from '%s'.", octstr_get_cstr(fname)); + mms_error(0, "mmsbox", NULL, "Couldn't read configuration from '%s'.", octstr_get_cstr(fname)); return -1; } @@ -85,7 +85,7 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) cgrp = mms_cfg_get_single(cfg, octstr_imm("core")); if (grp == NULL) { - error(0,"Missing required group `mbuni' in config file!"); + mms_error(0, "mmsbox", NULL, "Missing required group `mbuni' in config file!"); return -1; } @@ -97,6 +97,14 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) mmsc_del_list = gwlist_create(); + if ((x = _mms_load_module(cfg, grp, "event-logger-module", "event_logger", NULL)) != NULL) { + Octstr *s = mms_cfg_get(cfg, grp, octstr_imm("event-logger-module")); + + if (mms_event_logger_init(x, s) != 0) + panic(0, "Mmsbox: Failed to initialise event logger module!"); + octstr_destroy(s); + } + if (mms_cfg_get_int(cfg, grp, octstr_imm("maximum-send-attempts"), &mmsbox_maxsendattempts) < 0) mmsbox_maxsendattempts = MAXQTRIES; @@ -184,7 +192,7 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) mms_cfg_get_bool(cfg, grp, octstr_imm("sendmms-port-ssl"), &send_port_ssl); #endif if (http_open_port(sendmms_port.port, send_port_ssl) < 0) - error(0, "MMSBox: Failed to start sendmms HTTP server on %ld: %s!", + mms_error(0, "mmsbox", NULL, "Failed to start sendmms HTTP server on %ld: %s!", sendmms_port.port, strerror(errno)); @@ -193,7 +201,7 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) /* load the filter if any. */ if ((mt_filter = _mms_load_module(cfg, grp, "mmsbox-mt-filter-library", "mmsbox_mt_filter", NULL)) != NULL) - info(0, "MMSBox: Loaded MT Filter [%s]", mt_filter->name); + mms_info(0, "mmsbox", NULL, "Loaded MT Filter [%s]", mt_filter->name); mms_cfg_get_bool(cfg, grp, octstr_imm("mmsbox-mt-always-multipart"), &mt_multipart); @@ -234,12 +242,12 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) start_mmsc_from_conf(cfg, gwlist_get(l, i), mmsc_handler_func, errors, warnings); while ((x = gwlist_extract_first(errors)) != NULL) { - error(0, "%s", octstr_get_cstr(x)); + mms_error(0, "mmsbox", NULL, "%s", octstr_get_cstr(x)); octstr_destroy(x); } while ((x = gwlist_extract_first(warnings)) != NULL) { - warning(0, "%s", octstr_get_cstr(x)); + mms_warning(0, "mmsbox", NULL, "%s", octstr_get_cstr(x)); octstr_destroy(x); } gwlist_destroy(errors, NULL); @@ -275,7 +283,7 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) mms_cfg_get_bool(cfg, x, octstr_imm("catch-all"), &m->isdefault); if (m->isdefault) { if (catchall) - warning(0, "MMSBox: Multiple default mms services defined!"); + mms_warning(0, "mmsbox", NULL, "Multiple default mms services defined!"); catchall = m; } @@ -326,7 +334,7 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) int i, n; m->params = gwlist_create(); if (m->type != TRANS_TYPE_POST_URL) - warning(0, "MMSBox: Service [%s] specifies HTTP Post parameters " + mms_warning(0, "mmsbox", NULL,"Service [%s] specifies HTTP Post parameters " "without specifying post-url type/url!", octstr_get_cstr(m->name)); for (i = 0, n = gwlist_len(r); i < n; i++) { Octstr *y = gwlist_get(r, i); @@ -363,7 +371,7 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) case '%': p->type = NO_PART; break; default: - warning(0, "MMSBox: Unknown conversion character %c " + mms_warning(0, "mmsbox", NULL, "Unknown conversion character %c " "in http-post-parameters. Service [%s]!", ch, octstr_get_cstr(m->name)); p->type = NO_PART; @@ -376,7 +384,7 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) } gwlist_append(m->params, p); } else - warning(0, "MMSBox: Missing http-post-parameter name? Service [%s]!", + mms_warning(0, "mmsbox", NULL, "Missing http-post-parameter name? Service [%s]!", octstr_get_cstr(m->name)); } gwlist_destroy(r, (gwlist_item_destructor_t *)octstr_destroy); @@ -402,15 +410,15 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) if (admin_port > 0 && http_open_port(admin_port, admin_port_ssl)< 0) - error(0, "Failed to start admin server on port %d: %s", + mms_error(0, "mmsbox", NULL, "Failed to start admin server on port %d: %s", (int)admin_port, strerror(errno)); else if (admin_port > 0 && (admin_thread = gwthread_create((gwthread_func_t *)admin_handler, NULL)) < 0) { - error(0, "Failed to start admin server thread: %s", + mms_error(0, "mmsbox", NULL, "Failed to start admin server thread: %s", strerror(errno)); http_close_port(admin_port); } else if (admin_pass == NULL) - warning(0, "Empty or no password supplied for admin port. All requests will be allowed!"); + mms_warning(0, "mmsbox", NULL, "Empty or no password supplied for admin port. All requests will be allowed!"); gwlist_destroy(l, NULL); octstr_destroy(gdir); @@ -445,7 +453,7 @@ static void mmsbox_stop_mmsc_conn_real(MmscGrp *mmc) gwthread_join(mmc->threadid); mmc->threadid = -1; } - info(0, "Shutdown for mmsc [%s] complete", octstr_get_cstr(mmc->id)); + mms_info(0, "mmsbox", NULL,"Shutdown for mmsc [%s] complete", octstr_get_cstr(mmc->id)); } @@ -476,7 +484,7 @@ static void mmsbox_start_mmsc_conn(MmscGrp *m, gwthread_func_t *mmsc_handler_fun m->threadid = -1; } - info(0, "Startup for mmsc [%s] complete", octstr_get_cstr(m->id)); + mms_info(0, "mmsbox", NULL,"Startup for mmsc [%s] complete", octstr_get_cstr(m->id)); } @@ -517,7 +525,7 @@ MmscGrp *start_mmsc_from_conf(mCfg *cfg, mCfgGrp *x, gwthread_func_t *mmsc_handl m->incoming.allow_ip = mms_cfg_get(cfg, x, octstr_imm("allow-ip")); m->incoming.deny_ip = mms_cfg_get(cfg, x, octstr_imm("deny-ip")); - info(0, "Loaded MMSC[%s], allow=[%s], deny=[%s] group_id=[%s]", + mms_info(0, "mmsbox", NULL,"Loaded MMSC[%s], allow=[%s], deny=[%s] group_id=[%s]", octstr_get_cstr(m->id), octstr_get_cstr(m->incoming.allow_ip), octstr_get_cstr(m->incoming.deny_ip), @@ -532,7 +540,7 @@ MmscGrp *start_mmsc_from_conf(mCfg *cfg, mCfgGrp *x, gwthread_func_t *mmsc_handl if ((tmp = mms_cfg_get(cfg, x, octstr_imm("max-throughput"))) != NULL) { if (octstr_parse_double(&m->throughput, tmp, 0) == -1) m->throughput = 0; - info(0, "Set throughput to %.3f for mmsc id <%s>", + mms_info(0, "mmsbox", NULL,"Set throughput to %.3f for mmsc id <%s>", m->throughput, octstr_get_cstr(m->id)); octstr_destroy(tmp); } @@ -547,7 +555,7 @@ MmscGrp *start_mmsc_from_conf(mCfg *cfg, mCfgGrp *x, gwthread_func_t *mmsc_handl m->settings = _mms_cfg_getx(cfg, x, octstr_imm("custom-settings")); /* also load the libary. */ if ((m->fns = _mms_load_module(cfg, x, "mmsc-library", "mmsc_funcs", NULL)) == NULL) { - error(0, "failed to load MMSC libary functions from module!"); + mms_error(0, "mmsbox", NULL, "failed to load MMSC libary functions from module!"); m->fns = &dummy_mmsc_funcs; } } else @@ -641,7 +649,7 @@ void mmsbox_stop_all_mmsc_conn(void) List *l = dict_keys(mmscs); while ((mmc = gwlist_extract_first(l)) != NULL) { - info(0, "Stopping MMSC [%s]", octstr_get_cstr(mmc)); + mms_info(0, "mmsbox", NULL,"Stopping MMSC [%s]", octstr_get_cstr(mmc)); mmsbox_stop_mmsc_conn(mmc); octstr_destroy(mmc); } @@ -750,10 +758,10 @@ void mmsbox_settings_cleanup(void) if (admin_port > 0) { http_close_port(admin_port); gwthread_join(admin_thread); - info(0, "MmsBox: Admin port on %d, shutdown", (int)admin_port); + mms_info(0, "mmsbox", NULL,"Admin port on %d, shutdown", (int)admin_port); } - + mms_event_logger_cleanup(); mms_cfg_destroy(cfg); /* only delete at end of session. */ /* More cleanups to follow. */ } @@ -926,7 +934,7 @@ static void admin_handler(void *unused) Octstr *cmd; - info(0, "MmsBox: Admin Interface -- startup on port %d", (int)admin_port); + mms_info(0, "mmsbox", NULL,"Admin Interface -- startup on port %d", (int)admin_port); while((client = http_accept_request(admin_port, &ip, &url, &headers, @@ -938,7 +946,7 @@ static void admin_handler(void *unused) if (!(flg = is_allowed_ip(admin_allow_ip, admin_deny_ip, ip)) || ((pass = http_cgi_variable(cgivars, "password")) == NULL && admin_pass != NULL) || (admin_pass && octstr_compare(pass, admin_pass) != 0)) { - error(0, "MmsBox: Improper access to mmsbox admin interface from IP[%s]: %s", + mms_error(0, "mmsbox", NULL, "Improper access to mmsbox admin interface from IP[%s]: %s", octstr_get_cstr(ip), flg ? "Invalid/empty password" : "IP not allowed"); if (flg) {/* means it is allowed by IP */ @@ -1044,7 +1052,7 @@ static void admin_handler(void *unused) http_destroy_headers(headers); } - info(0, "MmsBox: Admin Interface -- shuttind down on port %d", (int)admin_port); + mms_info(0, "mmsbox", NULL,"Admin Interface -- shuttind down on port %d", (int)admin_port); } void free_mmsbox_http_clientInfo(MmsBoxHTTPClientInfo *h, int freeh) diff --git a/mbuni/mmsc/mms_detokenize_shell.c b/mbuni/mmsc/mms_detokenize_shell.c index f1a5701..24fdb46 100644 --- a/mbuni/mmsc/mms_detokenize_shell.c +++ b/mbuni/mmsc/mms_detokenize_shell.c @@ -21,7 +21,7 @@ Octstr *script; static int mms_detokenizer_init(char *settings) { script = octstr_create(settings); - info(0, "Detokenizer script set to \"%s\"", settings); + mms_info(0, "mms_detokenizer", NULL, "Detokenizer script set to \"%s\"", settings); return 0; } @@ -57,7 +57,7 @@ static Octstr *mms_detokenize(Octstr *token, Octstr *request_ip) octstr_get_cstr(tmp2)); octstr_destroy(tmp1); octstr_destroy(tmp2); - info(0, "Calling \"%s\"", octstr_get_cstr(cmd)); + mms_info(0, "mms_detokenizer", NULL, "Calling \"%s\"", octstr_get_cstr(cmd)); if ((fp = popen(octstr_get_cstr(cmd), "r"))) { if (fgets(buf, sizeof buf, fp) != NULL) { msisdn = octstr_create(buf); @@ -65,7 +65,7 @@ static Octstr *mms_detokenize(Octstr *token, Octstr *request_ip) } pclose(fp); } - info(0, "%s \"%s\", returned msisdn = %s", + mms_info(0, "mms_detokenizer", NULL, "%s \"%s\", returned msisdn = %s", fp ? "Called" : "Failed to call", octstr_get_cstr(cmd), msisdn ? octstr_get_cstr(msisdn) : "null"); diff --git a/mbuni/mmsc/mmsc.c b/mbuni/mmsc/mmsc.c index da77140..4164480 100644 --- a/mbuni/mmsc/mmsc.c +++ b/mbuni/mmsc/mmsc.c @@ -28,7 +28,7 @@ static void quit_now(int notused) /* manage the SIGHUP signal */ static void relog_now(int notused) { - warning(0, "SIGHUP received, catching and re-opening logs"); + mms_warning(0, "mmsc", NULL, "SIGHUP received, catching and re-opening logs"); log_reopen(); alog_reopen(); } @@ -58,8 +58,8 @@ int main(int argc, char *argv[]) octstr_destroy(fname); - info(0, "----------------------------------------"); - info(0, " " MM_NAME " MMSC version %s starting", MMSC_VERSION); + mms_info(0, "mmsc", NULL, "----------------------------------------"); + mms_info(0, "mmsc", NULL," " MM_NAME " MMSC version %s starting", MMSC_VERSION); settings = mms_load_mmsc_settings(cfg,&proxyrelays); @@ -83,15 +83,15 @@ int main(int argc, char *argv[]) /* We are done. Cleanup. */ - info(0, "MMSC shutdown commenced."); + mms_info(0, "mmsc", NULL, "MMSC shutdown commenced."); gwthread_join(r_thread); sleep(2); /* Wait for them to die. */ - info(0, "Final cleanup..."); + mms_info(0, "mmsc", NULL, "Final cleanup..."); mms_cleanup_mmsc_settings(settings); /* Stop settings stuff and so on. */ - info(0, "Shutdown complete..."); + mms_info(0, "mmsc", NULL,"Shutdown complete..."); mms_lib_shutdown(); return 0; diff --git a/mbuni/mmsc/mmsc_cfg.c b/mbuni/mmsc/mmsc_cfg.c index a9f0c7a..a124824 100644 --- a/mbuni/mmsc/mmsc_cfg.c +++ b/mbuni/mmsc/mmsc_cfg.c @@ -32,6 +32,8 @@ void mms_cleanup_mmsc_settings(MmscSettings *settings) { /* eventually we will destroy the object. For now, we only cleanup queue module. */ settings->qfs->mms_cleanup_queue_module(); + + mms_event_logger_cleanup(); } MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays) @@ -46,7 +48,8 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays) Octstr *from, *user, *pass; Octstr *qdir = NULL; int i, n, xx = 0; - + void *x; + memset(m, 0, sizeof *m); if (grp == NULL) @@ -54,6 +57,14 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays) mms_load_core_settings(cfg, cgrp); + if ((x = _mms_load_module(cfg, grp, "event-logger-module", "event_logger", NULL)) != NULL) { + Octstr *s = mms_cfg_get(cfg, grp, octstr_imm("event-logger-module")); + + if (mms_event_logger_init(x, s) != 0) + panic(0, "Mmsc: Failed to initialise event logger module!"); + octstr_destroy(s); + } + m->hostname = mms_cfg_get(cfg, grp, octstr_imm("hostname")); if (octstr_len(m->hostname) == 0) @@ -84,7 +95,7 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays) qdir = _mms_cfg_getx(cfg, grp, octstr_imm("storage-directory")); if (qdir && octstr_len(qdir) >= QFNAMEMAX) - warning(0, "storage-directory name too long. Max length is %d", QFNAMEMAX); + mms_warning(0, "mmsc", NULL,"storage-directory name too long. Max length is %d", QFNAMEMAX); if (mkdir(octstr_get_cstr(qdir), S_IRWXU|S_IRWXG) < 0 && @@ -324,13 +335,13 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays) if (mms_cfg_get_bool(cfg, grp, octstr_imm("mms-to-email-handler"), &ibool) == 0 && ibool) { if (m->mms2email) - warning(0, "mms-to-email handler VASP specified more than once! Only last config taken."); + mms_warning(0, "mmsc", NULL,"mms-to-email handler VASP specified more than once! Only last config taken."); m->mms2email = mv; } if (mms_cfg_get_bool(cfg, grp, octstr_imm("mms-to-local-copy-handler"), &ibool) == 0 && ibool) { if (m->mms2mobile) - warning(0, "mms-to-mobile copy handler VASP specified more than once! Only last config taken."); + mms_warning(0, "mmsc", NULL,"mms-to-mobile copy handler VASP specified more than once! Only last config taken."); m->mms2mobile = mv; } @@ -340,7 +351,7 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays) else if (octstr_str_case_compare(s, "ua") == 0) mv->send_uaprof = UAProf_UA; else { - warning(0, "unknown send-uaprof value '%s'. Must be \"ua\" or \"url\"!", + mms_warning(0, "mmsc", NULL,"unknown send-uaprof value '%s'. Must be \"ua\" or \"url\"!", octstr_get_cstr(s)); mv->send_uaprof = UAProf_None; } @@ -379,7 +390,7 @@ List *mms_proxy_relays(mCfg *cfg, Octstr *myhostname) m->strip_prefixes = NULL; if (octstr_compare(m->host, myhostname) == 0) - warning(0, "MMSC Config: Found MM4 Proxy %s with same hostname as local host!", + mms_warning(0, "mmsc", NULL,"MMSC Config: Found MM4 Proxy %s with same hostname as local host!", octstr_get_cstr(m->name)); gwlist_append(l, m); } @@ -561,7 +572,7 @@ int mms_ind_send(Octstr *prov_cmd, Octstr *to) int y = WEXITSTATUS(x); if (x < 0) { - error(0, "Checking MMS Ind.Send: Failed to run command %s!", + mms_error(0, "mmsc", NULL, "Checking MMS Ind.Send: Failed to run command %s!", octstr_get_cstr(s)); res = 1; } else if (y != 0 && y != 1) @@ -570,7 +581,7 @@ int mms_ind_send(Octstr *prov_cmd, Octstr *to) res = y; octstr_destroy(s); } else - warning(0, "Checking MMS Ind.Send: Failed call to compose command [%s] ", + mms_warning(0, "mmsc", NULL, "Checking MMS Ind.Send: Failed call to compose command [%s] ", octstr_get_cstr(prov_cmd)); diff --git a/mbuni/mmsc/mmsfromemail.c b/mbuni/mmsc/mmsfromemail.c index c0e7930..e48983d 100644 --- a/mbuni/mmsc/mmsfromemail.c +++ b/mbuni/mmsc/mmsfromemail.c @@ -85,8 +85,8 @@ int main(int argc, char *argv[]) octstr_destroy(fname); - info(0, "----------------------------------------"); - info(0, " MMSC Email2MMS/MM4 Incoming Tool version %s starting", MMSC_VERSION); + mms_info(0, "mmsfromemail", NULL, "----------------------------------------"); + mms_info(0, "mmsfromemail", NULL, " MMSC Email2MMS/MM4 Incoming Tool version %s starting", MMSC_VERSION); /* Load settings. */ settings = mms_load_mmsc_settings(cfg, &proxyrelays); @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) panic(0, "No global MMSC configuration!"); if (!xto || !xfrom) { - error(0, "usage: %s -f from -t to!", argv[0]); + mms_error(0, "mmsfromemail", NULL, "usage: %s -f from -t to!", argv[0]); return -1; } @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) (ttype == TPLMN && (!home_mmsc || !is_allowed_host(home_mmsc, settings->email2mmsrelay_hosts)))) { - error(0, " Not allowed to send to this recipient %s, resolved mmsc=%s!", + mms_error(0, "mmsfromemail", NULL, " Not allowed to send to this recipient %s, resolved mmsc=%s!", xto ? octstr_get_cstr(xto) : "(null)", home_mmsc ? octstr_get_cstr(home_mmsc) : "(null)"); mms_lib_shutdown(); @@ -126,13 +126,13 @@ int main(int argc, char *argv[]) email = octstr_read_pipe(stdin); if (!email || octstr_len(email) == 0) { - error(0, "Empty email message!"); + mms_error(0, "mmsfromeail", NULL, "Empty email message!"); mms_lib_shutdown(); return -1; } if ((mm = mime_octstr_to_entity(email)) == NULL) { - error(0, "Unable to decode mime entity!"); + mms_error(0, "mmsfromeail", NULL, "Unable to decode mime entity!"); mms_lib_shutdown(); return -1; } @@ -190,7 +190,7 @@ int main(int argc, char *argv[]) strip_quoted_string(transid); - info(0, "MM4 interface Received [message type: %s] [transaction id: %s] [origin: %s] [msgid: %s]", + mms_info(0, "MM4", NULL, "Received [message type: %s] [transaction id: %s] [origin: %s] [msgid: %s]", mm4_type ? octstr_get_cstr(mm4_type) : "", transid ? octstr_get_cstr(transid) : "", orig_sys ? octstr_get_cstr(orig_sys) : "", @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) /* Now convert from mime to MMS message, if we should */ if (mm1_type >= 0) { if ((msg = mms_frommime(mm)) == NULL) { - error(0, "Unable to create MM!"); + mms_error(0, "mmsfromeail", NULL, "Unable to create MM!"); mms_lib_shutdown(); return -1; } @@ -261,7 +261,7 @@ int main(int argc, char *argv[]) case MM4_FORWARD_REQ: if (ttype != TPLMN) { err = "Error-service-denied"; - error(0, "Not allowed to send to non-phone recipient, to=%s!", octstr_get_cstr(xto)); + mms_error(0, "MM4", NULL, "Not allowed to send to non-phone recipient, to=%s!", octstr_get_cstr(xto)); } else { List *lto = gwlist_create(); Octstr *qf; @@ -290,7 +290,7 @@ int main(int argc, char *argv[]) if (qf) { newmsgid = mms_make_msgid(octstr_get_cstr(qf), settings->host_alias); - info(0, "%s Queued message to %s from %s (via %s) => %s", + mms_info(0, "mmsfromemail", NULL, "%s Queued message to %s from %s (via %s) => %s", mm4_type ? "MM4 Incoming" : "Email2MMS", octstr_get_cstr(xto), octstr_get_cstr(xfrom), xproxy ? octstr_get_cstr(xproxy) : "(None)", octstr_get_cstr(qf)); @@ -311,7 +311,7 @@ int main(int argc, char *argv[]) break; case MM4_DELIVERY_REPORT_REQ: if (ttype != TPLMN) { /* We only send to phones from this interface */ - error(0, "Not allowed to send to %s!", octstr_get_cstr(xto)); + mms_error(0, "MM4", NULL, "Not allowed to send to %s!", octstr_get_cstr(xto)); err = "Error-service-denied"; } else { List *lto = gwlist_create(); @@ -332,7 +332,7 @@ int main(int argc, char *argv[]) settings->host_alias); gwlist_destroy(lto, NULL); if (qf) { - info(0, "MM4 Queued DLR from proxy %s to %s from %s => %s", + mms_info(0, "MM4", xproxy,"Queued DLR from proxy %s to %s from %s => %s", octstr_get_cstr(xproxy), octstr_get_cstr(xto), octstr_get_cstr(xfrom), octstr_get_cstr(qf)); octstr_destroy(qf); @@ -345,7 +345,7 @@ int main(int argc, char *argv[]) case MM4_READ_REPLY_REPORT_REQ: if (ttype != TPLMN) { /* We only send to phones from this interface */ - error(0, "Not allowed to send to %s!", octstr_get_cstr(xto)); + mms_error(0, "MM4", NULL, "Not allowed to send to %s!", octstr_get_cstr(xto)); err = "Error-service-denied"; } else { List *lto = gwlist_create(); @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) settings->host_alias); gwlist_destroy(lto, NULL); if (qf) { - info(0, "MM4 Queued read report from proxy %s to %s from %s => %s", + mms_info(0, "MM4", xproxy, "Queued read report from proxy %s to %s from %s => %s", octstr_get_cstr(xproxy), octstr_get_cstr(xto), octstr_get_cstr(xfrom), octstr_get_cstr(qf)); octstr_destroy(qf); @@ -406,7 +406,7 @@ int main(int argc, char *argv[]) octstr_get_cstr(settings->global_queuedir), 1); if (!e) - warning(0, "MM4 Received %s from %s but cannot find queue entry for transaction %s [%s]!", + mms_warning(0, "MM4", xproxy, "MM4 Received %s from %s but cannot find queue entry for transaction %s [%s]!", mm4_types[mtype].mm4str, octstr_get_cstr(xproxy), octstr_get_cstr(transid), @@ -437,7 +437,7 @@ int main(int argc, char *argv[]) gw_free(cdr); } - info(0, "MM4 received %s from proxy %s to %s from %s => %s, status: [%s, %s]", + mms_info(0, "MM4", xproxy, "Received %s from proxy %s to %s from %s => %s, status: [%s, %s]", mm4_types[mtype].mm4str, octstr_get_cstr(xproxy), o_to ? octstr_get_cstr(o_to) : octstr_get_cstr(xto), octstr_get_cstr(xfrom), @@ -450,7 +450,7 @@ int main(int argc, char *argv[]) } } else - warning(0, "Received %s but cannot find message %s in queue!", + mms_warning(0, "MM4", xproxy, "Received %s but cannot find message %s in queue!", mm4_types[mtype].mm4str, octstr_get_cstr(transid)); @@ -459,7 +459,7 @@ int main(int argc, char *argv[]) } break; default: - warning(0, "Unexpected message type: %s", + mms_warning(0, "MM4", xproxy, "Unexpected message type: %s", mm4_type ? octstr_get_cstr(mm4_type) : "not given!"); break; } @@ -662,7 +662,7 @@ static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid, mm_send_to_email(to, sender, octstr_imm(""), msgid, m, 0, &err, octstr_get_cstr(sendmail_cmd), settings->hostname); if (err) { - warning(0, "MM4 send.RES reported: %s!", octstr_get_cstr(err)); + mms_warning(0, "MM4", NULL, "send.RES reported: %s!", octstr_get_cstr(err)); octstr_destroy(err); } mime_entity_destroy(m); diff --git a/mbuni/mmsc/mmsglobalsender.c b/mbuni/mmsc/mmsglobalsender.c index 925e3f4..618c7e1 100644 --- a/mbuni/mmsc/mmsglobalsender.c +++ b/mbuni/mmsc/mmsglobalsender.c @@ -92,7 +92,7 @@ static int sendMsg(MmsEnvelope *e) settings->mms_bill_module_data); gwlist_destroy(l, (void *)octstr_destroy); - info(0, "Global Queue MMS Bill: From %s, to_count=%ld, msgid=%s, msgsize=%ld: returned=%.2f", + mms_info(0, "MM2", NULL, "Global Queue MMS Bill: From %s, to_count=%ld, msgid=%s, msgsize=%ld: returned=%.2f", octstr_get_cstr(e->from), gwlist_len(e->to), e->msgId ? octstr_get_cstr(e->msgId) : "", e->msize, amt); @@ -213,7 +213,7 @@ static int sendMsg(MmsEnvelope *e) e->msgId, e->hdrs, msg, &err); - info(0, "%s Global Queue MMS Send: Local Msg copy to VASP (%s) - " + mms_info(0, "MM7", settings->mms2mobile->id, "%s Global Queue MMS Send: Local Msg copy to VASP (%s) - " "From %s, to %s, msgsize=%ld: err=%s", SEND_ERROR_STR(res), octstr_get_cstr(settings->mms2mobile->id), @@ -261,7 +261,7 @@ static int sendMsg(MmsEnvelope *e) if ((mmsc = settings->mms_resolvefuncs->mms_resolve(phonenum, settings->mms_resolver_module_data, settings, proxyrelays))) { - info(0, "mmsc for \"%s\" resolved to: \"%s\"", + mms_info(0, "MM2", NULL, "mmsc for \"%s\" resolved to: \"%s\"", octstr_get_cstr(phonenum), octstr_get_cstr(mmsc)); /* If resolved to my hostname, then this is local. */ if (octstr_compare(mmsc, settings->hostname) == 0) { @@ -273,7 +273,7 @@ static int sendMsg(MmsEnvelope *e) e->msgId, e->hdrs, msg, &err); - info(0, "%s Global Queue MMS Send: Local Msg copy to VASP (%s) - " + mms_info(0, "MM2", NULL, "%s Global Queue MMS Send: Local Msg copy to VASP (%s) - " "From %s, to %s, msgsize=%ld: err=%s", SEND_ERROR_STR(res), octstr_get_cstr(settings->mms2mobile->id), @@ -390,7 +390,7 @@ static int sendMsg(MmsEnvelope *e) } /* Write to log */ - info(0, "%s Global Queue MMS Send [%.128s]: From %s, to %s, msgsize=%ld: err=%s", + mms_info(0, "MM2", NULL, "%s Global Queue MMS Send [%.128s]: From %s, to %s, msgsize=%ld: err=%s", SEND_ERROR_STR(res), e->xqfname, octstr_get_cstr(e->from), octstr_get_cstr(to->rcpt), e->msize, @@ -610,7 +610,7 @@ static int mm7soap_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgId, Octstr *uaprof = NULL, *s; time_t tstamp; - info(0, "MMS Relay: Send[soap] to VASP[%s], msg_type=[%s], from=[%s], to=[%s]", + mms_info(0, "MM7", vasp->id, "MMS Relay: Send[soap] to VASP[%s], msg_type=[%s], from=[%s], to=[%s]", vasp ? octstr_get_cstr(vasp->id) : "", mms_message_type_to_cstr(mtype), octstr_get_cstr(from), octstr_get_cstr(to)); @@ -665,7 +665,7 @@ static int mm7soap_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgId, if (!MM7_SOAP_STATUS_OK(tstatus)) { Octstr *detail = mm7_soap_header_value(mresp, octstr_imm("Details")); ret = MMS_SEND_ERROR_FATAL; - info(0, "Send to VASP[%s], failed, code=[%d=>%s], detail=%s", + mms_info(0, "MM7", vasp->id, "Send to VASP[%s], failed, code=[%d=>%s], detail=%s", vasp ? octstr_get_cstr(vasp->id) : "", tstatus, mms_soap_status_to_cstr(tstatus), detail ? octstr_get_cstr(detail) : ""); @@ -680,7 +680,7 @@ static int mm7soap_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgId, } else ret = MMS_SEND_OK; - info(0, "Sent to VASP[%s], code=[%d=>%s]", octstr_get_cstr(vasp->id), + mms_info(0, "MM7", vasp->id, "Sent to VASP[%s], code=[%d=>%s]", octstr_get_cstr(vasp->id), tstatus, mms_soap_status_to_cstr(tstatus)); done1: @@ -710,7 +710,7 @@ static int mm7eaif_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgid, char *msgtype; - info(0, "MMS Relay: Send [eaif] to VASP[%s], msg_type=[%s], from=[%s], to=[%s]", + mms_info(0, "MM7", vasp->id, "MMS Relay: Send [eaif] to VASP[%s], msg_type=[%s], from=[%s], to=[%s]", vasp ? octstr_get_cstr(vasp->id) : "", mms_message_type_to_cstr(mtype), octstr_get_cstr(from), octstr_get_cstr(to)); @@ -743,7 +743,7 @@ static int mm7eaif_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgid, *error = octstr_format("Failed to contact VASP[url=%s] => HTTP returned status = %d!", octstr_get_cstr(vasp->vasp_url), hstatus); } else - info(0, "Sent to VASP[%s], code=[%d]", octstr_get_cstr(vasp->id), hstatus); + mms_info(0, "MM7", vasp->id, "Sent to VASP[%s], code=[%d]", octstr_get_cstr(vasp->id), hstatus); if (hstatus < 0) ret = MMS_SEND_ERROR_TRANSIENT; @@ -779,7 +779,7 @@ static int mms_sendtovasp(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgid else if (vasp->type == EAIF_VASP) return mm7eaif_send(vasp, from, to, msgid, m, err); else { - error(0, "Vasp[%s] of unknown type, can't send!", + mms_error(0, "MM7", vasp->id, "Vasp[%s] of unknown type, can't send!", vasp->id ? octstr_get_cstr(vasp->id) : ""); return MMS_SEND_ERROR_FATAL; } diff --git a/mbuni/mmsc/mmsmobilesender.c b/mbuni/mmsc/mmsmobilesender.c index 6dc53e4..95e0f98 100644 --- a/mbuni/mmsc/mmsmobilesender.c +++ b/mbuni/mmsc/mmsmobilesender.c @@ -71,10 +71,10 @@ static void start_push(Octstr *rcpt_to, int isphonenum, MmsEnvelope *e, MmsMsg * Octstr *s = NULL; - info(0, "mms2mobile.startpush: notification to %s\n", octstr_get_cstr(rcpt_to)); + mms_info(0, "MM1", NULL, "mms2mobile.startpush: notification to %s\n", octstr_get_cstr(rcpt_to)); if (!rcpt_to) { - error(0, "mobilesender: Queue entry %s has no recipient address!", e->xqfname); + mms_error(0, "MM1", NULL, "mobilesender: Queue entry %s has no recipient address!", e->xqfname); goto done; } else to = octstr_duplicate(rcpt_to); @@ -140,7 +140,7 @@ static void start_push(Octstr *rcpt_to, int isphonenum, MmsEnvelope *e, MmsMsg * e = update_env_success(e, xto); } else { e = update_env_failed(e); - error(0, "push to %s:%d failed: %s", octstr_get_cstr(to), WAPPUSH_PORT, strerror(errno)); + mms_error(0, "MM1", NULL, "push to %s:%d failed: %s", octstr_get_cstr(to), WAPPUSH_PORT, strerror(errno)); } octstr_destroy(addr); if (e) @@ -169,7 +169,7 @@ static int receive_push_reply(HTTPCaller *caller) Octstr *to = NULL; if (http_status == -1 || final_url == NULL) { - error(0, "push failed, no reason found"); + mms_error(0, "MM1", NULL, "push failed, no reason found"); goto push_failed; } @@ -179,11 +179,11 @@ static int receive_push_reply(HTTPCaller *caller) if (xto) to = xto->rcpt; else { - error(0, "mobilesender: Queue entry %s has no recipient address!", env->xqfname); + mms_error(0, "MM1", NULL, "mobilesender: Queue entry %s has no recipient address!", env->xqfname); goto push_failed; } - info(0, "send2mobile.push_reply[%s]: From %s, to %s => %d", + mms_info(0, "MM1", NULL, "send2mobile.push_reply[%s]: From %s, to %s => %d", env->xqfname, octstr_get_cstr(env->from), octstr_get_cstr(to), http_status); @@ -195,7 +195,7 @@ static int receive_push_reply(HTTPCaller *caller) * for a minute or so later. */ - error(0, "Deffered notification, WAP Push failed for " + mms_error(0, "MM1", NULL, "Deffered notification, WAP Push failed for " "msgid %s to %s, http error: %d!", octstr_get_cstr(env->msgId), octstr_get_cstr(to), http_status); goto push_failed; @@ -244,13 +244,13 @@ static int sendNotify(MmsEnvelope *e) if (e->lastaccess != 0) { /* This message has been fetched at least once, no more signals. */ e->sendt = e->expiryt + 3600*24*30*12; - info(0, "MM1: Message [ID: %s] fetched/touched at least once. Skipping", + mms_info(0, "MM1", NULL, "Message [ID: %s] fetched/touched at least once. Skipping", e->xqfname); return settings->qfs->mms_queue_update(e); } if (!xto) { - error(0, "mobilesender: Queue entry %s with no recipients!", + mms_error(0, "MM1", NULL, "mobilesender: Queue entry %s with no recipients!", e->xqfname); return 0; } @@ -378,7 +378,7 @@ static int sendNotify(MmsEnvelope *e) url = mms_makefetchurl(e->xqfname, e->token, MMS_LOC_MQUEUE, phonenum ? phonenum : to, settings); - info(0, "Preparing to notify client to fetch message at URL: %s", + mms_info(0, "MM1", NULL, "Preparing to notify client to fetch message at URL: %s", octstr_get_cstr(url)); transid = mms_maketransid(e->xqfname, settings->host_alias); @@ -392,7 +392,7 @@ static int sendNotify(MmsEnvelope *e) mtype == MMS_MSGTYPE_READ_ORIG_IND) smsg = msg; else { - error(0, "Unexpected message type %s for %s found in MT queue!", + mms_error(0, "MM1", NULL, "Unexpected message type %s for %s found in MT queue!", mms_message_type_to_cstr(mtype), octstr_get_cstr(to)); res = MMS_SEND_ERROR_FATAL; goto done; @@ -443,7 +443,7 @@ static int sendNotify(MmsEnvelope *e) } /* Write to log */ - info(0, "%s Mobile Queue MMS Send Notify: From=%s, to=%s, msgsize=%d, reason=%s", + mms_info(0, "MM1", NULL, "%s Mobile Queue MMS Send Notify: From=%s, to=%s, msgsize=%d, reason=%s", SEND_ERROR_STR(res), octstr_get_cstr(from), octstr_get_cstr(to), msize, err ? octstr_get_cstr(err) : ""); @@ -483,7 +483,7 @@ void mbuni_mm1_queue_runner(int *rstop) { httpcaller = http_caller_create(); if (gwthread_create((gwthread_func_t *)receive_push_reply, httpcaller) < 0) { /* Listener thread. */ - error(0, "Mobile sender: Failed to create push reply thread: %d: %s!", + mms_error(0, "MM1", NULL, "Mobile sender: Failed to create push reply thread: %d: %s!", errno, strerror(errno)); return; } diff --git a/mbuni/mmsc/mmsproxy.c b/mbuni/mmsc/mmsproxy.c index 1c9b73a..9bbbaf2 100644 --- a/mbuni/mmsc/mmsproxy.c +++ b/mbuni/mmsc/mmsproxy.c @@ -154,14 +154,14 @@ static void mm1proxy(void) free_clientInfo(&h, 0); } - info(0, "Mmsproxy [mm1]: Shutdown commenced..."); + mms_info(0, "MM1", NULL, "Mmsproxy [mm1]: Shutdown commenced..."); } int mmsproxy(void) { - info(0, " " MM_NAME " MMSC Proxy version %s starting", MMSC_VERSION); + mms_info(0, "mmsproxy", NULL, " " MM_NAME " MMSC Proxy version %s starting", MMSC_VERSION); mms_start_profile_engine(octstr_get_cstr(settings->ua_profile_cache_dir)); @@ -169,7 +169,7 @@ int mmsproxy(void) /* Now open port and start dispatching requests. */ if (http_open_port(settings->port, 0) < 0) { - error(0, "MMS Proxy: Failed to start http server: %d => %s!", + mms_error(0, "MM1", NULL, "MMS Proxy: Failed to start http server: %d => %s!", errno, strerror(errno)); return -1; } @@ -178,30 +178,30 @@ int mmsproxy(void) http_open_port(settings->mm7port, 0) >= 0) mm7_thread = gwthread_create((gwthread_func_t *)mm7proxy, NULL); else - warning(0, "MMS Proxy: MM7 interface not open, port=%ld", + mms_warning(0, "MM7", NULL,"MMS Proxy: MM7 interface not open, port=%ld", settings->mm7port); mm1proxy(); /* run mm1 proxy in current thread. */ if (mm7_thread >0) gwthread_join(mm7_thread); - info(0, "Stopping profile engine..."); + mms_info(0, "mmsproxy", NULL, "Stopping profile engine..."); mms_stop_profile_engine(); /* Stop profile stuff. */ - info(0, "Mmsproxy: Shutdown complete."); + mms_info(0, "mmsproxy", NULL,"Shutdown complete."); return 0; } void stop_mmsproxy(void) { - info(0, "Mmsproxy: Shutdown commenced..."); + mms_info(0, "mmsproxy", NULL, "Shutdown commenced..."); rstop = 1; http_close_port(settings->port); http_close_port(settings->mm7port); - info(0, "Mmsproxy: Signalling shutdown complete."); + mms_info(0, "mmsproxy", NULL, "Signalling shutdown complete."); } void fetchmms_proxy(MmsHTTPClientInfo *h) @@ -223,7 +223,7 @@ void fetchmms_proxy(MmsHTTPClientInfo *h) http_header_add(rh, "Cache-Control", "no-cache"); if (mms_decodefetchurl(h->url, &qf, &token,&loc) != 0) { - error(0, "MMS Fetch interface: failed to decode request url (%s) from %s!", + mms_error(0, "MM1", NULL, "MMS Fetch interface: failed to decode request url (%s) from %s!", octstr_get_cstr(h->url), octstr_get_cstr(h->ip)); goto failed; @@ -242,7 +242,7 @@ void fetchmms_proxy(MmsHTTPClientInfo *h) if (!e || (m = settings->qfs->mms_queue_getdata(e)) == NULL) { - error(0, "MMS Fetch interface: failed to find envelope/data %s for request url (%s) from %s (e=%s)!", + mms_error(0, "MM1", NULL,"MMS Fetch interface: failed to find envelope/data %s for request url (%s) from %s (e=%s)!", octstr_get_cstr(qf), octstr_get_cstr(h->url), octstr_get_cstr(h->ip), (e)? "found" : "not found"); @@ -257,7 +257,7 @@ void fetchmms_proxy(MmsHTTPClientInfo *h) unsigned long msize; if ((m = mms_mmbox_get(octstr_get_cstr(settings->mmbox_rootdir), octstr_get_cstr(h->client_addr), qf, &msize)) == NULL) { - error(0, "MMS Fetch interface: failed to find data in MMBOX %s, url=%s, from=%s (e=%s)!", + mms_error(0, "MM1", NULL,"MMS Fetch interface: failed to find data in MMBOX %s, url=%s, from=%s (e=%s)!", octstr_get_cstr(qf), octstr_get_cstr(h->url), octstr_get_cstr(h->ip), (e)? "found" : "not found"); mr = mms_retrieveconf(NULL, NULL, "Error-permanent-message-not-found", "Message not found", @@ -326,13 +326,13 @@ void fetchmms_proxy(MmsHTTPClientInfo *h) s = mms_tobinary(mr); if (!m) { - error(0, "MMS Fetch interface: Failed to get message, url=%s, loc=%d from %s!", + mms_error(0, "MM1", NULL,"MMS Fetch interface: Failed to get message, url=%s, loc=%d from %s!", octstr_get_cstr(h->url), loc, octstr_get_cstr(h->ip)); goto failed; } if (!s) { - error(0, "MMS Fetch interface: Failed to convert message to binary for " + mms_error(0, "MM1", NULL,"MMS Fetch interface: Failed to convert message to binary for " "request url (%s) from %s!", octstr_get_cstr(h->url), octstr_get_cstr(h->ip)); goto failed; @@ -533,7 +533,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) mresp = mms_sendconf("Error-sending-address-unresolved", "None", octstr_get_cstr(otransid),0, menc); - error(0, "MMS Send interface: failed to find sender address in request from %s!", + mms_error(0, "MM1", NULL,"MMS Send interface: failed to find sender address in request from %s!", octstr_get_cstr(h->ip)); } else { @@ -657,14 +657,14 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) if (!h->client_addr) { mresp = mms_sendconf("Error-sending-address-unresolved", "None", octstr_get_cstr(otransid),1, menc); - error(0, "MMS Send interface (fwd): failed to find sender address in request from %s!", + mms_error(0, "MM1", NULL,"MMS Send interface (fwd): failed to find sender address in request from %s!", octstr_get_cstr(h->ip)); goto forward_done; } if (url == NULL || mms_decodefetchurl(url, &qf, &token,&mloc) != 0) { - error(0, "MMS Send interface: failed to decode forward url (%s) from %s!", + mms_error(0, "MM1", NULL,"MMS Send interface: failed to decode forward url (%s) from %s!", url ? octstr_get_cstr(url) : "(null)", octstr_get_cstr(h->ip)); mresp = mms_sendconf("Error-permanent-message-not-found", "None", @@ -678,7 +678,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) if (!e || (mfwd = settings->qfs->mms_queue_getdata(e)) == NULL) { - error(0, + mms_error(0, "MM1", NULL, "MMS Send interface: failed to find envelope/data %s for forward url " "(%s) from %s (e=%s)!", octstr_get_cstr(qf), octstr_get_cstr(url), octstr_get_cstr(h->ip), @@ -691,7 +691,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) } else /* it is in mmbox, so get it from there. */ if ((mfwd = mms_mmbox_get(octstr_get_cstr(settings->mmbox_rootdir), octstr_get_cstr(h->client_addr), qf, &msize)) == NULL) { - error(0, "MMS Send interface: failed to find data in MMBOX %s, " + mms_error(0, "MM1", NULL,"MMS Send interface: failed to find data in MMBOX %s, " "forward_url=%s, from=%s (e=%s)!", octstr_get_cstr(qf), octstr_get_cstr(h->url), octstr_get_cstr(h->ip), (e)? "found" : "not found"); @@ -920,7 +920,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) status = octstr_imm("Retrieved"); if (!e) { - error(0, "MMS Send interface: Received notification type=%s " + mms_error(0, "MM1", NULL,"MMS Send interface: Received notification type=%s " "[url=%s, transid=%s, qf=%s] but could not find queue entry!\n", mms_message_type_to_cstr(mtype), octstr_get_cstr(h->url), octstr_get_cstr(transid), octstr_get_cstr(qf)); @@ -1049,13 +1049,13 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) if (!h->client_addr) { mresp = mms_storeconf("Error-service-denied", octstr_get_cstr(otransid), NULL, 0, menc); - error(0, "MMS Send interface (store): failed to find sender address in request from %s!", + mms_error(0, "MM1", NULL,"MMS Send interface (store): failed to find sender address in request from %s!", octstr_get_cstr(h->ip)); goto store_done; } if (mms_decodefetchurl(url, &qf, &token,&mloc) != 0) { - error(0, "MMS Send interface: failed to decode store url (%s) from %s!", + mms_error(0, "MM1", NULL,"MMS Send interface: failed to decode store url (%s) from %s!", octstr_get_cstr(url), octstr_get_cstr(h->ip)); mresp = mms_storeconf("Error-permanent-message-not-found", @@ -1069,7 +1069,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) if (!e || (mstore = settings->qfs->mms_queue_getdata(e)) == NULL) { - error(0, + mms_error(0, "MM1", NULL, "MMS Send interface: failed to find envelope/data %s for store url " "(%s) from %s (e=%s)!", octstr_get_cstr(qf), octstr_get_cstr(url), octstr_get_cstr(h->ip), @@ -1164,7 +1164,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) if (!h->client_addr) { mresp = mms_storeconf("Error-service-denied", octstr_get_cstr(otransid), NULL, 1, menc); - error(0, "MMS Send interface (upload): failed to find sender address in request from %s!", + mms_error(0, "MM1", NULL,"MMS Send interface (upload): failed to find sender address in request from %s!", octstr_get_cstr(h->ip)); goto upload_done; } @@ -1232,7 +1232,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) mresp = mms_deleteconf(menc, octstr_get_cstr(otransid)); if (!h->client_addr) { - error(0, "MMS Send interface (delete): failed to find sender address in request from %s!", + mms_error(0, "MM1", NULL,"MMS Send interface (delete): failed to find sender address in request from %s!", octstr_get_cstr(h->ip)); mms_replace_header_value(mresp, "X-Mms-Response-Status", "0Error-permanent-sending-address-unresolved"); @@ -1248,7 +1248,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) cl = octstr_format("%d%S", i, url); if (mms_decodefetchurl(url, &qf, &token,&mloc) != 0) { - error(0, "MMS Send interface: failed to decode delete url (%s) from %s!", + mms_error(0, "MM1", NULL,"MMS Send interface: failed to decode delete url (%s) from %s!", octstr_get_cstr(url), octstr_get_cstr(h->ip)); rs = octstr_format("%dError-permanent-message-not-found", i); @@ -1321,7 +1321,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h) MmsUaProfile *prof = NULL; if (!h->client_addr) { - error(0, "MMS Send interface (view): failed to find sender address in request from %s!", + mms_error(0, "MM1", NULL,"MMS Send interface (view): failed to find sender address in request from %s!", octstr_get_cstr(h->ip)); err = "Error-permanent-sending-address-unresolved"; @@ -1586,7 +1586,7 @@ static void mm7soap_dispatch(MmsHTTPClientInfo *h) h->ua, NULL); octstr_destroy(value); } else { - error(0, "Failed to convert received MM7/SOAP SubmitReq message from vasp=%s to MMS Message!", + mms_error(0, "MM7", NULL,"Failed to convert received MM7/SOAP SubmitReq message from vasp=%s to MMS Message!", octstr_get_cstr(h->vasp->id)); status = 4004; } @@ -1602,7 +1602,7 @@ static void mm7soap_dispatch(MmsHTTPClientInfo *h) if (!e->vaspid || octstr_compare(e->vaspid, h->vasp->id) != 0) { status = 2001; - error(0, "MMS Proxy(MM7): ReplaceReq: Found message[id=%s]" + mms_error(0, "MM7", NULL,"MMS Proxy(MM7): ReplaceReq: Found message[id=%s]" " but vaspid id=%s does not match!", octstr_get_cstr(msgid), octstr_get_cstr(h->vasp->id)); } else { /* get orig message, change headers of new, replace old. */ @@ -1615,13 +1615,13 @@ static void mm7soap_dispatch(MmsHTTPClientInfo *h) mms_add_missing_headers(new, hh); if (settings->qfs->mms_queue_replacedata(e, new) < 0) { status = 3000; - error(0, "MMS Proxy(MM7): ReplaceReq: Failed to change data, " + mms_error(0, "MM7", NULL, "MMS Proxy(MM7): ReplaceReq: Failed to change data, " "id=%s, vasp=%s!", msgid ? octstr_get_cstr(msgid) : "NULL", octstr_get_cstr(h->vasp->id)); } } else - warning(0, "MMS Proxy(MM7): ReplaceReq: No data sent??, " + mms_warning(0, "MM7", NULL,"MMS Proxy(MM7): ReplaceReq: No data sent??, " "id=%s, vasp=%s!", msgid ? octstr_get_cstr(msgid) : "NULL", octstr_get_cstr(h->vasp->id)); @@ -1644,7 +1644,7 @@ static void mm7soap_dispatch(MmsHTTPClientInfo *h) } } else { status = 2005; - error(0, "MMS Proxy(MM7): ReplaceReq: Failed to find msg, id=%s, vasp=%s!", + mms_error(0, "MM7", NULL,"MMS Proxy(MM7): ReplaceReq: Failed to find msg, id=%s, vasp=%s!", msgid ? octstr_get_cstr(msgid) : "NULL", octstr_get_cstr(h->vasp->id)); } @@ -1661,7 +1661,7 @@ static void mm7soap_dispatch(MmsHTTPClientInfo *h) if (!e->vaspid || octstr_compare(e->vaspid, h->vasp->id) != 0) { status = 2001; - error(0, "MMS Proxy(MM7): CancelReq: Found message[id=%s]" + mms_error(0, "MM7", NULL,"MMS Proxy(MM7): CancelReq: Found message[id=%s]" " but vaspid id=%s does not match!", octstr_get_cstr(msgid), octstr_get_cstr(h->vasp->id)); } else { /* Kill it. */ @@ -1677,7 +1677,7 @@ static void mm7soap_dispatch(MmsHTTPClientInfo *h) } } else { status = 2005; - error(0, "MMS Proxy(MM7): CancelReq: Failed to find msg, id=%s, vasp=%s!", + mms_error(0, "MM7", NULL,"MMS Proxy(MM7): CancelReq: Failed to find msg, id=%s, vasp=%s!", msgid ? octstr_get_cstr(msgid) : "NULL", octstr_get_cstr(h->vasp->id)); } @@ -1888,7 +1888,7 @@ static void mm7proxy(void *unused) octstr_imm("")); http_destroy_headers(hh); free_clientInfo(hx, 1); - info(0, "MMSC: Auth failed/VASP not found in MM7 incoming connection!"); + mms_info(0, "MM7", NULL, "MMSC: Auth failed/VASP not found in MM7 incoming connection!"); } else if (h.vasp->type == SOAP_VASP) gwthread_create((gwthread_func_t *)mm7soap_dispatch, hx); else diff --git a/mbuni/mmsc/mmsrelay.c b/mbuni/mmsc/mmsrelay.c index 04e0619..5bc570e 100644 --- a/mbuni/mmsc/mmsrelay.c +++ b/mbuni/mmsc/mmsrelay.c @@ -20,18 +20,18 @@ static int rstop = 0; /* Set to 1 to stop relay. */ int mmsrelay() { - info(0, " " MM_NAME " MMSC Relay version %s starting", MMSC_VERSION); + mms_info(0, "mmsrelay", NULL, " " MM_NAME " MMSC Relay version %s starting", MMSC_VERSION); /* Start global queue runner. */ - info(0, "Starting Global Queue Runner..."); + mms_info(0, "mmsrelay", NULL, "Starting Global Queue Runner..."); qthread = gwthread_create((gwthread_func_t *)mbuni_global_queue_runner, &rstop); /* Start the local queue runner. */ - info(0, "Starting Local Queue Runner..."); + mms_info(0, "mmsrelay", NULL,"Starting Local Queue Runner..."); mbuni_mm1_queue_runner(&rstop); gwthread_join(qthread); /* Wait for it to die... */ - info(0, "MMSC Relay MM1 queue runner terminates..."); + mms_info(0, "mmsrelay", NULL, "MMSC Relay MM1 queue runner terminates..."); return 0; } @@ -39,11 +39,7 @@ int mmsrelay() int stop_mmsrelay(void) { rstop = 1; - info(0, "Mmsrelay: Queue runners shutdown, cleanup commenced..."); + mms_info(0, "mmsrelay", NULL, "Mmsrelay: Queue runners shutdown, cleanup commenced..."); return 0; }; - - - - diff --git a/mbuni/mmsc/mmssend.c b/mbuni/mmsc/mmssend.c index ab29a71..bbab82b 100644 --- a/mbuni/mmsc/mmssend.c +++ b/mbuni/mmsc/mmssend.c @@ -91,8 +91,8 @@ int main(int argc, char *argv[]) octstr_destroy(fname); - info(0, "----------------------------------------"); - info(0, " MMSC Message sender runner version %s starting", MMSC_VERSION); + mms_info(0, "mmssend", NULL, "----------------------------------------"); + mms_info(0, "mmssend", NULL, " MMSC Message sender runner version %s starting", MMSC_VERSION); /* Load settings. */ @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) if (from == NULL || to == NULL) { - error(0, "Sender and recipient addresses required!\n"); + mms_error(0, "mmssend", NULL, "Sender and recipient addresses required!\n"); exit(-1); } else { /* fix up 'to' list */ List *l = gwlist_create();