From 5e84205190c0886815d8de292d18ec8cd074dcdf Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Tue, 17 Jul 2007 08:26:38 +0000 Subject: [PATCH] various fixes: mt mms filter, added sendmms cgi param --- mbuni/ChangeLog | 4 ++ mbuni/configure.ac | 1 + mbuni/doc/userguide.shtml | 67 ++++++++++++++++++++--- mbuni/mmlib/Makefile.am | 4 +- mbuni/mmlib/mms_cfg.def | 3 + mbuni/mmlib/mms_msg.c | 10 +++- mbuni/mmlib/mms_util.c | 32 ++++++++--- mbuni/mmlib/mms_util.h | 11 +++- mbuni/mmsbox/Makefile.am | 4 +- mbuni/mmsbox/bearerbox.c | 43 +-------------- mbuni/mmsbox/mmsbox.c | 74 +++++++++++++++++++------ mbuni/mmsbox/mmsbox_cfg.c | 97 +++++++++++++++++++++++++++++++++ mbuni/mmsbox/mmsbox_cfg.h | 7 ++- mbuni/mmsbox/mmsbox_mt_filter.c | 48 ++++++++++++++++ mbuni/mmsbox/mmsbox_mt_filter.h | 36 ++++++++++++ mbuni/mmsc/Makefile.am | 8 +-- 16 files changed, 363 insertions(+), 86 deletions(-) create mode 100644 mbuni/mmsbox/mmsbox_mt_filter.c create mode 100644 mbuni/mmsbox/mmsbox_mt_filter.h diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index ed2b1db..626c7b1 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,7 @@ +2007-07-13 P. A. Bagyenda + * Introduced ability to filter MT MMS on the VAS side using a generalized module. + * send-mms interface now allows you to push content by specifying a url using content-url CGI param. + * Various minor fixes. 2007-06-21 P. A. Bagyenda * Better configurability of MM7/SOAP namespace URI and MM7 version. 2007-06-12 P. A. Bagyenda diff --git a/mbuni/configure.ac b/mbuni/configure.ac index 9fb8420..d031e5c 100644 --- a/mbuni/configure.ac +++ b/mbuni/configure.ac @@ -37,6 +37,7 @@ dnl add mmlib to the include path INCLUDES='-I$(top_srcdir)/mmlib -I$(top_builddir)/mmlib' AC_SUBST([INCLUDES]) + dnl Checks for libraries. AC_CHECK_LIB([dl], [dlsym]) dnl AC_CHECK_LIB([iconv], [libiconv], [LIBS="$LIBS -liconv"]) diff --git a/mbuni/doc/userguide.shtml b/mbuni/doc/userguide.shtml index 2837477..8cf263e 100644 --- a/mbuni/doc/userguide.shtml +++ b/mbuni/doc/userguide.shtml @@ -1301,7 +1301,7 @@ lists all the configuration directives. The column Mode     - + detokenizer-library     @@ -1572,6 +1572,31 @@ Boolean     + + + mmsbox-mt-filter-library +     + + String +     + + + VAS GW +     + + + + Optional library to be used for filtering/transforming all content (except + SMIL), while building the MT MMS from a SMIL file. This is useful if say you want + to implement custom filtering/transformation of content (e.g. DRM + wrappers around selected content). Note that only elements + referenced within the returned SMIL are filtered. See + mmsbox_mt_filter.h for details. Also see + mm7-mt-filter-params config variable in the VAS specific + config section. +     + +

Built-in billing, resolver and detokenizer @@ -2202,6 +2227,23 @@ string + + + mm7-mt-filter-params + + + String + + + Parameter(s) to be passed to the init function of the MT + MMS filter module specified in mmsbox-mt-filter-libary + above. (See + mmsbox_mt_filter.h for details.) The init function is called once for each MMC + connection, and must return no error, otherwise no filtering will be + done on MT messages via this MMC. + + + @@ -2394,7 +2436,9 @@ faked-sender = 100
settings for the configured MMSCs. Note: The VAS Gateway considers that any MMSC can handle email and IP address recipient addresses and so routes messages to such destinations to the first - configured MMSC + configured MMSC. Note too that MT MMS filtering will not be + done on messages sent via the send-mms interface unless a particular + destination MMC is specified using this variable @@ -2449,6 +2493,15 @@ faked-sender = 100
+ + + content-url + + + If provided, specifies the URL of the content to be sent. + + + content @@ -2509,7 +2562,7 @@ faked-sender = 100
allow-adaptations - + Should be 1 (yes) or 0 (no). This flag will be passed on to the operator MMSC (MM7/SOAP only) to turn on/off content adapation. @@ -2520,10 +2573,10 @@ faked-sender = 100

- Note: You should specify only one - of text, smil or content, as only one of - them makes sense at any time. specifying more than one causes others - to be ignored. + Note: Only one + of text, smil, content-url or + content should be speficied, as only one makes sense at any time. Specifying more than one causes others + to be (silently) ignored.

diff --git a/mbuni/mmlib/Makefile.am b/mbuni/mmlib/Makefile.am index 9d7a942..83f8557 100644 --- a/mbuni/mmlib/Makefile.am +++ b/mbuni/mmlib/Makefile.am @@ -1,4 +1,4 @@ -noinst_LTLIBRARIES = libmms.la -libmms_la_SOURCES = mms_mmbox.c mms_msg.c mms_queue.c mms_strings.c mms_uaprof.c mms_util.c mms_mm7soap.c mms_cfg.c +noinst_LIBRARIES = libmms.a +libmms_a_SOURCES = mms_mmbox.c mms_msg.c mms_queue.c mms_strings.c mms_uaprof.c mms_util.c mms_mm7soap.c mms_cfg.c EXTRA_DIST=mms_strings.def mms_mm7soap.h mms_mmbox.h mms_msg.h mms_queue.h mms_strings.h mms_uaprof.h mms_util.h mms_cfg.h mms_cfg.def diff --git a/mbuni/mmlib/mms_cfg.def b/mbuni/mmlib/mms_cfg.def index e2b57e1..324380f 100644 --- a/mbuni/mmlib/mms_cfg.def +++ b/mbuni/mmlib/mms_cfg.def @@ -84,6 +84,8 @@ SINGLE_GROUP(mbuni, OCTSTR(sendmms-port) OCTSTR(sendmms-port-ssl) + + OCTSTR(mmsbox-mt-filter-library) ) MULTI_GROUP(mmsproxy, @@ -131,6 +133,7 @@ MULTI_GROUP(mmsc, OCTSTR(type) OCTSTR(mm7-version) OCTSTR(mm7-soap-xmlns) + OCTSTR(mm7-mt-filter-params) ) MULTI_GROUP(mms-service, diff --git a/mbuni/mmlib/mms_msg.c b/mbuni/mmlib/mms_msg.c index 238dc12..4516444 100644 --- a/mbuni/mmlib/mms_msg.c +++ b/mbuni/mmlib/mms_msg.c @@ -1288,6 +1288,14 @@ static void unconvert_mime_msg(MIMEEntity *m) else if (octstr_case_compare(content_type, octstr_imm("multipart/mixed")) == 0) s = "application/vnd.wap.multipart.mixed"; + else if (octstr_case_search(content_type, octstr_imm("application/vnd.drm."), 0) == 0 && + mime_entity_num_parts(m) > 0) { /* fixup drm that might have been screwed up. */ + Octstr *x = mime_entity_body(m); + while (mime_entity_num_parts(m) > 0) /* remove them all. this message must not be parsed as mime. */ + mime_entity_remove_part(m, 0); + mime_entity_set_body(m, x); + octstr_destroy(x); + } octstr_destroy(content_type); } @@ -1329,7 +1337,7 @@ MIMEEntity *mms_tomime(MmsMsg *msg, int base64) } convert_mime_msg(m); if (base64) - base64_mimeparts(m); + base64_mimeparts(m,0); return m; } diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index f41ff8b..240187f 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -423,14 +423,14 @@ int _mms_gw_isprint(int c) /* Change content coding for mime entities that need it. */ -void base64_mimeparts(MIMEEntity *m) +void base64_mimeparts(MIMEEntity *m, int all) { int i, n; if ((n = mime_entity_num_parts(m)) > 0) for (i = 0; i%s]!", + *error = octstr_format("Failed to deliver to MMC[url=%S, id=%S], status=[%d=>%s]!", mmc->mmsc_url, mmc->id, tstatus, @@ -737,7 +737,8 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, Octstr *to, if (ret) mms_log2("Sent", from, to, -1, ret, NULL, mmc->id, "MMSBox", NULL, NULL); - info(0, "Sent to MMC[%s], code=[%d], resp=[%s] msgid [%s]", octstr_get_cstr(mmc->id), + info(0, "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)"); if (rh) @@ -806,44 +807,6 @@ static int mms_sendtommsc(MmscGrp *mmc, Octstr *from, Octstr *to, Octstr *transi return ret; } -/* Get the MMC that should handler this recipient. */ -static MmscGrp *get_handler_mmc(Octstr *id, Octstr *to) -{ - MmscGrp *mmc = NULL; - int i, j, n; - Octstr *phonenum = NULL; - - if (id) - for (i = 0, n = gwlist_len(mmscs); i < n; i++) - if ((mmc = gwlist_get(mmscs, i)) != NULL && - mmc->id && octstr_compare(mmc->id, id) == 0) - return mmc; - - if (octstr_search_char(to, '@', 0) > 0 || - octstr_case_search(to, octstr_imm("/TYPE=IPv"), 0) > 0) /* For emails, or ip take first mmsc. */ - return gwlist_get(mmscs, 0); - - j = octstr_case_search(to, octstr_imm("/TYPE=PLMN"), 0); - - if (j > 0 && j - 1 + sizeof "/TYPE=PLMN" == octstr_len(to)) - phonenum = octstr_copy(to, 0, j); - else - phonenum = octstr_duplicate(to); - - normalize_number(octstr_get_cstr(unified_prefix), &phonenum); - - for (i = 0, n = gwlist_len(mmscs); i < n; i++) - if ((mmc = gwlist_get(mmscs, i)) != NULL && - (mmc->allowed_prefix == NULL || - does_prefix_match(mmc->allowed_prefix, phonenum)) && - (mmc->denied_prefix == NULL || - !does_prefix_match(mmc->denied_prefix, phonenum))) - return mmc; - - if (phonenum) - octstr_destroy(phonenum); - return NULL; -} static int sendMsg(MmsEnvelope *e) { diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 31927d4..8a81f7e 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -299,6 +299,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, Octstr *svc_name, Octstr *faked_sender, Octstr *service_code, int accept_x_headers, List *passthro_headers, + Octstr *mmc_id, Octstr **err); static int fetch_serviceurl(MmsEnvelope *e, MmsService *ms, MmsMsg *m, @@ -424,7 +425,7 @@ static int fetch_serviceurl(MmsEnvelope *e, res = make_and_queue_msg(rb, ctype, rph, base_url, typ, e, ms->name, ms->faked_sender, ms->service_code, ms->accept_x_headers, ms->passthro_headers, - err); + e->fromproxy, err); if (base_url) octstr_destroy(base_url); @@ -658,7 +659,9 @@ static int has_url_scheme(char *url) static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, Octstr *top_url, - int type, Octstr *svc_name, Dict *url_map) + int type, Octstr *svc_name, + Octstr *mmc_id, + Dict *url_map) { Octstr *curl = NULL, *ctype = NULL, *body = NULL; char *src = NULL; @@ -729,7 +732,8 @@ static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, } if (ctype && body) { /* If we got it, put it in. */ - Octstr *attr = octstr_format("cid:%06d", ++cntr); + char *fext = content_type2file_ext(ctype); + Octstr *attr = octstr_format("cid:%06d.%s", ++cntr,fext); char *p = octstr_get_cstr(attr) + 4; Octstr *cid_header_val = octstr_format("<%s>", p); MIMEEntity *x = mime_entity_create(); @@ -737,10 +741,18 @@ static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, http_header_add(headers, "Content-Type", octstr_get_cstr(ctype)); http_header_add(headers, "Content-ID", octstr_get_cstr(cid_header_val)); + http_header_add(headers, "Content-Location", p); mime_replace_headers(x, headers); mime_entity_set_body(x, body); - + + if (mt_filter && mmc_id) + mt_filter->filter(&x, curl, mmc_id); +#if 1 + /* show it. */ + Octstr *_x = mime_entity_to_octstr(x); + octstr_dump(_x,0); +#endif mime_entity_add_part(res, x); mime_entity_destroy(x); @@ -767,15 +779,18 @@ done: /* Traverse the tree doing the above. */ static void add_msg_parts(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, Octstr *top_url, - int type, Octstr *svc_name, Dict *url_map) + int type, Octstr *svc_name, + Octstr *mmc_id, + Dict *url_map) { xmlNodePtr n; /* Do all the children recursively, then come back and do parent. */ for (n = node; n; n = n->next) - if (n->type != XML_COMMENT_NODE) { - add_msg_part(res, n, base_url, top_url, type, svc_name, url_map); - add_msg_parts(res, n->xmlChildrenNode, base_url, top_url, type, svc_name, url_map); - } + if (n->type != XML_COMMENT_NODE) { + add_msg_part(res, n, base_url, top_url, type, svc_name, mmc_id, url_map); + add_msg_parts(res, n->xmlChildrenNode, base_url, top_url, type, + svc_name, mmc_id, url_map); + } } /* Given content, make a message. We'll also use this for send-mms-user! */ @@ -783,6 +798,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, Octstr *base_url, int type, MmsEnvelope *e, Octstr *svc_name, Octstr *faked_sender, Octstr *service_code, int accept_x_headers, List *passthro_headers, + Octstr *mmc_id, Octstr **err) { Octstr *from = NULL, *subject = NULL, *turl = get_toplevel_url(base_url); @@ -850,7 +866,9 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, goto done; } - add_msg_parts(me, smil->xmlChildrenNode, base_url, turl, type, svc_name, url_map); + add_msg_parts(me, smil->xmlChildrenNode, + base_url, turl, type, svc_name, + mmc_id, url_map); dict_destroy(url_map); /* SMIL has been modified, convert it to text, put it in. */ @@ -1097,6 +1115,8 @@ static void sendmms_func(void *unused) if ((base_url = http_cgi_variable(cgivars, "base-url")) == NULL) base_url = octstr_imm("http://localhost"); + else + base_url = octstr_duplicate(base_url); /* because we need to delete it below. */ if ((data = http_cgi_variable(cgivars, "text")) != NULL) { /* text. */ Octstr *charset = http_cgi_variable(cgivars, "charset"); @@ -1106,7 +1126,24 @@ static void sendmms_func(void *unused) octstr_format_append(ctype, "; charset=%S", charset); } else if ((data = http_cgi_variable(cgivars, "smil")) != NULL) /* smil. */ ctype = octstr_imm("application/smil"); - else if ((data = http_cgi_variable(cgivars, "content")) != NULL) { /* any content. */ + else if ((data = http_cgi_variable(cgivars, "content-url")) != NULL) { /* arbitrary content. */ + List *rh = http_create_empty_headers(), *rph = NULL; + Octstr *reply = NULL, *params = NULL; + + http_header_add(rh, "User-Agent", MM_NAME "/" VERSION); + + if (mmsbox_url_fetch_content(HTTP_METHOD_GET, data, rh, octstr_imm(""), &rph, &reply) == HTTP_OK) + get_content_type(rph, &ctype, ¶ms); + else + rb = octstr_format("failed to fetch content from url [%S]!", data); + base_url = url_path_prefix(data, URL_TYPE); + + data = reply; + + http_destroy_headers(rh); + http_destroy_headers(rph); + octstr_destroy(params); + } else if ((data = http_cgi_variable(cgivars, "content")) != NULL) { /* any content. */ Octstr *_xctype = NULL; /* ... because cgi var stuff is destroyed elsewhere, we must dup it !! */ /* If the user sent us a content element, then they should have @@ -1115,8 +1152,7 @@ static void sendmms_func(void *unused) */ if ((_xctype = http_cgi_variable(cgivars, "content_type")) == NULL) if (cgivar_ctypes) - _xctype = http_cgi_variable(cgivar_ctypes, "content"); - + _xctype = http_cgi_variable(cgivar_ctypes, "content"); if (_xctype) ctype = octstr_duplicate(_xctype); } else if (body && tparse != 0) { /* if all above fails, @@ -1177,7 +1213,9 @@ static void sendmms_func(void *unused) res = make_and_queue_msg(data, ctype, rh, base_url, URL_TYPE, NULL, vasid ? vasid : octstr_imm("sendmms-user"), u->faked_sender, service_code, - 1, NULL, &err); + 1, NULL, + mmc, + &err); if (res < 0) rb = octstr_imm("Error in message conversion"); } else if (!rb) @@ -1190,10 +1228,10 @@ static void sendmms_func(void *unused) if (rh) http_destroy_headers(rh); - if (ctype) - octstr_destroy(ctype); - if (rb) - octstr_destroy(rb); + + octstr_destroy(ctype); + octstr_destroy(rb); + octstr_destroy(base_url); } else { http_send_reply(client, HTTP_UNAUTHORIZED, hh, octstr_imm("Authentication failed")); diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index e3ff00c..f180f80 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -23,6 +23,7 @@ #include "mmsbox_cfg.h" #include "mms_queue.h" + List *sendmms_users = NULL; /* list of SendMmsUser structs */ List *mms_services = NULL; /* list of MMS Services */ List *mmscs = NULL; @@ -34,6 +35,45 @@ Octstr *unified_prefix; struct SendMmsPortInfo sendmms_port; +struct MmsBoxMTfilter *mt_filter = NULL; + +static void *load_module(mCfgGrp *grp, char *config_key, + char *symbolname) +{ + Octstr *s = NULL; + void *retval = NULL; + + s = mms_cfg_get(grp, octstr_imm(config_key)); + + if (s) { + void *x; + void *y = NULL; +#ifdef __APPLE__ + char sbuf[512]; +#endif + x = dlopen(octstr_get_cstr(s), RTLD_LAZY); +#ifdef __APPLE__ + sprintf(sbuf, "_%s", symbolname); +#endif + if (x == NULL || ((y = dlsym(x, symbolname)) == NULL +#ifdef __APPLE__ /* fink version of dlsym has issues it seems. */ + && (y = dlsym(x, sbuf)) == NULL +#endif + )) + + panic(0, + "Error, unable to load dynamic libary (%s): " + "libhandle is %s, funcs is %s, err=%s", + octstr_get_cstr(s), + x ? "OK" : "Not OK", y ? "OK" : "Not OK", dlerror()); + else + retval = y; + octstr_destroy(s); + } + + return retval; +} + int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func) { mCfgGrp *grp = mms_cfg_get_single(cfg, octstr_imm("mbuni")); @@ -116,6 +156,10 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func) sendmms_port.allow_ip = mms_cfg_get(grp, octstr_imm("allow-ip")); sendmms_port.deny_ip = mms_cfg_get(grp, octstr_imm("deny-ip")); + /* load the filter if any. */ + if ((mt_filter = load_module(grp, "mmsbox-mt-filter-library", "mmsbox_mt_filter")) != NULL) + info(0, "MMSBox: Loaded MT Filter [%s]", mt_filter->name); + /* Now get sendmms users. */ l = mms_cfg_get_multi(cfg, octstr_imm("send-mms-user")); @@ -225,6 +269,20 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func) } else m->threadid = -1; + /* Init for filter. */ + if ((s = mms_cfg_get(x, octstr_imm("mm7-mt-filter-params"))) != NULL) { + if (mt_filter) + m->use_mt_filter = (mt_filter->init(m->mmsc_url, m->id, s) == 1); + else + panic(0, "MMSBox: mt-filter-params set for MMSC[%s] but no MT-filter lib " + "specified!", + octstr_get_cstr(m->id)); + if (!m->use_mt_filter) + warning(0, "MMSBox: MT MMS filter turned off for MMSC[%s]. Init failed", + octstr_get_cstr(m->id)); + octstr_destroy(s); + } else + m->use_mt_filter = 0; m->mutex = mutex_create(); gwlist_append(mmscs, m); } @@ -369,3 +427,42 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func) return 0; } + +/* Get the MMC that should handler this recipient. */ +MmscGrp *get_handler_mmc(Octstr *id, Octstr *to) +{ + MmscGrp *mmc = NULL; + int i, j, n; + Octstr *phonenum = NULL; + + if (id) + for (i = 0, n = gwlist_len(mmscs); i < n; i++) + if ((mmc = gwlist_get(mmscs, i)) != NULL && + mmc->id && octstr_compare(mmc->id, id) == 0) + return mmc; + + if (octstr_search_char(to, '@', 0) > 0 || + octstr_case_search(to, octstr_imm("/TYPE=IPv"), 0) > 0) /* For emails, or ip take first mmsc. */ + return gwlist_get(mmscs, 0); + + j = octstr_case_search(to, octstr_imm("/TYPE=PLMN"), 0); + + if (j > 0 && j - 1 + sizeof "/TYPE=PLMN" == octstr_len(to)) + phonenum = octstr_copy(to, 0, j); + else + phonenum = octstr_duplicate(to); + + normalize_number(octstr_get_cstr(unified_prefix), &phonenum); + + for (i = 0, n = gwlist_len(mmscs); i < n; i++) + if ((mmc = gwlist_get(mmscs, i)) != NULL && + (mmc->allowed_prefix == NULL || + does_prefix_match(mmc->allowed_prefix, phonenum)) && + (mmc->denied_prefix == NULL || + !does_prefix_match(mmc->denied_prefix, phonenum))) + return mmc; + + if (phonenum) + octstr_destroy(phonenum); + return NULL; +} diff --git a/mbuni/mmsbox/mmsbox_cfg.h b/mbuni/mmsbox/mmsbox_cfg.h index 909c4c0..ed5033a 100644 --- a/mbuni/mmsbox/mmsbox_cfg.h +++ b/mbuni/mmsbox/mmsbox_cfg.h @@ -13,7 +13,7 @@ #ifndef __MMSBOX_CFG_INCLUDED__ #define __MMSBOX_CFG_INCLUDED__ #include "mms_util.h" - +#include "mmsbox_mt_filter.h" typedef struct MmscGrp { Octstr *id; /* MMSC id (for logging). */ Octstr *group_id; /* GROUP MMSC id (used for qf). */ @@ -30,7 +30,7 @@ typedef struct MmscGrp { long threadid; /* handler thread. */ MM7Version_t ver; /* supported MM7/SOAP version. */ - + int use_mt_filter; /* whether to use MT filter on this connection. */ Mutex *mutex; } MmscGrp; @@ -86,6 +86,7 @@ extern struct SendMmsPortInfo { Octstr *deny_ip; } sendmms_port; - +extern struct MmsBoxMTfilter *mt_filter; extern int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func); +extern MmscGrp *get_handler_mmc(Octstr *id, Octstr *to); #endif diff --git a/mbuni/mmsbox/mmsbox_mt_filter.c b/mbuni/mmsbox/mmsbox_mt_filter.c new file mode 100644 index 0000000..86c1de4 --- /dev/null +++ b/mbuni/mmsbox/mmsbox_mt_filter.c @@ -0,0 +1,48 @@ +/* + * Mbuni - Open Source MMS Gateway + * + * Empty wrapper library + * + * Copyright (C) 20078 - , Digital Solutions Ltd. - http://www.dsmagic.com + * + * Paul Bagyenda + * + * This program is proprietary software, refer to licence holder for details + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include "mmsbox_mt_filter.h" + +static int myinit(Octstr *mmc_url, Octstr *mmc_id, Octstr *startup_params) +{ + return 0; +} + + +static int myfilter(MIMEEntity **msg, Octstr *loc_url, Octstr *mmc_id) +{ + + return 0; +} + +static void myclose(Octstr *mmc_id) +{ + return; +} + +struct MmsBoxMTfilter mmsbox_mt_filter = { + .name = "Empty Wrapper", + .init = myinit, + .filter = myfilter, + .destroy = myclose +}; diff --git a/mbuni/mmsbox/mmsbox_mt_filter.h b/mbuni/mmsbox/mmsbox_mt_filter.h new file mode 100644 index 0000000..b0419b8 --- /dev/null +++ b/mbuni/mmsbox/mmsbox_mt_filter.h @@ -0,0 +1,36 @@ +/* + * Mbuni - Open Source MMS Gateway + * + * MMSBOX MT MMS filter: Optional filter for MT messages + * + * Copyright (C) 2003 - 2005, 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 __MMSMT_FILTER_INCLUDED__ +#define __MMSMT_FILTER_INCLUDED__ +#include "mms_util.h" + +struct MmsBoxMTfilter { + /* name of filter. */ + char *name; + /* Init: called once for each mmc to determine if to use filter on MT MMS via the particular MMC. Returns 1 + * on success, error otherwise + */ + int (*init)(Octstr *mmc_url, Octstr *mmc_id, Octstr *startup_params); + + /* filter: Filter/transform the message. Return 0 on success. May modify the message itself of course */ + int (*filter)(MIMEEntity **msg, Octstr *loc_url, Octstr *mmc_id); + + /* destroy this mmc's settings in filter. */ + void (*destroy)(Octstr *mmc_id); +}; + +/* Each module must export this symbol, a pointer to the structure. + * WARNING: Ensure your module is thread-safe + */ +extern struct MmsBoxMTfilter mmsbox_mt_filter; +#endif diff --git a/mbuni/mmsc/Makefile.am b/mbuni/mmsc/Makefile.am index 7859148..e6eb9b5 100644 --- a/mbuni/mmsc/Makefile.am +++ b/mbuni/mmsc/Makefile.am @@ -1,8 +1,8 @@ -libmms = $(top_builddir)/mmlib/libmms.la -libmmsc = libmmsc.la +libmms = $(top_builddir)/mmlib/libmms.a +libmmsc = libmmsc.a -noinst_LTLIBRARIES = libmmsc.la -libmmsc_la_SOURCES = mmsc_cfg.c mms_detokenize.c mms_resolve.c mms_billing.c mms_detokenize_shell.c mms_resolve_shell.c mms_billing_shell.c +noinst_LIBRARIES = libmmsc.a +libmmsc_a_SOURCES = mmsc_cfg.c mms_detokenize.c mms_resolve.c mms_billing.c mms_detokenize_shell.c mms_resolve_shell.c mms_billing_shell.c bin_PROGRAMS = mmsrelay mmsproxy mmsfromemail mmssend mmsrelay_SOURCES = mmsglobalsender.c mmsmobilesender.c mmsrelay.c