Re-organisation of functions and files in preparation for adding MMSBox functionality
This commit is contained in:
parent
ebe98efd32
commit
7dd3546ab3
|
@ -1,10 +1,5 @@
|
||||||
noinst_LIBRARIES = libmms.a
|
noinst_LIBRARIES = libmms.a
|
||||||
libmms_a_SOURCES = mms_mmbox.h mms_mmbox.c mms_billing.c mms_billing.h mms_msg.c mms_msg.h mms_queue.c mms_queue.h mms_strings.c mms_strings.h mms_uaprof.c mms_uaprof.h mms_util.c mms_util.h mms_resolve.h mms_resolve.c mms_mm7soap.c mms_detokenize.h mms_mm7soap.h
|
libmms_a_SOURCES = mms_mmbox.h mms_mmbox.c mms_msg.c mms_msg.h mms_queue.c mms_queue.h mms_strings.c mms_strings.h mms_uaprof.c mms_uaprof.h mms_util.c mms_util.h mms_mm7soap.c mms_mm7soap.h
|
||||||
|
|
||||||
plugindir = $(libdir)/mbuni
|
|
||||||
plugin_LTLIBRARIES = libmms_billing_shell.la libmms_resolve_shell.la libmms_detokenize_shell.la
|
|
||||||
libmms_billing_shell_la_SOURCES = mms_billing_shell.c
|
|
||||||
libmms_resolve_shell_la_SOURCES = mms_resolve_shell.c
|
|
||||||
libmms_detokenize_shell_la_SOURCES = mms_detokenize_shell.c
|
|
||||||
|
|
||||||
EXTRA_DIST=mms_strings.def
|
EXTRA_DIST=mms_strings.def
|
||||||
|
|
|
@ -14,8 +14,7 @@
|
||||||
|
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
|
SOURCES = $(libmms_a_SOURCES)
|
||||||
SOURCES = $(libmms_a_SOURCES) $(libmms_billing_shell_la_SOURCES) $(libmms_detokenize_shell_la_SOURCES) $(libmms_resolve_shell_la_SOURCES)
|
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
|
@ -52,32 +51,10 @@ LIBRARIES = $(noinst_LIBRARIES)
|
||||||
ARFLAGS = cru
|
ARFLAGS = cru
|
||||||
libmms_a_AR = $(AR) $(ARFLAGS)
|
libmms_a_AR = $(AR) $(ARFLAGS)
|
||||||
libmms_a_LIBADD =
|
libmms_a_LIBADD =
|
||||||
am_libmms_a_OBJECTS = mms_mmbox.$(OBJEXT) mms_billing.$(OBJEXT) \
|
am_libmms_a_OBJECTS = mms_mmbox.$(OBJEXT) mms_msg.$(OBJEXT) \
|
||||||
mms_msg.$(OBJEXT) mms_queue.$(OBJEXT) mms_strings.$(OBJEXT) \
|
mms_queue.$(OBJEXT) mms_strings.$(OBJEXT) mms_uaprof.$(OBJEXT) \
|
||||||
mms_uaprof.$(OBJEXT) mms_util.$(OBJEXT) mms_resolve.$(OBJEXT) \
|
mms_util.$(OBJEXT) mms_mm7soap.$(OBJEXT)
|
||||||
mms_mm7soap.$(OBJEXT)
|
|
||||||
libmms_a_OBJECTS = $(am_libmms_a_OBJECTS)
|
libmms_a_OBJECTS = $(am_libmms_a_OBJECTS)
|
||||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
|
||||||
am__vpath_adj = case $$p in \
|
|
||||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
|
||||||
*) f=$$p;; \
|
|
||||||
esac;
|
|
||||||
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
|
|
||||||
am__installdirs = "$(DESTDIR)$(plugindir)"
|
|
||||||
pluginLTLIBRARIES_INSTALL = $(INSTALL)
|
|
||||||
LTLIBRARIES = $(plugin_LTLIBRARIES)
|
|
||||||
libmms_billing_shell_la_LIBADD =
|
|
||||||
am_libmms_billing_shell_la_OBJECTS = mms_billing_shell.lo
|
|
||||||
libmms_billing_shell_la_OBJECTS = \
|
|
||||||
$(am_libmms_billing_shell_la_OBJECTS)
|
|
||||||
libmms_detokenize_shell_la_LIBADD =
|
|
||||||
am_libmms_detokenize_shell_la_OBJECTS = mms_detokenize_shell.lo
|
|
||||||
libmms_detokenize_shell_la_OBJECTS = \
|
|
||||||
$(am_libmms_detokenize_shell_la_OBJECTS)
|
|
||||||
libmms_resolve_shell_la_LIBADD =
|
|
||||||
am_libmms_resolve_shell_la_OBJECTS = mms_resolve_shell.lo
|
|
||||||
libmms_resolve_shell_la_OBJECTS = \
|
|
||||||
$(am_libmms_resolve_shell_la_OBJECTS)
|
|
||||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
am__depfiles_maybe = depfiles
|
am__depfiles_maybe = depfiles
|
||||||
|
@ -89,12 +66,8 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||||
CCLD = $(CC)
|
CCLD = $(CC)
|
||||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
SOURCES = $(libmms_a_SOURCES) $(libmms_billing_shell_la_SOURCES) \
|
SOURCES = $(libmms_a_SOURCES)
|
||||||
$(libmms_detokenize_shell_la_SOURCES) \
|
DIST_SOURCES = $(libmms_a_SOURCES)
|
||||||
$(libmms_resolve_shell_la_SOURCES)
|
|
||||||
DIST_SOURCES = $(libmms_a_SOURCES) $(libmms_billing_shell_la_SOURCES) \
|
|
||||||
$(libmms_detokenize_shell_la_SOURCES) \
|
|
||||||
$(libmms_resolve_shell_la_SOURCES)
|
|
||||||
ETAGS = etags
|
ETAGS = etags
|
||||||
CTAGS = ctags
|
CTAGS = ctags
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
@ -197,12 +170,7 @@ sharedstatedir = @sharedstatedir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
target_alias = @target_alias@
|
target_alias = @target_alias@
|
||||||
noinst_LIBRARIES = libmms.a
|
noinst_LIBRARIES = libmms.a
|
||||||
libmms_a_SOURCES = mms_mmbox.h mms_mmbox.c mms_billing.c mms_billing.h mms_msg.c mms_msg.h mms_queue.c mms_queue.h mms_strings.c mms_strings.h mms_uaprof.c mms_uaprof.h mms_util.c mms_util.h mms_resolve.h mms_resolve.c mms_mm7soap.c mms_detokenize.h mms_mm7soap.h
|
libmms_a_SOURCES = mms_mmbox.h mms_mmbox.c mms_msg.c mms_msg.h mms_queue.c mms_queue.h mms_strings.c mms_strings.h mms_uaprof.c mms_uaprof.h mms_util.c mms_util.h mms_mm7soap.c mms_mm7soap.h
|
||||||
plugindir = $(libdir)/mbuni
|
|
||||||
plugin_LTLIBRARIES = libmms_billing_shell.la libmms_resolve_shell.la libmms_detokenize_shell.la
|
|
||||||
libmms_billing_shell_la_SOURCES = mms_billing_shell.c
|
|
||||||
libmms_resolve_shell_la_SOURCES = mms_resolve_shell.c
|
|
||||||
libmms_detokenize_shell_la_SOURCES = mms_detokenize_shell.c
|
|
||||||
EXTRA_DIST = mms_strings.def
|
EXTRA_DIST = mms_strings.def
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
|
@ -244,39 +212,6 @@ libmms.a: $(libmms_a_OBJECTS) $(libmms_a_DEPENDENCIES)
|
||||||
-rm -f libmms.a
|
-rm -f libmms.a
|
||||||
$(libmms_a_AR) libmms.a $(libmms_a_OBJECTS) $(libmms_a_LIBADD)
|
$(libmms_a_AR) libmms.a $(libmms_a_OBJECTS) $(libmms_a_LIBADD)
|
||||||
$(RANLIB) libmms.a
|
$(RANLIB) libmms.a
|
||||||
install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
|
|
||||||
@$(NORMAL_INSTALL)
|
|
||||||
test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)"
|
|
||||||
@list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
|
|
||||||
if test -f $$p; then \
|
|
||||||
f=$(am__strip_dir) \
|
|
||||||
echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \
|
|
||||||
$(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \
|
|
||||||
else :; fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-pluginLTLIBRARIES:
|
|
||||||
@$(NORMAL_UNINSTALL)
|
|
||||||
@set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
|
|
||||||
p=$(am__strip_dir) \
|
|
||||||
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \
|
|
||||||
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
clean-pluginLTLIBRARIES:
|
|
||||||
-test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
|
|
||||||
@list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
|
|
||||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
|
||||||
test "$$dir" != "$$p" || dir=.; \
|
|
||||||
echo "rm -f \"$${dir}/so_locations\""; \
|
|
||||||
rm -f "$${dir}/so_locations"; \
|
|
||||||
done
|
|
||||||
libmms_billing_shell.la: $(libmms_billing_shell_la_OBJECTS) $(libmms_billing_shell_la_DEPENDENCIES)
|
|
||||||
$(LINK) -rpath $(plugindir) $(libmms_billing_shell_la_LDFLAGS) $(libmms_billing_shell_la_OBJECTS) $(libmms_billing_shell_la_LIBADD) $(LIBS)
|
|
||||||
libmms_detokenize_shell.la: $(libmms_detokenize_shell_la_OBJECTS) $(libmms_detokenize_shell_la_DEPENDENCIES)
|
|
||||||
$(LINK) -rpath $(plugindir) $(libmms_detokenize_shell_la_LDFLAGS) $(libmms_detokenize_shell_la_OBJECTS) $(libmms_detokenize_shell_la_LIBADD) $(LIBS)
|
|
||||||
libmms_resolve_shell.la: $(libmms_resolve_shell_la_OBJECTS) $(libmms_resolve_shell_la_DEPENDENCIES)
|
|
||||||
$(LINK) -rpath $(plugindir) $(libmms_resolve_shell_la_LDFLAGS) $(libmms_resolve_shell_la_OBJECTS) $(libmms_resolve_shell_la_LIBADD) $(LIBS)
|
|
||||||
|
|
||||||
mostlyclean-compile:
|
mostlyclean-compile:
|
||||||
-rm -f *.$(OBJEXT)
|
-rm -f *.$(OBJEXT)
|
||||||
|
@ -284,15 +219,10 @@ mostlyclean-compile:
|
||||||
distclean-compile:
|
distclean-compile:
|
||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_billing.Po@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_billing_shell.Plo@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_detokenize_shell.Plo@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_mm7soap.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_mm7soap.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_mmbox.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_mmbox.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_msg.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_msg.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_queue.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_queue.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_resolve.Po@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_resolve_shell.Plo@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_strings.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_strings.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_uaprof.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_uaprof.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_util.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_util.Po@am__quote@
|
||||||
|
@ -405,11 +335,8 @@ distdir: $(DISTFILES)
|
||||||
done
|
done
|
||||||
check-am: all-am
|
check-am: all-am
|
||||||
check: check-am
|
check: check-am
|
||||||
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES)
|
all-am: Makefile $(LIBRARIES)
|
||||||
installdirs:
|
installdirs:
|
||||||
for dir in "$(DESTDIR)$(plugindir)"; do \
|
|
||||||
test -z "$$dir" || $(mkdir_p) "$$dir"; \
|
|
||||||
done
|
|
||||||
install: install-am
|
install: install-am
|
||||||
install-exec: install-exec-am
|
install-exec: install-exec-am
|
||||||
install-data: install-data-am
|
install-data: install-data-am
|
||||||
|
@ -437,7 +364,7 @@ maintainer-clean-generic:
|
||||||
clean: clean-am
|
clean: clean-am
|
||||||
|
|
||||||
clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
|
clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
|
||||||
clean-pluginLTLIBRARIES mostlyclean-am
|
mostlyclean-am
|
||||||
|
|
||||||
distclean: distclean-am
|
distclean: distclean-am
|
||||||
-rm -rf ./$(DEPDIR)
|
-rm -rf ./$(DEPDIR)
|
||||||
|
@ -455,7 +382,7 @@ info: info-am
|
||||||
|
|
||||||
info-am:
|
info-am:
|
||||||
|
|
||||||
install-data-am: install-pluginLTLIBRARIES
|
install-data-am:
|
||||||
|
|
||||||
install-exec-am:
|
install-exec-am:
|
||||||
|
|
||||||
|
@ -483,20 +410,19 @@ ps: ps-am
|
||||||
|
|
||||||
ps-am:
|
ps-am:
|
||||||
|
|
||||||
uninstall-am: uninstall-info-am uninstall-pluginLTLIBRARIES
|
uninstall-am: uninstall-info-am
|
||||||
|
|
||||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||||
clean-libtool clean-noinstLIBRARIES clean-pluginLTLIBRARIES \
|
clean-libtool clean-noinstLIBRARIES ctags distclean \
|
||||||
ctags distclean distclean-compile distclean-generic \
|
distclean-compile distclean-generic distclean-libtool \
|
||||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||||
html-am info info-am install install-am install-data \
|
install install-am install-data install-data-am install-exec \
|
||||||
install-data-am install-exec install-exec-am install-info \
|
install-exec-am install-info install-info-am install-man \
|
||||||
install-info-am install-man install-pluginLTLIBRARIES \
|
|
||||||
install-strip installcheck installcheck-am installdirs \
|
install-strip installcheck installcheck-am installdirs \
|
||||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||||
uninstall-info-am uninstall-pluginLTLIBRARIES
|
uninstall-info-am
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
|
|
@ -340,7 +340,7 @@ static void output_rcpt(char *hdr, List *hdrs, Octstr *p)
|
||||||
http_destroy_headers(l);
|
http_destroy_headers(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define XMLNSMM7 "http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0"
|
#define XMLNSMM7 "http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2"
|
||||||
/* Construct by hand. */
|
/* Construct by hand. */
|
||||||
Octstr *headers_to_soapxml(List *hdrs)
|
Octstr *headers_to_soapxml(List *hdrs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,425 +26,6 @@
|
||||||
#include "mms_queue.h"
|
#include "mms_queue.h"
|
||||||
#include "mms_uaprof.h"
|
#include "mms_uaprof.h"
|
||||||
|
|
||||||
#define MAXQTRIES 100
|
|
||||||
#define BACKOFF_FACTOR 5*60 /* In seconds */
|
|
||||||
#define QUEUERUN_INTERVAL 15*60 /* 15 minutes. */
|
|
||||||
#define DEFAULT_EXPIRE 3600*24*7 /* One week */
|
|
||||||
#define MMS_PORT 8191 /* Default content fetch port. */
|
|
||||||
|
|
||||||
static Octstr *cfg_getx(CfgGroup *grp, Octstr *item)
|
|
||||||
{
|
|
||||||
Octstr *v = cfg_get(grp, item);
|
|
||||||
|
|
||||||
return v ? v : octstr_create("");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void *load_module(CfgGroup *grp, char *config_key, char *symbolname)
|
|
||||||
{
|
|
||||||
Octstr *s;
|
|
||||||
void *retval = NULL;
|
|
||||||
|
|
||||||
s = cfg_get(grp, octstr_imm(config_key));
|
|
||||||
if (s) {
|
|
||||||
void *x = dlopen(octstr_get_cstr(s), RTLD_LAZY);
|
|
||||||
void *y = NULL;
|
|
||||||
#ifdef __APPLE__
|
|
||||||
char sbuf[512];
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg, List **proxyrelays)
|
|
||||||
{
|
|
||||||
long loglevel;
|
|
||||||
Octstr *s;
|
|
||||||
Octstr *log, *alog;
|
|
||||||
List *l;
|
|
||||||
CfgGroup *grp = cfg_get_single_group(cfg, octstr_imm("mmsbox"));
|
|
||||||
CfgGroup *cgrp = cfg_get_single_group(cfg, octstr_imm("core"));
|
|
||||||
MmsBoxSettings *m = gw_malloc(sizeof *m);
|
|
||||||
long port = -1;
|
|
||||||
Octstr *http_proxy_host, *user, *pass, *from;
|
|
||||||
Octstr *qdir = NULL;
|
|
||||||
int i, n;
|
|
||||||
|
|
||||||
memset(m, 0, sizeof *m);
|
|
||||||
|
|
||||||
/* Set the log file. */
|
|
||||||
log = cfg_get(cgrp, octstr_imm("log-file"));
|
|
||||||
if (log != NULL) {
|
|
||||||
if (cfg_get_integer(&loglevel, cgrp, octstr_imm("log-level")) == -1)
|
|
||||||
loglevel = 0;
|
|
||||||
log_open(octstr_get_cstr(log), loglevel, GW_NON_EXCL);
|
|
||||||
octstr_destroy(log);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get access log and open it. */
|
|
||||||
alog = cfg_get(cgrp, octstr_imm("access-log"));
|
|
||||||
if (alog) {
|
|
||||||
alog_open(octstr_get_cstr(alog), 1, 1);
|
|
||||||
octstr_destroy(alog);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* look for http proxy. If set, use it. */
|
|
||||||
if ((http_proxy_host = cfg_get(cgrp, octstr_imm("http-proxy-host"))) != NULL) {
|
|
||||||
|
|
||||||
Octstr *username = cfg_get(cgrp,
|
|
||||||
octstr_imm("http-proxy-username"));
|
|
||||||
Octstr *password = cfg_get(cgrp,
|
|
||||||
octstr_imm("http-proxy-password"));
|
|
||||||
List *exceptions = cfg_get_list(cgrp,
|
|
||||||
octstr_imm("http-proxy-exceptions"));
|
|
||||||
long http_proxy_port = -1;
|
|
||||||
|
|
||||||
cfg_get_integer(&http_proxy_port, cgrp, octstr_imm("http-proxy-port"));
|
|
||||||
|
|
||||||
if (http_proxy_port > 0)
|
|
||||||
http_use_proxy(http_proxy_host, http_proxy_port,
|
|
||||||
exceptions, username, password);
|
|
||||||
octstr_destroy(http_proxy_host);
|
|
||||||
octstr_destroy(username);
|
|
||||||
octstr_destroy(password);
|
|
||||||
list_destroy(exceptions, octstr_destroy_item);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (proxyrelays)
|
|
||||||
*proxyrelays = mms_proxy_relays(cfg);
|
|
||||||
|
|
||||||
|
|
||||||
s = cfg_getx(grp, octstr_imm("local-mmsc-domains"));
|
|
||||||
|
|
||||||
if (s) {
|
|
||||||
l = octstr_split(s, octstr_imm(","));
|
|
||||||
octstr_destroy(s);
|
|
||||||
} else
|
|
||||||
l = list_create();
|
|
||||||
m->local_domains = l;
|
|
||||||
|
|
||||||
if (cfg_get_integer(&m->maxthreads, grp, octstr_imm("max-send-threads")) == -1)
|
|
||||||
m->maxthreads = 10;
|
|
||||||
|
|
||||||
m->unified_prefix = cfg_getx(grp, octstr_imm("unified-prefix"));
|
|
||||||
m->local_prefix = cfg_getx(grp, octstr_imm("local-prefixes"));
|
|
||||||
m->hostname = cfg_getx(grp, octstr_imm("hostname"));
|
|
||||||
|
|
||||||
if (m->hostname == NULL || octstr_len(m->hostname) == 0)
|
|
||||||
m->hostname = octstr_create("localhost");
|
|
||||||
|
|
||||||
m->name = cfg_getx(grp, octstr_imm("name"));
|
|
||||||
m->host_alias = cfg_getx(grp, octstr_imm("host-alias"));
|
|
||||||
|
|
||||||
m->sendmail = cfg_getx(grp, octstr_imm("send-mail-prog"));
|
|
||||||
|
|
||||||
qdir = cfg_getx(grp, octstr_imm("storage-directory"));
|
|
||||||
|
|
||||||
if (mkdir(octstr_get_cstr(qdir),
|
|
||||||
S_IRWXU|S_IRWXG) < 0 &&
|
|
||||||
errno != EEXIST)
|
|
||||||
panic(0, "Failed to create queue directory: %s - %s!",
|
|
||||||
octstr_get_cstr(qdir), strerror(errno));
|
|
||||||
|
|
||||||
m->global_queuedir = octstr_format("%S/global", qdir);
|
|
||||||
m->mm1_queuedir = octstr_format("%S/mm1", qdir);
|
|
||||||
m->mm4_queuedir = octstr_format("%S/mm4", qdir);
|
|
||||||
|
|
||||||
|
|
||||||
if (mms_init_queuedir(m->mm1_queuedir) < 0)
|
|
||||||
panic(0, "Failed to initialise local queue directory: %s - %s!",
|
|
||||||
octstr_get_cstr(m->mm1_queuedir), strerror(errno));
|
|
||||||
else if (mms_init_queuedir(m->global_queuedir) < 0)
|
|
||||||
panic(0, "Failed to initialise global queue directory: %s - %s!",
|
|
||||||
octstr_get_cstr(m->global_queuedir), strerror(errno));
|
|
||||||
else if (mms_init_queuedir(m->mm4_queuedir) < 0)
|
|
||||||
panic(0, "Failed to initialise global queue directory: %s - %s!",
|
|
||||||
octstr_get_cstr(m->mm4_queuedir), strerror(errno));
|
|
||||||
|
|
||||||
m->mmbox_rootdir = octstr_format("%S/mmbox", qdir);
|
|
||||||
|
|
||||||
if (mmbox_root_init(octstr_get_cstr(m->mmbox_rootdir)) != 0)
|
|
||||||
panic(0, "Failed to initialise mmbox root directory, error: %s!",
|
|
||||||
strerror(errno));
|
|
||||||
|
|
||||||
m->ua_profile_cache_dir = octstr_format("%S/UserAgent_Profiles", qdir);
|
|
||||||
|
|
||||||
if (mkdir(octstr_get_cstr(m->ua_profile_cache_dir),
|
|
||||||
S_IRWXU|S_IRWXG) < 0 &&
|
|
||||||
errno != EEXIST)
|
|
||||||
panic(0, "Failed to initialise UA Profile directory, error: %s!",
|
|
||||||
strerror(errno));
|
|
||||||
|
|
||||||
if (cfg_get_integer(&m->maxsendattempts, grp, octstr_imm("maximum-send-attempts")) == -1)
|
|
||||||
m->maxsendattempts = MAXQTRIES;
|
|
||||||
|
|
||||||
if (cfg_get_integer(&m->default_msgexpiry, grp, octstr_imm("default-message-expiry")) == -1)
|
|
||||||
m->default_msgexpiry = DEFAULT_EXPIRE;
|
|
||||||
|
|
||||||
s = cfg_getx(grp, octstr_imm("queue-run-interval"));
|
|
||||||
if (!s || (m->queue_interval = atof(octstr_get_cstr(s))) <= 0)
|
|
||||||
m->queue_interval = QUEUERUN_INTERVAL;
|
|
||||||
|
|
||||||
if (cfg_get_integer(&m->send_back_off, grp, octstr_imm("send-attempt-back-off")) == -1)
|
|
||||||
m->send_back_off = BACKOFF_FACTOR;
|
|
||||||
|
|
||||||
/* Make send sms url. */
|
|
||||||
m->sendsms_url = cfg_getx(grp, octstr_imm("sendsms-url"));
|
|
||||||
|
|
||||||
user = cfg_getx(grp, octstr_imm("sendsms-username"));
|
|
||||||
pass = cfg_getx(grp, octstr_imm("sendsms-password"));
|
|
||||||
from = cfg_get(grp, octstr_imm("sendsms-global-sender"));
|
|
||||||
|
|
||||||
if (user && octstr_len(user) > 1)
|
|
||||||
octstr_url_encode(user);
|
|
||||||
if (pass && octstr_len(pass) > 1)
|
|
||||||
octstr_url_encode(pass);
|
|
||||||
if (from && octstr_len(from) > 1)
|
|
||||||
octstr_url_encode(from);
|
|
||||||
|
|
||||||
|
|
||||||
octstr_format_append(m->sendsms_url,
|
|
||||||
(from && octstr_len(from) > 1) ?
|
|
||||||
"?username=%S&password=%S&from=%S" :
|
|
||||||
"?username=%S&password=%S",
|
|
||||||
user,
|
|
||||||
pass,from);
|
|
||||||
|
|
||||||
m->system_user = octstr_format("system-user@%S",
|
|
||||||
m->hostname);
|
|
||||||
octstr_destroy(user);
|
|
||||||
octstr_destroy(pass);
|
|
||||||
if (from) octstr_destroy(from);
|
|
||||||
|
|
||||||
cfg_get_integer(&port, grp, octstr_imm("mms-port"));
|
|
||||||
|
|
||||||
m->port = (port > 0) ? port : MMS_PORT;
|
|
||||||
|
|
||||||
m->mm7port = -1;
|
|
||||||
cfg_get_integer(&m->mm7port, grp, octstr_imm("mm7-port"));
|
|
||||||
|
|
||||||
m->allow_ip = cfg_getx(grp, octstr_imm("allow-ip"));
|
|
||||||
m->deny_ip = cfg_getx(grp, octstr_imm("deny-ip"));
|
|
||||||
|
|
||||||
m->email2mmsrelay_prefixes = cfg_getx(grp,
|
|
||||||
octstr_imm("email2mms-relay-prefixes"));
|
|
||||||
|
|
||||||
m->prov_notify = cfg_getx(grp,octstr_imm("prov-server-notify-script"));
|
|
||||||
|
|
||||||
m->prov_getstatus = cfg_getx(grp,octstr_imm("prov-server-sub-status-script"));
|
|
||||||
m->mms_notify_txt = cfg_getx(grp, octstr_imm("mms-notify-text"));
|
|
||||||
m->mms_notify_unprov_txt = cfg_getx(grp, octstr_imm("mms-notify-unprovisioned-text"));
|
|
||||||
|
|
||||||
|
|
||||||
m->mms_email_txt = cfg_getx(grp, octstr_imm("mms-to-email-txt"));
|
|
||||||
m->mms_email_html = cfg_getx(grp, octstr_imm("mms-to-email-html"));
|
|
||||||
|
|
||||||
m->mms_toolarge = cfg_getx(grp, octstr_imm("mms-message-too-large-txt"));
|
|
||||||
|
|
||||||
m->wap_gw_msisdn_header = cfg_get(grp, octstr_imm("mms-client-msisdn-header"));
|
|
||||||
if (!m->wap_gw_msisdn_header) m->wap_gw_msisdn_header = octstr_imm(XMSISDN_HEADER);
|
|
||||||
|
|
||||||
m->wap_gw_ip_header = cfg_get(grp, octstr_imm("mms-client-ip-header"));
|
|
||||||
if (!m->wap_gw_ip_header) m->wap_gw_ip_header = octstr_imm(XIP_HEADER);
|
|
||||||
|
|
||||||
cfg_get_bool(&m->notify_unprovisioned, grp, octstr_imm("notify-unprovisioned"));
|
|
||||||
|
|
||||||
m->billing_params = cfg_getx(grp,
|
|
||||||
octstr_imm("billing-module-parameters"));
|
|
||||||
/* Get and load the billing lib if any. */
|
|
||||||
|
|
||||||
if ((m->mms_billfuncs = load_module(grp, "billing-library", "mms_billfuncs"))) {
|
|
||||||
if (m->mms_billfuncs->mms_billingmodule_init == NULL ||
|
|
||||||
m->mms_billfuncs->mms_billmsg == NULL ||
|
|
||||||
m->mms_billfuncs->mms_billingmodule_fini == NULL ||
|
|
||||||
m->mms_billfuncs->mms_logcdr == NULL)
|
|
||||||
panic(0, "Missing or NULL functions in billing module!");
|
|
||||||
} else
|
|
||||||
m->mms_billfuncs = &mms_billfuncs; /* The default one. */
|
|
||||||
|
|
||||||
m->mms_bill_module_data = m->mms_billfuncs->mms_billingmodule_init(octstr_get_cstr(m->billing_params));
|
|
||||||
|
|
||||||
m->resolver_params = cfg_getx(grp,
|
|
||||||
octstr_imm("resolver-module-parameters"));
|
|
||||||
|
|
||||||
/* Get and load the resolver lib if any. */
|
|
||||||
if ((m->mms_resolvefuncs = load_module(grp, "resolver-library", "mms_resolvefuncs"))) {
|
|
||||||
if (m->mms_resolvefuncs->mms_resolvermodule_init == NULL ||
|
|
||||||
m->mms_resolvefuncs->mms_resolve == NULL ||
|
|
||||||
m->mms_resolvefuncs->mms_resolvermodule_fini == NULL)
|
|
||||||
panic(0, "Missing or NULL functions in resolver module!");
|
|
||||||
} else
|
|
||||||
m->mms_resolvefuncs = &mms_resolvefuncs; /* The default one. */
|
|
||||||
|
|
||||||
m->mms_resolver_module_data = m->mms_resolvefuncs->mms_resolvermodule_init(octstr_get_cstr(m->resolver_params));
|
|
||||||
|
|
||||||
m->detokenizer_params = cfg_getx(grp, octstr_imm("detokenizer-module-parameters"));
|
|
||||||
|
|
||||||
/* Get and load the detokenizer lib if any. */
|
|
||||||
if ((m->mms_detokenizefuncs = load_module(grp, "detokenizer-library", "mms_detokenizefuncs"))) {
|
|
||||||
if (m->mms_detokenizefuncs->mms_detokenizer_init == NULL ||
|
|
||||||
m->mms_detokenizefuncs->mms_detokenize == NULL ||
|
|
||||||
m->mms_detokenizefuncs->mms_gettoken == NULL ||
|
|
||||||
m->mms_detokenizefuncs->mms_detokenizer_fini == NULL)
|
|
||||||
panic(0, "Missing or NULL functions in detokenizer module!");
|
|
||||||
if (m->mms_detokenizefuncs->mms_detokenizer_init(octstr_get_cstr(m->detokenizer_params)))
|
|
||||||
panic(0, "Detokenizer module failed to initialize");
|
|
||||||
} else
|
|
||||||
m->mms_detokenizefuncs = NULL;
|
|
||||||
|
|
||||||
if (cfg_get_bool(&m->allow_ip_type, grp, octstr_imm("allow-ip-type")) < 0)
|
|
||||||
m->allow_ip_type = 1;
|
|
||||||
|
|
||||||
cfg_get_bool(&m->optimize_notification_size, grp, octstr_imm("optimize-notification-size"));
|
|
||||||
|
|
||||||
if (cfg_get_bool(&m->content_adaptation, grp, octstr_imm("content-adaptation")) < 0)
|
|
||||||
m->content_adaptation = 1;
|
|
||||||
|
|
||||||
if (qdir)
|
|
||||||
octstr_destroy(qdir);
|
|
||||||
|
|
||||||
/* Now load the VASP list. */
|
|
||||||
l = cfg_get_multi_group(cfg, octstr_imm("mms-vasp"));
|
|
||||||
m->vasp_list = list_create();
|
|
||||||
for (i=0, n=list_len(l); i<n; i++) {
|
|
||||||
CfgGroup *grp = list_get(l, i);
|
|
||||||
MmsVasp *mv = gw_malloc(sizeof *mv);
|
|
||||||
Octstr *s;
|
|
||||||
mv->id = cfg_getx(grp, octstr_imm("vasp-id"));
|
|
||||||
mv->short_code = -1;
|
|
||||||
cfg_get_integer(&mv->short_code, grp, octstr_imm("short-code"));
|
|
||||||
|
|
||||||
mv->vasp_username = cfg_getx(grp, octstr_imm("vasp-username"));
|
|
||||||
mv->vasp_password = cfg_getx(grp, octstr_imm("vasp-password"));
|
|
||||||
|
|
||||||
mv->vasp_url = cfg_getx(grp, octstr_imm("vasp-url"));
|
|
||||||
|
|
||||||
mv->mmsc_username = cfg_getx(grp, octstr_imm("mmsc-username"));
|
|
||||||
mv->mmsc_password = cfg_getx(grp, octstr_imm("mmsc-password"));
|
|
||||||
|
|
||||||
s = cfg_getx(grp, octstr_imm("type"));
|
|
||||||
|
|
||||||
if (octstr_case_compare(s, octstr_imm("soap")) == 0)
|
|
||||||
mv->type = SOAP_VASP;
|
|
||||||
else if (octstr_case_compare(s, octstr_imm("eaif")) == 0)
|
|
||||||
mv->type = EAIF_VASP;
|
|
||||||
else
|
|
||||||
mv->type = NONE_VASP;
|
|
||||||
octstr_destroy(s);
|
|
||||||
|
|
||||||
list_append(m->vasp_list, mv);
|
|
||||||
}
|
|
||||||
list_destroy(l, NULL);
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
|
|
||||||
List *mms_proxy_relays(Cfg *cfg)
|
|
||||||
{
|
|
||||||
List *gl = cfg_get_multi_group(cfg, octstr_imm("mmsproxy"));
|
|
||||||
int i, n;
|
|
||||||
List *l = list_create();
|
|
||||||
|
|
||||||
for (i = 0, n = list_len(gl); i < n; i++) {
|
|
||||||
CfgGroup *grp = list_get(gl, i);
|
|
||||||
MmsProxyRelay *m = gw_malloc(sizeof *m);
|
|
||||||
|
|
||||||
m->host = cfg_getx(grp, octstr_imm("host"));
|
|
||||||
m->name = cfg_getx(grp, octstr_imm("name"));
|
|
||||||
m->allowed_prefix = cfg_getx(grp, octstr_imm("allowed-prefix"));
|
|
||||||
m->denied_prefix = cfg_getx(grp, octstr_imm("denied-prefix"));
|
|
||||||
|
|
||||||
list_append(l, m);
|
|
||||||
}
|
|
||||||
|
|
||||||
list_destroy(gl, NULL);
|
|
||||||
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Octstr *mms_makefetchurl(char *qf, Octstr *token, int loc,
|
|
||||||
Octstr *to,
|
|
||||||
MmsBoxSettings *settings)
|
|
||||||
{
|
|
||||||
Octstr *url = octstr_create("");
|
|
||||||
Octstr *host_alias = settings->host_alias;
|
|
||||||
Octstr *hstr;
|
|
||||||
Octstr *endtoken, *x;
|
|
||||||
|
|
||||||
MmsDetokenizerFuncStruct *tfs = settings->mms_detokenizefuncs;
|
|
||||||
|
|
||||||
if (host_alias && octstr_len(host_alias) > 0)
|
|
||||||
hstr = octstr_duplicate(host_alias);
|
|
||||||
else
|
|
||||||
hstr = octstr_format("%S:%d",
|
|
||||||
settings->hostname, settings->port);
|
|
||||||
|
|
||||||
octstr_format_append(url, "http://%S/%s@%d",
|
|
||||||
hstr,
|
|
||||||
qf, loc);
|
|
||||||
|
|
||||||
if (tfs && tfs->mms_gettoken) { /* we append the recipient token or we append the message token. */
|
|
||||||
endtoken = tfs->mms_gettoken(to);
|
|
||||||
if (!endtoken)
|
|
||||||
endtoken = octstr_imm("x");
|
|
||||||
} else {
|
|
||||||
if (!token)
|
|
||||||
endtoken = octstr_imm("x");
|
|
||||||
else
|
|
||||||
endtoken = octstr_duplicate(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
x = octstr_duplicate(endtoken); /* might be immutable, so we duplicate it. */
|
|
||||||
octstr_url_encode(x);
|
|
||||||
octstr_format_append(url, "/%S", x);
|
|
||||||
|
|
||||||
octstr_destroy(endtoken);
|
|
||||||
octstr_destroy(x);
|
|
||||||
octstr_destroy(hstr);
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Octstr *mms_find_sender_msisdn(Octstr *send_url, List *request_hdrs, Octstr *msisdn_header,
|
|
||||||
MmsDetokenizerFuncStruct* detokenizerfuncs)
|
|
||||||
{
|
|
||||||
/* Either we have a WAP gateway header as defined, or we look for
|
|
||||||
* last part of url, pass it to detokenizer lib if defined, and back comes our number.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Octstr *phonenum = http_header_value(request_hdrs,
|
|
||||||
msisdn_header);
|
|
||||||
|
|
||||||
if (!phonenum || octstr_len(phonenum) == 0) {
|
|
||||||
List *l = octstr_split(send_url, octstr_imm("/"));
|
|
||||||
|
|
||||||
if (l && list_len(l) > 1) {
|
|
||||||
if (detokenizerfuncs)
|
|
||||||
phonenum = detokenizerfuncs->mms_detokenize(list_get(l, list_len(l) - 1));
|
|
||||||
}
|
|
||||||
if (l)
|
|
||||||
list_destroy(l, (list_item_destructor_t *)octstr_destroy);
|
|
||||||
}
|
|
||||||
|
|
||||||
return phonenum;
|
|
||||||
}
|
|
||||||
|
|
||||||
Octstr *mms_find_sender_ip(List *request_hdrs, Octstr *ip_header, Octstr *ip, int *isv6)
|
Octstr *mms_find_sender_ip(List *request_hdrs, Octstr *ip_header, Octstr *ip, int *isv6)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,9 +19,8 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "mms_strings.h"
|
#include "mms_strings.h"
|
||||||
#include "mms_msg.h"
|
#include "mms_msg.h"
|
||||||
#include "mms_billing.h"
|
|
||||||
#include "mms_resolve.h"
|
|
||||||
#include "mms_detokenize.h"
|
|
||||||
#include "mms_mmbox.h"
|
#include "mms_mmbox.h"
|
||||||
|
|
||||||
/* Send errors */
|
/* Send errors */
|
||||||
|
@ -41,82 +40,6 @@
|
||||||
#define _TT "0123456789abcdefghijklmnopqrstuvwxyz"
|
#define _TT "0123456789abcdefghijklmnopqrstuvwxyz"
|
||||||
#define _TTSIZE (-1 + sizeof _TT)
|
#define _TTSIZE (-1 + sizeof _TT)
|
||||||
|
|
||||||
typedef struct MmsProxyRelay {
|
|
||||||
Octstr *host;
|
|
||||||
Octstr *name;
|
|
||||||
Octstr *allowed_prefix;
|
|
||||||
Octstr *denied_prefix;
|
|
||||||
} MmsProxyRelay;
|
|
||||||
|
|
||||||
typedef struct MmsVasp {
|
|
||||||
Octstr *id;
|
|
||||||
long short_code;
|
|
||||||
enum {SOAP_VASP, EAIF_VASP, NONE_VASP} type;
|
|
||||||
Octstr *vasp_username, *vasp_password;
|
|
||||||
Octstr *vasp_url;
|
|
||||||
Octstr *mmsc_username, *mmsc_password;
|
|
||||||
} MmsVasp;
|
|
||||||
|
|
||||||
typedef struct MmsBoxSettings {
|
|
||||||
Octstr *system_user;
|
|
||||||
Octstr *name, *hostname, *host_alias;
|
|
||||||
List *local_domains;
|
|
||||||
Octstr *unified_prefix, *local_prefix;
|
|
||||||
Octstr *sendmail;
|
|
||||||
Octstr *global_queuedir, *mm1_queuedir, *mm4_queuedir;
|
|
||||||
Octstr *mmbox_rootdir;
|
|
||||||
|
|
||||||
Octstr *ua_profile_cache_dir;
|
|
||||||
|
|
||||||
long maxthreads;
|
|
||||||
long maxsendattempts;
|
|
||||||
long default_msgexpiry;
|
|
||||||
double queue_interval;
|
|
||||||
long send_back_off;
|
|
||||||
|
|
||||||
long port, mm7port;
|
|
||||||
|
|
||||||
Octstr *allow_ip;
|
|
||||||
Octstr *deny_ip;
|
|
||||||
|
|
||||||
Octstr *email2mmsrelay_prefixes;
|
|
||||||
Octstr *sendsms_url;
|
|
||||||
#if 0
|
|
||||||
Octstr *sendsms_user, *sendsms_pass, *sendsms_globalsender;
|
|
||||||
#endif
|
|
||||||
Octstr *billing_params;
|
|
||||||
|
|
||||||
MmsBillingFuncStruct *mms_billfuncs; /* Link to billing funcs. */
|
|
||||||
void *mms_bill_module_data;
|
|
||||||
|
|
||||||
Octstr *resolver_params;
|
|
||||||
MmsResolverFuncStruct *mms_resolvefuncs; /* Link to resolver funcs. */
|
|
||||||
void *mms_resolver_module_data;
|
|
||||||
|
|
||||||
Octstr *detokenizer_params;
|
|
||||||
MmsDetokenizerFuncStruct *mms_detokenizefuncs; /* Link to detokenizer funcs. */
|
|
||||||
void *mms_detokenizer_module_data;
|
|
||||||
|
|
||||||
int allow_ip_type;
|
|
||||||
|
|
||||||
int optimize_notification_size;
|
|
||||||
int content_adaptation;
|
|
||||||
|
|
||||||
Octstr *prov_notify;
|
|
||||||
|
|
||||||
Octstr *prov_getstatus;
|
|
||||||
int notify_unprovisioned;
|
|
||||||
Octstr *mms_notify_txt;
|
|
||||||
Octstr *mms_notify_unprov_txt;
|
|
||||||
Octstr *mms_toolarge;
|
|
||||||
|
|
||||||
Octstr *mms_email_txt;
|
|
||||||
Octstr *mms_email_html;
|
|
||||||
Octstr *wap_gw_msisdn_header;
|
|
||||||
Octstr *wap_gw_ip_header;
|
|
||||||
|
|
||||||
List *vasp_list; /* of MmsVasp * */
|
|
||||||
} MmsBoxSettings;
|
|
||||||
|
|
||||||
/* Global variables and shared code used by all modules. */
|
/* Global variables and shared code used by all modules. */
|
||||||
|
|
||||||
|
@ -128,16 +51,6 @@ extern char *mms_hostname; /* Our hostname. */
|
||||||
/* Message location flags: Used to distinguish fetch-urls */
|
/* Message location flags: Used to distinguish fetch-urls */
|
||||||
enum mms_loc_t {MMS_LOC_MMBOX = 1, MMS_LOC_MQUEUE=2};
|
enum mms_loc_t {MMS_LOC_MMBOX = 1, MMS_LOC_MQUEUE=2};
|
||||||
|
|
||||||
/* Returns mmsbox settings. */
|
|
||||||
MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg, List **proxyrelays);
|
|
||||||
|
|
||||||
|
|
||||||
/* Returns list of MmsProxyRelay */
|
|
||||||
extern List *mms_proxy_relays(Cfg *cfg);
|
|
||||||
|
|
||||||
extern Octstr *mms_makefetchurl(char *qf, Octstr *token, int loc,
|
|
||||||
Octstr *to,
|
|
||||||
MmsBoxSettings *settings);
|
|
||||||
|
|
||||||
extern Octstr *mms_maketransid(char *qf, Octstr *mmscname);
|
extern Octstr *mms_maketransid(char *qf, Octstr *mmscname);
|
||||||
|
|
||||||
|
@ -146,7 +59,6 @@ extern Octstr *mms_getqf_fromtransid(Octstr *transid);
|
||||||
extern int mms_decodefetchurl(Octstr *fetch_url,
|
extern int mms_decodefetchurl(Octstr *fetch_url,
|
||||||
Octstr **qf, Octstr **token, int *loc);
|
Octstr **qf, Octstr **token, int *loc);
|
||||||
|
|
||||||
Octstr *mms_find_sender_msisdn(Octstr *send_url, List *request_hdrs, Octstr *msisdn_header, MmsDetokenizerFuncStruct *detokenizerfuncs);
|
|
||||||
Octstr *mms_find_sender_ip(List *request_hdrs, Octstr *ip_header, Octstr *ip, int *isv6);
|
Octstr *mms_find_sender_ip(List *request_hdrs, Octstr *ip_header, Octstr *ip, int *isv6);
|
||||||
|
|
||||||
extern Octstr *mms_isodate(time_t t);
|
extern Octstr *mms_isodate(time_t t);
|
||||||
|
|
|
@ -1,2 +1,12 @@
|
||||||
|
noinst_LIBRARIES = libmmsc.a
|
||||||
|
libmmsc_a_SOURCES = mmsc_cfg.h mmsc_cfg.c mms_detokenize.c mms_detokenize.h mms_resolve.h mms_resolve.c mms_billing.c mms_billing.h
|
||||||
|
|
||||||
bin_PROGRAMS = mmsrelay mmsproxy mmsfromemail mmssend
|
bin_PROGRAMS = mmsrelay mmsproxy mmsfromemail mmssend
|
||||||
mmsrelay_SOURCES = mmsglobalsender.c mmsmobilesender.c mmsrelay.h mmsrelay.c
|
mmsrelay_SOURCES = mmsglobalsender.c mmsmobilesender.c mmsrelay.c
|
||||||
|
LDADD = libmmsc.a $(INITLIBS)
|
||||||
|
|
||||||
|
plugindir = $(libdir)/mbuni
|
||||||
|
plugin_LTLIBRARIES = libmmsc_billing_shell.la libmmsc_resolve_shell.la libmmsc_detokenize_shell.la
|
||||||
|
libmmsc_billing_shell_la_SOURCES = mms_billing_shell.c
|
||||||
|
libmmsc_resolve_shell_la_SOURCES = mms_resolve_shell.c
|
||||||
|
libmmsc_detokenize_shell_la_SOURCES = mms_detokenize_shell.c
|
||||||
|
|
|
@ -14,7 +14,9 @@
|
||||||
|
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
SOURCES = mmsfromemail.c mmsproxy.c $(mmsrelay_SOURCES) mmssend.c
|
|
||||||
|
|
||||||
|
SOURCES = $(libmmsc_a_SOURCES) $(libmmsc_billing_shell_la_SOURCES) $(libmmsc_detokenize_shell_la_SOURCES) $(libmmsc_resolve_shell_la_SOURCES) mmsfromemail.c mmsproxy.c $(mmsrelay_SOURCES) mmssend.c
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
|
@ -49,22 +51,53 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
mkinstalldirs = $(install_sh) -d
|
mkinstalldirs = $(install_sh) -d
|
||||||
CONFIG_HEADER = $(top_builddir)/config.h
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
CONFIG_CLEAN_FILES =
|
CONFIG_CLEAN_FILES =
|
||||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
LIBRARIES = $(noinst_LIBRARIES)
|
||||||
|
ARFLAGS = cru
|
||||||
|
libmmsc_a_AR = $(AR) $(ARFLAGS)
|
||||||
|
libmmsc_a_LIBADD =
|
||||||
|
am_libmmsc_a_OBJECTS = mmsc_cfg.$(OBJEXT) mms_detokenize.$(OBJEXT) \
|
||||||
|
mms_resolve.$(OBJEXT) mms_billing.$(OBJEXT)
|
||||||
|
libmmsc_a_OBJECTS = $(am_libmmsc_a_OBJECTS)
|
||||||
|
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||||
|
am__vpath_adj = case $$p in \
|
||||||
|
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||||
|
*) f=$$p;; \
|
||||||
|
esac;
|
||||||
|
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
|
||||||
|
am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(bindir)"
|
||||||
|
pluginLTLIBRARIES_INSTALL = $(INSTALL)
|
||||||
|
LTLIBRARIES = $(plugin_LTLIBRARIES)
|
||||||
|
libmmsc_billing_shell_la_LIBADD =
|
||||||
|
am_libmmsc_billing_shell_la_OBJECTS = mms_billing_shell.lo
|
||||||
|
libmmsc_billing_shell_la_OBJECTS = \
|
||||||
|
$(am_libmmsc_billing_shell_la_OBJECTS)
|
||||||
|
libmmsc_detokenize_shell_la_LIBADD =
|
||||||
|
am_libmmsc_detokenize_shell_la_OBJECTS = mms_detokenize_shell.lo
|
||||||
|
libmmsc_detokenize_shell_la_OBJECTS = \
|
||||||
|
$(am_libmmsc_detokenize_shell_la_OBJECTS)
|
||||||
|
libmmsc_resolve_shell_la_LIBADD =
|
||||||
|
am_libmmsc_resolve_shell_la_OBJECTS = mms_resolve_shell.lo
|
||||||
|
libmmsc_resolve_shell_la_OBJECTS = \
|
||||||
|
$(am_libmmsc_resolve_shell_la_OBJECTS)
|
||||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||||
PROGRAMS = $(bin_PROGRAMS)
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
mmsfromemail_SOURCES = mmsfromemail.c
|
mmsfromemail_SOURCES = mmsfromemail.c
|
||||||
mmsfromemail_OBJECTS = mmsfromemail.$(OBJEXT)
|
mmsfromemail_OBJECTS = mmsfromemail.$(OBJEXT)
|
||||||
mmsfromemail_LDADD = $(LDADD)
|
mmsfromemail_LDADD = $(LDADD)
|
||||||
|
mmsfromemail_DEPENDENCIES = libmmsc.a
|
||||||
mmsproxy_SOURCES = mmsproxy.c
|
mmsproxy_SOURCES = mmsproxy.c
|
||||||
mmsproxy_OBJECTS = mmsproxy.$(OBJEXT)
|
mmsproxy_OBJECTS = mmsproxy.$(OBJEXT)
|
||||||
mmsproxy_LDADD = $(LDADD)
|
mmsproxy_LDADD = $(LDADD)
|
||||||
|
mmsproxy_DEPENDENCIES = libmmsc.a
|
||||||
am_mmsrelay_OBJECTS = mmsglobalsender.$(OBJEXT) \
|
am_mmsrelay_OBJECTS = mmsglobalsender.$(OBJEXT) \
|
||||||
mmsmobilesender.$(OBJEXT) mmsrelay.$(OBJEXT)
|
mmsmobilesender.$(OBJEXT) mmsrelay.$(OBJEXT)
|
||||||
mmsrelay_OBJECTS = $(am_mmsrelay_OBJECTS)
|
mmsrelay_OBJECTS = $(am_mmsrelay_OBJECTS)
|
||||||
mmsrelay_LDADD = $(LDADD)
|
mmsrelay_LDADD = $(LDADD)
|
||||||
|
mmsrelay_DEPENDENCIES = libmmsc.a
|
||||||
mmssend_SOURCES = mmssend.c
|
mmssend_SOURCES = mmssend.c
|
||||||
mmssend_OBJECTS = mmssend.$(OBJEXT)
|
mmssend_OBJECTS = mmssend.$(OBJEXT)
|
||||||
mmssend_LDADD = $(LDADD)
|
mmssend_LDADD = $(LDADD)
|
||||||
|
mmssend_DEPENDENCIES = libmmsc.a
|
||||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
am__depfiles_maybe = depfiles
|
am__depfiles_maybe = depfiles
|
||||||
|
@ -76,8 +109,15 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||||
CCLD = $(CC)
|
CCLD = $(CC)
|
||||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
SOURCES = mmsfromemail.c mmsproxy.c $(mmsrelay_SOURCES) mmssend.c
|
SOURCES = $(libmmsc_a_SOURCES) $(libmmsc_billing_shell_la_SOURCES) \
|
||||||
DIST_SOURCES = mmsfromemail.c mmsproxy.c $(mmsrelay_SOURCES) mmssend.c
|
$(libmmsc_detokenize_shell_la_SOURCES) \
|
||||||
|
$(libmmsc_resolve_shell_la_SOURCES) mmsfromemail.c mmsproxy.c \
|
||||||
|
$(mmsrelay_SOURCES) mmssend.c
|
||||||
|
DIST_SOURCES = $(libmmsc_a_SOURCES) \
|
||||||
|
$(libmmsc_billing_shell_la_SOURCES) \
|
||||||
|
$(libmmsc_detokenize_shell_la_SOURCES) \
|
||||||
|
$(libmmsc_resolve_shell_la_SOURCES) mmsfromemail.c mmsproxy.c \
|
||||||
|
$(mmsrelay_SOURCES) mmssend.c
|
||||||
ETAGS = etags
|
ETAGS = etags
|
||||||
CTAGS = ctags
|
CTAGS = ctags
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
@ -179,7 +219,15 @@ sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
target_alias = @target_alias@
|
target_alias = @target_alias@
|
||||||
mmsrelay_SOURCES = mmsglobalsender.c mmsmobilesender.c mmsrelay.h mmsrelay.c
|
noinst_LIBRARIES = libmmsc.a
|
||||||
|
libmmsc_a_SOURCES = mmsc_cfg.h mmsc_cfg.c mms_detokenize.c mms_detokenize.h mms_resolve.h mms_resolve.c mms_billing.c mms_billing.h
|
||||||
|
mmsrelay_SOURCES = mmsglobalsender.c mmsmobilesender.c mmsrelay.c
|
||||||
|
LDADD = libmmsc.a $(INITLIBS)
|
||||||
|
plugindir = $(libdir)/mbuni
|
||||||
|
plugin_LTLIBRARIES = libmmsc_billing_shell.la libmmsc_resolve_shell.la libmmsc_detokenize_shell.la
|
||||||
|
libmmsc_billing_shell_la_SOURCES = mms_billing_shell.c
|
||||||
|
libmmsc_resolve_shell_la_SOURCES = mms_resolve_shell.c
|
||||||
|
libmmsc_detokenize_shell_la_SOURCES = mms_detokenize_shell.c
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
@ -213,6 +261,46 @@ $(top_srcdir)/configure: $(am__configure_deps)
|
||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
|
||||||
|
clean-noinstLIBRARIES:
|
||||||
|
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||||
|
libmmsc.a: $(libmmsc_a_OBJECTS) $(libmmsc_a_DEPENDENCIES)
|
||||||
|
-rm -f libmmsc.a
|
||||||
|
$(libmmsc_a_AR) libmmsc.a $(libmmsc_a_OBJECTS) $(libmmsc_a_LIBADD)
|
||||||
|
$(RANLIB) libmmsc.a
|
||||||
|
install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)"
|
||||||
|
@list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
if test -f $$p; then \
|
||||||
|
f=$(am__strip_dir) \
|
||||||
|
echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \
|
||||||
|
$(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \
|
||||||
|
else :; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-pluginLTLIBRARIES:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
@set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
p=$(am__strip_dir) \
|
||||||
|
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \
|
||||||
|
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \
|
||||||
|
done
|
||||||
|
|
||||||
|
clean-pluginLTLIBRARIES:
|
||||||
|
-test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
|
||||||
|
@list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||||
|
test "$$dir" != "$$p" || dir=.; \
|
||||||
|
echo "rm -f \"$${dir}/so_locations\""; \
|
||||||
|
rm -f "$${dir}/so_locations"; \
|
||||||
|
done
|
||||||
|
libmmsc_billing_shell.la: $(libmmsc_billing_shell_la_OBJECTS) $(libmmsc_billing_shell_la_DEPENDENCIES)
|
||||||
|
$(LINK) -rpath $(plugindir) $(libmmsc_billing_shell_la_LDFLAGS) $(libmmsc_billing_shell_la_OBJECTS) $(libmmsc_billing_shell_la_LIBADD) $(LIBS)
|
||||||
|
libmmsc_detokenize_shell.la: $(libmmsc_detokenize_shell_la_OBJECTS) $(libmmsc_detokenize_shell_la_DEPENDENCIES)
|
||||||
|
$(LINK) -rpath $(plugindir) $(libmmsc_detokenize_shell_la_LDFLAGS) $(libmmsc_detokenize_shell_la_OBJECTS) $(libmmsc_detokenize_shell_la_LIBADD) $(LIBS)
|
||||||
|
libmmsc_resolve_shell.la: $(libmmsc_resolve_shell_la_OBJECTS) $(libmmsc_resolve_shell_la_DEPENDENCIES)
|
||||||
|
$(LINK) -rpath $(plugindir) $(libmmsc_resolve_shell_la_LDFLAGS) $(libmmsc_resolve_shell_la_OBJECTS) $(libmmsc_resolve_shell_la_LIBADD) $(LIBS)
|
||||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||||
@$(NORMAL_INSTALL)
|
@$(NORMAL_INSTALL)
|
||||||
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
|
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
|
||||||
|
@ -260,6 +348,13 @@ mostlyclean-compile:
|
||||||
distclean-compile:
|
distclean-compile:
|
||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_billing.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_billing_shell.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_detokenize.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_detokenize_shell.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_resolve.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mms_resolve_shell.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsc_cfg.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsfromemail.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsfromemail.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsglobalsender.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsglobalsender.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsmobilesender.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsmobilesender.Po@am__quote@
|
||||||
|
@ -375,9 +470,9 @@ distdir: $(DISTFILES)
|
||||||
done
|
done
|
||||||
check-am: all-am
|
check-am: all-am
|
||||||
check: check-am
|
check: check-am
|
||||||
all-am: Makefile $(PROGRAMS)
|
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(PROGRAMS)
|
||||||
installdirs:
|
installdirs:
|
||||||
for dir in "$(DESTDIR)$(bindir)"; do \
|
for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(bindir)"; do \
|
||||||
test -z "$$dir" || $(mkdir_p) "$$dir"; \
|
test -z "$$dir" || $(mkdir_p) "$$dir"; \
|
||||||
done
|
done
|
||||||
install: install-am
|
install: install-am
|
||||||
|
@ -406,7 +501,8 @@ maintainer-clean-generic:
|
||||||
@echo "it deletes files that may require special tools to rebuild."
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
clean: clean-am
|
clean: clean-am
|
||||||
|
|
||||||
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
|
clean-am: clean-binPROGRAMS clean-generic clean-libtool \
|
||||||
|
clean-noinstLIBRARIES clean-pluginLTLIBRARIES mostlyclean-am
|
||||||
|
|
||||||
distclean: distclean-am
|
distclean: distclean-am
|
||||||
-rm -rf ./$(DEPDIR)
|
-rm -rf ./$(DEPDIR)
|
||||||
|
@ -424,7 +520,7 @@ info: info-am
|
||||||
|
|
||||||
info-am:
|
info-am:
|
||||||
|
|
||||||
install-data-am:
|
install-data-am: install-pluginLTLIBRARIES
|
||||||
|
|
||||||
install-exec-am: install-binPROGRAMS
|
install-exec-am: install-binPROGRAMS
|
||||||
|
|
||||||
|
@ -452,19 +548,22 @@ ps: ps-am
|
||||||
|
|
||||||
ps-am:
|
ps-am:
|
||||||
|
|
||||||
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
|
uninstall-am: uninstall-binPROGRAMS uninstall-info-am \
|
||||||
|
uninstall-pluginLTLIBRARIES
|
||||||
|
|
||||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||||
clean-generic clean-libtool ctags distclean distclean-compile \
|
clean-generic clean-libtool clean-noinstLIBRARIES \
|
||||||
|
clean-pluginLTLIBRARIES ctags distclean distclean-compile \
|
||||||
distclean-generic distclean-libtool distclean-tags distdir dvi \
|
distclean-generic distclean-libtool distclean-tags distdir dvi \
|
||||||
dvi-am html html-am info info-am install install-am \
|
dvi-am html html-am info info-am install install-am \
|
||||||
install-binPROGRAMS install-data install-data-am install-exec \
|
install-binPROGRAMS install-data install-data-am install-exec \
|
||||||
install-exec-am install-info install-info-am install-man \
|
install-exec-am install-info install-info-am install-man \
|
||||||
install-strip installcheck installcheck-am installdirs \
|
install-pluginLTLIBRARIES install-strip installcheck \
|
||||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
installcheck-am installdirs maintainer-clean \
|
||||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||||
uninstall-binPROGRAMS uninstall-info-am
|
tags uninstall uninstall-am uninstall-binPROGRAMS \
|
||||||
|
uninstall-info-am uninstall-pluginLTLIBRARIES
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
|
|
@ -38,9 +38,9 @@ static Octstr *mms_gettoken(Octstr *msisdn)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The function itself. */
|
/* The function itself. */
|
||||||
MmsTokenize mms_detokenizefuncs = {
|
MmsDetokenizerFuncStruct mms_detokenizefuncs = {
|
||||||
mms_detokenizer_init,
|
mms_detokenizer_init,
|
||||||
mms_detokenize,
|
mms_detokenize,
|
||||||
mms_gettoken,
|
mms_gettoken,
|
||||||
mms_detokenize_fini
|
mms_detokenizer_fini
|
||||||
};
|
};
|
|
@ -13,7 +13,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "mms_resolve.h"
|
#include "mms_resolve.h"
|
||||||
#include "mms_util.h"
|
#include "mmsc_cfg.h"
|
||||||
|
|
||||||
static void *mms_resolvermodule_init(char *settings)
|
static void *mms_resolvermodule_init(char *settings)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ static Octstr *mms_resolve(Octstr * phonenum, void *module_data, void *settings_
|
||||||
* but this one needs them
|
* but this one needs them
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MmsBoxSettings *settings = (MmsBoxSettings *) settings_p;
|
MmscSettings *settings = (MmscSettings *) settings_p;
|
||||||
List *proxyrelays = (List *) proxyrelays_p;
|
List *proxyrelays = (List *) proxyrelays_p;
|
||||||
int j, m;
|
int j, m;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* hostname, the msisdn is considered local.
|
* hostname, the msisdn is considered local.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct MmsRevolverFuncStruct {
|
typedef struct MmsResolverFuncStruct {
|
||||||
/* This function is called once to initialise the resolver module. Return a generic object,
|
/* This function is called once to initialise the resolver module. Return a generic object,
|
||||||
* which is passed with each resolution request..
|
* which is passed with each resolution request..
|
||||||
*/
|
*/
|
|
@ -0,0 +1,444 @@
|
||||||
|
/*
|
||||||
|
* Mbuni - Open Source MMS Gateway
|
||||||
|
*
|
||||||
|
* MMS send: Inject message into queue for delivery.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
|
||||||
|
*
|
||||||
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License, with a few exceptions granted (see LICENSE)
|
||||||
|
*/
|
||||||
|
#include <sys/file.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "mmsc_cfg.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define MAXQTRIES 100
|
||||||
|
#define BACKOFF_FACTOR 5*60 /* In seconds */
|
||||||
|
#define QUEUERUN_INTERVAL 15*60 /* 15 minutes. */
|
||||||
|
#define DEFAULT_EXPIRE 3600*24*7 /* One week */
|
||||||
|
#define MMS_PORT 8191 /* Default content fetch port. */
|
||||||
|
|
||||||
|
static Octstr *cfg_getx(CfgGroup *grp, Octstr *item)
|
||||||
|
{
|
||||||
|
Octstr *v = cfg_get(grp, item);
|
||||||
|
|
||||||
|
return v ? v : octstr_create("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void *load_module(CfgGroup *grp, char *config_key, char *symbolname)
|
||||||
|
{
|
||||||
|
Octstr *s;
|
||||||
|
void *retval = NULL;
|
||||||
|
|
||||||
|
s = cfg_get(grp, octstr_imm(config_key));
|
||||||
|
if (s) {
|
||||||
|
void *x = dlopen(octstr_get_cstr(s), RTLD_LAZY);
|
||||||
|
void *y = NULL;
|
||||||
|
#ifdef __APPLE__
|
||||||
|
char sbuf[512];
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays)
|
||||||
|
{
|
||||||
|
long loglevel;
|
||||||
|
Octstr *s;
|
||||||
|
Octstr *log, *alog;
|
||||||
|
List *l;
|
||||||
|
CfgGroup *grp = cfg_get_single_group(cfg, octstr_imm("mmsbox"));
|
||||||
|
CfgGroup *cgrp = cfg_get_single_group(cfg, octstr_imm("core"));
|
||||||
|
MmscSettings *m = gw_malloc(sizeof *m);
|
||||||
|
long port = -1;
|
||||||
|
Octstr *http_proxy_host, *user, *pass, *from;
|
||||||
|
Octstr *qdir = NULL;
|
||||||
|
int i, n;
|
||||||
|
|
||||||
|
memset(m, 0, sizeof *m);
|
||||||
|
|
||||||
|
/* Set the log file. */
|
||||||
|
log = cfg_get(cgrp, octstr_imm("log-file"));
|
||||||
|
if (log != NULL) {
|
||||||
|
if (cfg_get_integer(&loglevel, cgrp, octstr_imm("log-level")) == -1)
|
||||||
|
loglevel = 0;
|
||||||
|
log_open(octstr_get_cstr(log), loglevel, GW_NON_EXCL);
|
||||||
|
octstr_destroy(log);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get access log and open it. */
|
||||||
|
alog = cfg_get(cgrp, octstr_imm("access-log"));
|
||||||
|
if (alog) {
|
||||||
|
alog_open(octstr_get_cstr(alog), 1, 1);
|
||||||
|
octstr_destroy(alog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* look for http proxy. If set, use it. */
|
||||||
|
if ((http_proxy_host = cfg_get(cgrp, octstr_imm("http-proxy-host"))) != NULL) {
|
||||||
|
|
||||||
|
Octstr *username = cfg_get(cgrp,
|
||||||
|
octstr_imm("http-proxy-username"));
|
||||||
|
Octstr *password = cfg_get(cgrp,
|
||||||
|
octstr_imm("http-proxy-password"));
|
||||||
|
List *exceptions = cfg_get_list(cgrp,
|
||||||
|
octstr_imm("http-proxy-exceptions"));
|
||||||
|
long http_proxy_port = -1;
|
||||||
|
|
||||||
|
cfg_get_integer(&http_proxy_port, cgrp, octstr_imm("http-proxy-port"));
|
||||||
|
|
||||||
|
if (http_proxy_port > 0)
|
||||||
|
http_use_proxy(http_proxy_host, http_proxy_port,
|
||||||
|
exceptions, username, password);
|
||||||
|
octstr_destroy(http_proxy_host);
|
||||||
|
octstr_destroy(username);
|
||||||
|
octstr_destroy(password);
|
||||||
|
list_destroy(exceptions, octstr_destroy_item);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (proxyrelays)
|
||||||
|
*proxyrelays = mms_proxy_relays(cfg);
|
||||||
|
|
||||||
|
|
||||||
|
s = cfg_getx(grp, octstr_imm("local-mmsc-domains"));
|
||||||
|
|
||||||
|
if (s) {
|
||||||
|
l = octstr_split(s, octstr_imm(","));
|
||||||
|
octstr_destroy(s);
|
||||||
|
} else
|
||||||
|
l = list_create();
|
||||||
|
m->local_domains = l;
|
||||||
|
|
||||||
|
if (cfg_get_integer(&m->maxthreads, grp, octstr_imm("max-send-threads")) == -1)
|
||||||
|
m->maxthreads = 10;
|
||||||
|
|
||||||
|
m->unified_prefix = cfg_getx(grp, octstr_imm("unified-prefix"));
|
||||||
|
m->local_prefix = cfg_getx(grp, octstr_imm("local-prefixes"));
|
||||||
|
m->hostname = cfg_getx(grp, octstr_imm("hostname"));
|
||||||
|
|
||||||
|
if (m->hostname == NULL || octstr_len(m->hostname) == 0)
|
||||||
|
m->hostname = octstr_create("localhost");
|
||||||
|
|
||||||
|
m->name = cfg_getx(grp, octstr_imm("name"));
|
||||||
|
m->host_alias = cfg_getx(grp, octstr_imm("host-alias"));
|
||||||
|
|
||||||
|
m->sendmail = cfg_getx(grp, octstr_imm("send-mail-prog"));
|
||||||
|
|
||||||
|
qdir = cfg_getx(grp, octstr_imm("storage-directory"));
|
||||||
|
|
||||||
|
if (mkdir(octstr_get_cstr(qdir),
|
||||||
|
S_IRWXU|S_IRWXG) < 0 &&
|
||||||
|
errno != EEXIST)
|
||||||
|
panic(0, "Failed to create queue directory: %s - %s!",
|
||||||
|
octstr_get_cstr(qdir), strerror(errno));
|
||||||
|
|
||||||
|
m->global_queuedir = octstr_format("%S/global", qdir);
|
||||||
|
m->mm1_queuedir = octstr_format("%S/mm1", qdir);
|
||||||
|
m->mm4_queuedir = octstr_format("%S/mm4", qdir);
|
||||||
|
|
||||||
|
|
||||||
|
if (mms_init_queuedir(m->mm1_queuedir) < 0)
|
||||||
|
panic(0, "Failed to initialise local queue directory: %s - %s!",
|
||||||
|
octstr_get_cstr(m->mm1_queuedir), strerror(errno));
|
||||||
|
else if (mms_init_queuedir(m->global_queuedir) < 0)
|
||||||
|
panic(0, "Failed to initialise global queue directory: %s - %s!",
|
||||||
|
octstr_get_cstr(m->global_queuedir), strerror(errno));
|
||||||
|
else if (mms_init_queuedir(m->mm4_queuedir) < 0)
|
||||||
|
panic(0, "Failed to initialise global queue directory: %s - %s!",
|
||||||
|
octstr_get_cstr(m->mm4_queuedir), strerror(errno));
|
||||||
|
|
||||||
|
m->mmbox_rootdir = octstr_format("%S/mmbox", qdir);
|
||||||
|
|
||||||
|
if (mmbox_root_init(octstr_get_cstr(m->mmbox_rootdir)) != 0)
|
||||||
|
panic(0, "Failed to initialise mmbox root directory, error: %s!",
|
||||||
|
strerror(errno));
|
||||||
|
|
||||||
|
m->ua_profile_cache_dir = octstr_format("%S/UserAgent_Profiles", qdir);
|
||||||
|
|
||||||
|
if (mkdir(octstr_get_cstr(m->ua_profile_cache_dir),
|
||||||
|
S_IRWXU|S_IRWXG) < 0 &&
|
||||||
|
errno != EEXIST)
|
||||||
|
panic(0, "Failed to initialise UA Profile directory, error: %s!",
|
||||||
|
strerror(errno));
|
||||||
|
|
||||||
|
if (cfg_get_integer(&m->maxsendattempts, grp, octstr_imm("maximum-send-attempts")) == -1)
|
||||||
|
m->maxsendattempts = MAXQTRIES;
|
||||||
|
|
||||||
|
if (cfg_get_integer(&m->default_msgexpiry, grp, octstr_imm("default-message-expiry")) == -1)
|
||||||
|
m->default_msgexpiry = DEFAULT_EXPIRE;
|
||||||
|
|
||||||
|
s = cfg_getx(grp, octstr_imm("queue-run-interval"));
|
||||||
|
if (!s || (m->queue_interval = atof(octstr_get_cstr(s))) <= 0)
|
||||||
|
m->queue_interval = QUEUERUN_INTERVAL;
|
||||||
|
|
||||||
|
if (cfg_get_integer(&m->send_back_off, grp, octstr_imm("send-attempt-back-off")) == -1)
|
||||||
|
m->send_back_off = BACKOFF_FACTOR;
|
||||||
|
|
||||||
|
/* Make send sms url. */
|
||||||
|
m->sendsms_url = cfg_getx(grp, octstr_imm("sendsms-url"));
|
||||||
|
|
||||||
|
user = cfg_getx(grp, octstr_imm("sendsms-username"));
|
||||||
|
pass = cfg_getx(grp, octstr_imm("sendsms-password"));
|
||||||
|
from = cfg_get(grp, octstr_imm("sendsms-global-sender"));
|
||||||
|
|
||||||
|
if (user && octstr_len(user) > 1)
|
||||||
|
octstr_url_encode(user);
|
||||||
|
if (pass && octstr_len(pass) > 1)
|
||||||
|
octstr_url_encode(pass);
|
||||||
|
if (from && octstr_len(from) > 1)
|
||||||
|
octstr_url_encode(from);
|
||||||
|
|
||||||
|
|
||||||
|
octstr_format_append(m->sendsms_url,
|
||||||
|
(from && octstr_len(from) > 1) ?
|
||||||
|
"?username=%S&password=%S&from=%S" :
|
||||||
|
"?username=%S&password=%S",
|
||||||
|
user,
|
||||||
|
pass,from);
|
||||||
|
|
||||||
|
m->system_user = octstr_format("system-user@%S",
|
||||||
|
m->hostname);
|
||||||
|
octstr_destroy(user);
|
||||||
|
octstr_destroy(pass);
|
||||||
|
if (from) octstr_destroy(from);
|
||||||
|
|
||||||
|
cfg_get_integer(&port, grp, octstr_imm("mms-port"));
|
||||||
|
|
||||||
|
m->port = (port > 0) ? port : MMS_PORT;
|
||||||
|
|
||||||
|
m->mm7port = -1;
|
||||||
|
cfg_get_integer(&m->mm7port, grp, octstr_imm("mm7-port"));
|
||||||
|
|
||||||
|
m->allow_ip = cfg_getx(grp, octstr_imm("allow-ip"));
|
||||||
|
m->deny_ip = cfg_getx(grp, octstr_imm("deny-ip"));
|
||||||
|
|
||||||
|
m->email2mmsrelay_prefixes = cfg_getx(grp,
|
||||||
|
octstr_imm("email2mms-relay-prefixes"));
|
||||||
|
|
||||||
|
m->prov_notify = cfg_getx(grp,octstr_imm("prov-server-notify-script"));
|
||||||
|
|
||||||
|
m->prov_getstatus = cfg_getx(grp,octstr_imm("prov-server-sub-status-script"));
|
||||||
|
m->mms_notify_txt = cfg_getx(grp, octstr_imm("mms-notify-text"));
|
||||||
|
m->mms_notify_unprov_txt = cfg_getx(grp, octstr_imm("mms-notify-unprovisioned-text"));
|
||||||
|
|
||||||
|
|
||||||
|
m->mms_email_txt = cfg_getx(grp, octstr_imm("mms-to-email-txt"));
|
||||||
|
m->mms_email_html = cfg_getx(grp, octstr_imm("mms-to-email-html"));
|
||||||
|
|
||||||
|
m->mms_toolarge = cfg_getx(grp, octstr_imm("mms-message-too-large-txt"));
|
||||||
|
|
||||||
|
m->wap_gw_msisdn_header = cfg_get(grp, octstr_imm("mms-client-msisdn-header"));
|
||||||
|
if (!m->wap_gw_msisdn_header) m->wap_gw_msisdn_header = octstr_imm(XMSISDN_HEADER);
|
||||||
|
|
||||||
|
m->wap_gw_ip_header = cfg_get(grp, octstr_imm("mms-client-ip-header"));
|
||||||
|
if (!m->wap_gw_ip_header) m->wap_gw_ip_header = octstr_imm(XIP_HEADER);
|
||||||
|
|
||||||
|
cfg_get_bool(&m->notify_unprovisioned, grp, octstr_imm("notify-unprovisioned"));
|
||||||
|
|
||||||
|
m->billing_params = cfg_getx(grp,
|
||||||
|
octstr_imm("billing-module-parameters"));
|
||||||
|
/* Get and load the billing lib if any. */
|
||||||
|
|
||||||
|
if ((m->mms_billfuncs = load_module(grp, "billing-library", "mms_billfuncs"))) {
|
||||||
|
if (m->mms_billfuncs->mms_billingmodule_init == NULL ||
|
||||||
|
m->mms_billfuncs->mms_billmsg == NULL ||
|
||||||
|
m->mms_billfuncs->mms_billingmodule_fini == NULL ||
|
||||||
|
m->mms_billfuncs->mms_logcdr == NULL)
|
||||||
|
panic(0, "Missing or NULL functions in billing module!");
|
||||||
|
} else
|
||||||
|
m->mms_billfuncs = &mms_billfuncs; /* The default one. */
|
||||||
|
|
||||||
|
m->mms_bill_module_data = m->mms_billfuncs->mms_billingmodule_init(octstr_get_cstr(m->billing_params));
|
||||||
|
|
||||||
|
m->resolver_params = cfg_getx(grp,
|
||||||
|
octstr_imm("resolver-module-parameters"));
|
||||||
|
|
||||||
|
/* Get and load the resolver lib if any. */
|
||||||
|
if ((m->mms_resolvefuncs = load_module(grp, "resolver-library", "mms_resolvefuncs"))) {
|
||||||
|
if (m->mms_resolvefuncs->mms_resolvermodule_init == NULL ||
|
||||||
|
m->mms_resolvefuncs->mms_resolve == NULL ||
|
||||||
|
m->mms_resolvefuncs->mms_resolvermodule_fini == NULL)
|
||||||
|
panic(0, "Missing or NULL functions in resolver module!");
|
||||||
|
} else
|
||||||
|
m->mms_resolvefuncs = &mms_resolvefuncs; /* The default one. */
|
||||||
|
|
||||||
|
m->mms_resolver_module_data = m->mms_resolvefuncs->mms_resolvermodule_init(octstr_get_cstr(m->resolver_params));
|
||||||
|
|
||||||
|
m->detokenizer_params = cfg_getx(grp, octstr_imm("detokenizer-module-parameters"));
|
||||||
|
|
||||||
|
/* Get and load the detokenizer lib if any. */
|
||||||
|
if ((m->mms_detokenizefuncs = load_module(grp, "detokenizer-library", "mms_detokenizefuncs"))) {
|
||||||
|
if (m->mms_detokenizefuncs->mms_detokenizer_init == NULL ||
|
||||||
|
m->mms_detokenizefuncs->mms_detokenize == NULL ||
|
||||||
|
m->mms_detokenizefuncs->mms_gettoken == NULL ||
|
||||||
|
m->mms_detokenizefuncs->mms_detokenizer_fini == NULL)
|
||||||
|
panic(0, "Missing or NULL functions in detokenizer module!");
|
||||||
|
if (m->mms_detokenizefuncs->mms_detokenizer_init(octstr_get_cstr(m->detokenizer_params)))
|
||||||
|
panic(0, "Detokenizer module failed to initialize");
|
||||||
|
} else
|
||||||
|
m->mms_detokenizefuncs = NULL;
|
||||||
|
|
||||||
|
if (cfg_get_bool(&m->allow_ip_type, grp, octstr_imm("allow-ip-type")) < 0)
|
||||||
|
m->allow_ip_type = 1;
|
||||||
|
|
||||||
|
cfg_get_bool(&m->optimize_notification_size, grp, octstr_imm("optimize-notification-size"));
|
||||||
|
|
||||||
|
if (cfg_get_bool(&m->content_adaptation, grp, octstr_imm("content-adaptation")) < 0)
|
||||||
|
m->content_adaptation = 1;
|
||||||
|
|
||||||
|
if (qdir)
|
||||||
|
octstr_destroy(qdir);
|
||||||
|
|
||||||
|
/* Now load the VASP list. */
|
||||||
|
l = cfg_get_multi_group(cfg, octstr_imm("mms-vasp"));
|
||||||
|
m->vasp_list = list_create();
|
||||||
|
for (i=0, n=list_len(l); i<n; i++) {
|
||||||
|
CfgGroup *grp = list_get(l, i);
|
||||||
|
MmsVasp *mv = gw_malloc(sizeof *mv);
|
||||||
|
Octstr *s;
|
||||||
|
mv->id = cfg_getx(grp, octstr_imm("vasp-id"));
|
||||||
|
mv->short_code = -1;
|
||||||
|
cfg_get_integer(&mv->short_code, grp, octstr_imm("short-code"));
|
||||||
|
|
||||||
|
mv->vasp_username = cfg_getx(grp, octstr_imm("vasp-username"));
|
||||||
|
mv->vasp_password = cfg_getx(grp, octstr_imm("vasp-password"));
|
||||||
|
|
||||||
|
mv->vasp_url = cfg_getx(grp, octstr_imm("vasp-url"));
|
||||||
|
|
||||||
|
mv->mmsc_username = cfg_getx(grp, octstr_imm("mmsc-username"));
|
||||||
|
mv->mmsc_password = cfg_getx(grp, octstr_imm("mmsc-password"));
|
||||||
|
|
||||||
|
s = cfg_getx(grp, octstr_imm("type"));
|
||||||
|
|
||||||
|
if (octstr_case_compare(s, octstr_imm("soap")) == 0)
|
||||||
|
mv->type = SOAP_VASP;
|
||||||
|
else if (octstr_case_compare(s, octstr_imm("eaif")) == 0)
|
||||||
|
mv->type = EAIF_VASP;
|
||||||
|
else
|
||||||
|
mv->type = NONE_VASP;
|
||||||
|
octstr_destroy(s);
|
||||||
|
|
||||||
|
list_append(m->vasp_list, mv);
|
||||||
|
}
|
||||||
|
list_destroy(l, NULL);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
List *mms_proxy_relays(Cfg *cfg)
|
||||||
|
{
|
||||||
|
List *gl = cfg_get_multi_group(cfg, octstr_imm("mmsproxy"));
|
||||||
|
int i, n;
|
||||||
|
List *l = list_create();
|
||||||
|
|
||||||
|
for (i = 0, n = list_len(gl); i < n; i++) {
|
||||||
|
CfgGroup *grp = list_get(gl, i);
|
||||||
|
MmsProxyRelay *m = gw_malloc(sizeof *m);
|
||||||
|
|
||||||
|
m->host = cfg_getx(grp, octstr_imm("host"));
|
||||||
|
m->name = cfg_getx(grp, octstr_imm("name"));
|
||||||
|
m->allowed_prefix = cfg_getx(grp, octstr_imm("allowed-prefix"));
|
||||||
|
m->denied_prefix = cfg_getx(grp, octstr_imm("denied-prefix"));
|
||||||
|
|
||||||
|
list_append(l, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
list_destroy(gl, NULL);
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
Octstr *mms_makefetchurl(char *qf, Octstr *token, int loc,
|
||||||
|
Octstr *to,
|
||||||
|
MmscSettings *settings)
|
||||||
|
{
|
||||||
|
Octstr *url = octstr_create("");
|
||||||
|
Octstr *host_alias = settings->host_alias;
|
||||||
|
Octstr *hstr;
|
||||||
|
Octstr *endtoken, *x;
|
||||||
|
|
||||||
|
MmsDetokenizerFuncStruct *tfs = settings->mms_detokenizefuncs;
|
||||||
|
|
||||||
|
if (host_alias && octstr_len(host_alias) > 0)
|
||||||
|
hstr = octstr_duplicate(host_alias);
|
||||||
|
else
|
||||||
|
hstr = octstr_format("%S:%d",
|
||||||
|
settings->hostname, settings->port);
|
||||||
|
|
||||||
|
octstr_format_append(url, "http://%S/%s@%d",
|
||||||
|
hstr,
|
||||||
|
qf, loc);
|
||||||
|
|
||||||
|
if (tfs && tfs->mms_gettoken) { /* we append the recipient token or we append the message token. */
|
||||||
|
endtoken = tfs->mms_gettoken(to);
|
||||||
|
if (!endtoken)
|
||||||
|
endtoken = octstr_imm("x");
|
||||||
|
} else {
|
||||||
|
if (!token)
|
||||||
|
endtoken = octstr_imm("x");
|
||||||
|
else
|
||||||
|
endtoken = octstr_duplicate(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
x = octstr_duplicate(endtoken); /* might be immutable, so we duplicate it. */
|
||||||
|
octstr_url_encode(x);
|
||||||
|
octstr_format_append(url, "/%S", x);
|
||||||
|
|
||||||
|
octstr_destroy(endtoken);
|
||||||
|
octstr_destroy(x);
|
||||||
|
octstr_destroy(hstr);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Octstr *mms_find_sender_msisdn(Octstr *send_url, List *request_hdrs, Octstr *msisdn_header,
|
||||||
|
MmsDetokenizerFuncStruct* detokenizerfuncs)
|
||||||
|
{
|
||||||
|
/* Either we have a WAP gateway header as defined, or we look for
|
||||||
|
* last part of url, pass it to detokenizer lib if defined, and back comes our number.
|
||||||
|
*/
|
||||||
|
|
||||||
|
Octstr *phonenum = http_header_value(request_hdrs,
|
||||||
|
msisdn_header);
|
||||||
|
|
||||||
|
if (!phonenum || octstr_len(phonenum) == 0) {
|
||||||
|
List *l = octstr_split(send_url, octstr_imm("/"));
|
||||||
|
|
||||||
|
if (l && list_len(l) > 1) {
|
||||||
|
if (detokenizerfuncs)
|
||||||
|
phonenum = detokenizerfuncs->mms_detokenize(list_get(l, list_len(l) - 1));
|
||||||
|
}
|
||||||
|
if (l)
|
||||||
|
list_destroy(l, (list_item_destructor_t *)octstr_destroy);
|
||||||
|
}
|
||||||
|
|
||||||
|
return phonenum;
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
#ifndef __MMSC_CFG__
|
||||||
|
#define __MMSC_CFG__
|
||||||
|
#include "mms_util.h"
|
||||||
|
#include "mms_resolve.h"
|
||||||
|
#include "mms_billing.h"
|
||||||
|
#include "mms_detokenize.h"
|
||||||
|
|
||||||
|
typedef struct MmsProxyRelay {
|
||||||
|
Octstr *host;
|
||||||
|
Octstr *name;
|
||||||
|
Octstr *allowed_prefix;
|
||||||
|
Octstr *denied_prefix;
|
||||||
|
} MmsProxyRelay;
|
||||||
|
|
||||||
|
typedef struct MmsVasp {
|
||||||
|
Octstr *id;
|
||||||
|
long short_code;
|
||||||
|
enum {SOAP_VASP, EAIF_VASP, NONE_VASP} type;
|
||||||
|
Octstr *vasp_username, *vasp_password;
|
||||||
|
Octstr *vasp_url;
|
||||||
|
Octstr *mmsc_username, *mmsc_password;
|
||||||
|
} MmsVasp;
|
||||||
|
|
||||||
|
typedef struct MmscSettings {
|
||||||
|
Octstr *system_user;
|
||||||
|
Octstr *name, *hostname, *host_alias;
|
||||||
|
List *local_domains;
|
||||||
|
Octstr *unified_prefix, *local_prefix;
|
||||||
|
Octstr *sendmail;
|
||||||
|
Octstr *global_queuedir, *mm1_queuedir, *mm4_queuedir;
|
||||||
|
Octstr *mmbox_rootdir;
|
||||||
|
|
||||||
|
Octstr *ua_profile_cache_dir;
|
||||||
|
|
||||||
|
long maxthreads;
|
||||||
|
long maxsendattempts;
|
||||||
|
long default_msgexpiry;
|
||||||
|
double queue_interval;
|
||||||
|
long send_back_off;
|
||||||
|
|
||||||
|
long port, mm7port;
|
||||||
|
|
||||||
|
Octstr *allow_ip;
|
||||||
|
Octstr *deny_ip;
|
||||||
|
|
||||||
|
Octstr *email2mmsrelay_prefixes;
|
||||||
|
Octstr *sendsms_url;
|
||||||
|
#if 0
|
||||||
|
Octstr *sendsms_user, *sendsms_pass, *sendsms_globalsender;
|
||||||
|
#endif
|
||||||
|
Octstr *billing_params;
|
||||||
|
|
||||||
|
MmsBillingFuncStruct *mms_billfuncs; /* Link to billing funcs. */
|
||||||
|
void *mms_bill_module_data;
|
||||||
|
|
||||||
|
Octstr *resolver_params;
|
||||||
|
MmsResolverFuncStruct *mms_resolvefuncs; /* Link to resolver funcs. */
|
||||||
|
void *mms_resolver_module_data;
|
||||||
|
|
||||||
|
Octstr *detokenizer_params;
|
||||||
|
MmsDetokenizerFuncStruct *mms_detokenizefuncs; /* Link to detokenizer funcs. */
|
||||||
|
void *mms_detokenizer_module_data;
|
||||||
|
|
||||||
|
int allow_ip_type;
|
||||||
|
|
||||||
|
int optimize_notification_size;
|
||||||
|
int content_adaptation;
|
||||||
|
|
||||||
|
Octstr *prov_notify;
|
||||||
|
|
||||||
|
Octstr *prov_getstatus;
|
||||||
|
int notify_unprovisioned;
|
||||||
|
Octstr *mms_notify_txt;
|
||||||
|
Octstr *mms_notify_unprov_txt;
|
||||||
|
Octstr *mms_toolarge;
|
||||||
|
|
||||||
|
Octstr *mms_email_txt;
|
||||||
|
Octstr *mms_email_html;
|
||||||
|
Octstr *wap_gw_msisdn_header;
|
||||||
|
Octstr *wap_gw_ip_header;
|
||||||
|
|
||||||
|
List *vasp_list; /* of MmsVasp * */
|
||||||
|
} MmscSettings;
|
||||||
|
|
||||||
|
/* Returns mmsc settings. */
|
||||||
|
MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays);
|
||||||
|
|
||||||
|
/* Returns list of MmsProxyRelay */
|
||||||
|
extern List *mms_proxy_relays(Cfg *cfg);
|
||||||
|
|
||||||
|
extern Octstr *mms_makefetchurl(char *qf, Octstr *token, int loc,
|
||||||
|
Octstr *to,
|
||||||
|
MmscSettings *settings);
|
||||||
|
|
||||||
|
Octstr *mms_find_sender_msisdn(Octstr *send_url, List *request_hdrs,
|
||||||
|
Octstr *msisdn_header,
|
||||||
|
MmsDetokenizerFuncStruct *detokenizerfuncs);
|
||||||
|
#endif
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include "mms_queue.h"
|
#include "mms_queue.h"
|
||||||
#include "mms_util.h"
|
#include "mmsc_cfg.h"
|
||||||
|
|
||||||
static MmsBoxSettings *settings;
|
static MmscSettings *settings;
|
||||||
|
|
||||||
static Octstr *xfrom;
|
static Octstr *xfrom;
|
||||||
static Octstr *xto;
|
static Octstr *xto;
|
||||||
|
@ -62,7 +62,7 @@ int main(int argc, char *argv[])
|
||||||
info(0, " MMSC Email2MMS Tool version %s starting", MMSC_VERSION);
|
info(0, " MMSC Email2MMS Tool version %s starting", MMSC_VERSION);
|
||||||
|
|
||||||
/* Load settings. */
|
/* Load settings. */
|
||||||
settings = mms_load_mmsbox_settings(cfg, &proxyrelays);
|
settings = mms_load_mmsc_settings(cfg, &proxyrelays);
|
||||||
|
|
||||||
if (!settings)
|
if (!settings)
|
||||||
panic(0, "No global MMSC configuration!");
|
panic(0, "No global MMSC configuration!");
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
#include "mms_queue.h"
|
#include "mms_queue.h"
|
||||||
|
|
||||||
#include "mms_uaprof.h"
|
#include "mms_uaprof.h"
|
||||||
#include "mms_util.h"
|
#include "mmsc_cfg.h"
|
||||||
#include "mms_mm7soap.h"
|
#include "mms_mm7soap.h"
|
||||||
|
|
||||||
|
|
||||||
static Cfg *cfg;
|
static Cfg *cfg;
|
||||||
static List *proxyrelays;
|
static List *proxyrelays;
|
||||||
static MmsBoxSettings *settings;
|
static MmscSettings *settings;
|
||||||
|
|
||||||
static int rstop = 0;
|
static int rstop = 0;
|
||||||
static void quit_now(int notused)
|
static void quit_now(int notused)
|
||||||
|
@ -86,7 +86,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
/* Load settings. */
|
/* Load settings. */
|
||||||
settings = mms_load_mmsbox_settings(cfg, &proxyrelays);
|
settings = mms_load_mmsc_settings(cfg, &proxyrelays);
|
||||||
|
|
||||||
cfg_destroy(cfg);
|
cfg_destroy(cfg);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "mmsrelay.h"
|
#include "mmsrelay.h"
|
||||||
|
|
||||||
static Cfg *cfg;
|
static Cfg *cfg;
|
||||||
MmsBoxSettings *settings;
|
MmscSettings *settings;
|
||||||
List *proxyrelays;
|
List *proxyrelays;
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
||||||
info(0, " " MM_NAME " MMSC Relay version %s starting", MMSC_VERSION);
|
info(0, " " MM_NAME " MMSC Relay version %s starting", MMSC_VERSION);
|
||||||
|
|
||||||
|
|
||||||
settings = mms_load_mmsbox_settings(cfg,&proxyrelays);
|
settings = mms_load_mmsc_settings(cfg,&proxyrelays);
|
||||||
|
|
||||||
cfg_destroy(cfg);
|
cfg_destroy(cfg);
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "mms_queue.h"
|
#include "mms_queue.h"
|
||||||
#include "mms_uaprof.h"
|
#include "mms_uaprof.h"
|
||||||
#include "mms_util.h"
|
#include "mmsc_cfg.h"
|
||||||
#include "mms_mm7soap.h"
|
#include "mms_mm7soap.h"
|
||||||
|
|
||||||
extern void mbuni_global_queue_runner(int *stopflag);
|
extern void mbuni_global_queue_runner(int *stopflag);
|
||||||
extern void mbuni_mm1_queue_runner(int *stopflag);
|
extern void mbuni_mm1_queue_runner(int *stopflag);
|
||||||
extern MmsBoxSettings *settings;
|
extern MmscSettings *settings;
|
||||||
extern List *proxyrelays;
|
extern List *proxyrelays;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "mms_queue.h"
|
#include "mms_queue.h"
|
||||||
#include "mms_uaprof.h"
|
#include "mms_uaprof.h"
|
||||||
#include "mms_util.h"
|
#include "mmsc_cfg.h"
|
||||||
#include "mms_mmbox.h"
|
#include "mms_mmbox.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ static MmsMsg *m;
|
||||||
static int savetommbox;
|
static int savetommbox;
|
||||||
Octstr *mmbox;
|
Octstr *mmbox;
|
||||||
|
|
||||||
static MmsBoxSettings *settings;
|
static MmscSettings *settings;
|
||||||
|
|
||||||
static int find_own(int i, int argc, char *argv[])
|
static int find_own(int i, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
/* Load settings. */
|
/* Load settings. */
|
||||||
settings = mms_load_mmsbox_settings(cfg, &proxyrelays);
|
settings = mms_load_mmsc_settings(cfg, &proxyrelays);
|
||||||
|
|
||||||
if (!settings)
|
if (!settings)
|
||||||
panic(0, "No global MMSC configuration!");
|
panic(0, "No global MMSC configuration!");
|
||||||
|
|
Loading…
Reference in New Issue