From 38a4b2197cb5243f98d544e15a8a1d5a184e8843 Mon Sep 17 00:00:00 2001
From: bagyenda <>
Date: Thu, 7 Apr 2005 12:21:35 +0000
Subject: [PATCH] Misc. bug fixes, beginnings of MM7 work.
---
mbuni/mmlib/Makefile.am | 2 +-
mbuni/mmlib/Makefile.in | 8 +-
mbuni/mmlib/mms_mm7soap.c | 415 +++++++++++++++++++++++++++++++++++
mbuni/mmlib/mms_mm7soap.h | 10 +
mbuni/mmlib/mms_queue.c | 6 +-
mbuni/mmlib/mms_strings.def | 60 +++++
mbuni/mmlib/mms_strings.h | 3 +-
mbuni/mmlib/mms_util.c | 19 +-
mbuni/mmlib/mms_util.h | 2 +-
mbuni/mmsc/mmsmobilesender.c | 5 +-
10 files changed, 505 insertions(+), 25 deletions(-)
create mode 100644 mbuni/mmlib/mms_mm7soap.c
create mode 100644 mbuni/mmlib/mms_mm7soap.h
diff --git a/mbuni/mmlib/Makefile.am b/mbuni/mmlib/Makefile.am
index 8bea4d8..3fbd577 100644
--- a/mbuni/mmlib/Makefile.am
+++ b/mbuni/mmlib/Makefile.am
@@ -1,5 +1,5 @@
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.c
+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.c mms_mm7soap.c
plugindir = $(libdir)/mbuni
plugin_LTLIBRARIES = libmms_billing_shell.la libmms_resolve_shell.la libmms_detokenize_shell.la
diff --git a/mbuni/mmlib/Makefile.in b/mbuni/mmlib/Makefile.in
index 7e14f0e..c5f20ed 100644
--- a/mbuni/mmlib/Makefile.in
+++ b/mbuni/mmlib/Makefile.in
@@ -11,7 +11,7 @@
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-#
+
@SET_MAKE@
@@ -54,7 +54,8 @@ libmms_a_AR = $(AR) $(ARFLAGS)
libmms_a_LIBADD =
am_libmms_a_OBJECTS = mms_mmbox.$(OBJEXT) mms_billing.$(OBJEXT) \
mms_msg.$(OBJEXT) mms_queue.$(OBJEXT) mms_strings.$(OBJEXT) \
- mms_uaprof.$(OBJEXT) mms_util.$(OBJEXT) mms_resolve.$(OBJEXT)
+ mms_uaprof.$(OBJEXT) mms_util.$(OBJEXT) mms_resolve.$(OBJEXT) \
+ mms_mm7soap.$(OBJEXT)
libmms_a_OBJECTS = $(am_libmms_a_OBJECTS)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -196,7 +197,7 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
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.c
+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.c mms_mm7soap.c
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
@@ -286,6 +287,7 @@ distclean-compile:
@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_mmbox.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@
diff --git a/mbuni/mmlib/mms_mm7soap.c b/mbuni/mmlib/mms_mm7soap.c
new file mode 100644
index 0000000..3def890
--- /dev/null
+++ b/mbuni/mmlib/mms_mm7soap.c
@@ -0,0 +1,415 @@
+#include "mms_mm7soap.h"
+
+/* function to traverse SOAP env:Body extracting useful headers. */
+
+#define dfltstr(e) ((e) ? ((char *)(e)) : "")
+
+#define content(n) ((n)->xmlChildrenNode ? dfltstr(((n)->xmlChildrenNode)->content) : dfltstr((n)->content))
+
+static Octstr *parse_time(char *s)
+{
+ time_t t = time(NULL);
+ Octstr *p = octstr_create(s);
+ int i = 0, secs = 0;
+
+ octstr_strip_blanks(p);
+
+ if (s && s[0] != 'P')
+ return p;
+ else
+ i++;
+
+ while (i < octstr_len(p)) {
+ long n = 0;
+ int ch;
+
+ if (octstr_get_char(p, i) == 'T') {
+ secs = 1;
+ i++;
+ }
+
+ i = octstr_parse_long(&n, p, i, 10);
+
+ if (i < 0)
+ break;
+ ch = octstr_get_char(p, i);
+ i++;
+ switch(ch) {
+ case 'Y': /* years. approx to 365 1/4 days. */
+ t += (365.25*24*3600*n);
+ break;
+ case 'M': /* month or minutes. approx month = 30 days. */
+ if (secs)
+ t += n*60;
+ else
+ t += 30*24*3600*n;
+ break;
+ case 'D':
+ t += n*24*3600;
+ break;
+ case 'H': /* hours. */
+ t += n*3600;
+ break;
+ case 'S':
+ t += n;
+ break;
+ default:
+ break;
+ }
+ }
+
+ octstr_destroy(p);
+ return date_create_iso(t);
+}
+
+static int parse_header(xmlNodePtr node, List *headers, int *sigparent)
+{
+ int skip = 0;
+ int tag;
+ char *hname;
+ char *s = NULL;
+ char *nvalue;
+ Octstr *value = NULL, *tmp;
+
+
+ if (!node || node->type != XML_ELEMENT_NODE)
+ return -1;
+
+ /* look at each node in turn, extract meaning.
+ * we ignore some tags: senderidentification, etc because we don't need them.
+ * we are also not strict on syntax (when receiving): we will be on sending!
+ */
+
+ hname = (char *)node->name;
+ nvalue = content(node);
+
+ tmp = octstr_create(hname);
+ tag = mms_string_to_mm7tag(tmp);
+ octstr_destroy(tmp);
+
+ switch(tag) {
+ case MM7_TAG_CancelReq:
+ case MM7_TAG_CancelRsp:
+ case MM7_TAG_DeliverReq:
+ case MM7_TAG_DeliverRsp:
+ case MM7_TAG_DeliveryReportReq:
+ case MM7_TAG_DeliveryReportRsp:
+ case MM7_TAG_RSErrorRsp:
+ case MM7_TAG_ReadReplyReq:
+ case MM7_TAG_ReadReplyRsp:
+ case MM7_TAG_ReplaceReq:
+ case MM7_TAG_ReplaceRsp:
+ case MM7_TAG_SubmitReq:
+ case MM7_TAG_SubmitRsp:
+ case MM7_TAG_VASPErrorRsp:
+ hname = "MessageType";
+ value = mms_mm7tag_to_string(tag);
+ break;
+ case MM7_TAG_SenderIdentification:
+ case MM7_TAG_Recipients:
+ skip = 1;
+ break;
+ case MM7_TAG_To:
+ case MM7_TAG_Cc:
+ case MM7_TAG_Bcc:
+ skip = 1;
+ *sigparent = tag; /* We wait for number and stuff below. */
+ break;
+ case MM7_TAG_Content:
+ if ((s = xmlGetProp(node, "href")) != NULL) {
+ value = octstr_create(s);
+ xmlFree(s);
+ }
+ /* we keep 'cid:' bit. ignore the bit about adaptation. */
+ break;
+
+ case MM7_TAG_Number: /* we will not normalise number here, that's for upper level. */
+ value = octstr_format("%s/TYPE=PLMN", nvalue);
+
+ /* -- fall through. -- */
+ case MM7_TAG_RFC2822Address:
+ if (!value)
+ value = octstr_create(nvalue);
+ hname = mms_mm7tag_to_cstr(*sigparent); /* real tag is parent. */
+
+ s = xmlGetProp(node, "displayOnly");
+ if (s && strcasecmp(s, "true") == 0) /* a '-' indicates don't use this to send. */
+ octstr_insert(value, octstr_imm("- "), 0);
+ else
+ octstr_insert(value, octstr_imm("+ "), 0);
+ if (s)
+ xmlFree(s);
+ break;
+
+ case MM7_TAG_EarliestDeliveryTime:
+ case MM7_TAG_ExpiryDate:
+ value = parse_time(nvalue);
+ break;
+
+ case MM7_TAG_ReplyCharging:
+ value = octstr_imm("Requested");
+
+ if ((s = xmlGetProp(node, "replyChargingSize")) != NULL) {
+ http_header_add(headers, "replyChargingSize", s);
+ xmlFree(s);
+ }
+ if ((s = xmlGetProp(node, "replyDeadline")) != NULL) {
+ Octstr *t = parse_time(s);
+ http_header_add(headers, "replyDeadline", octstr_get_cstr(t));
+ xmlFree(s);
+ octstr_destroy(t);
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!value)
+ value = octstr_create(nvalue);
+ octstr_strip_blanks(value);
+
+ if (!skip && tag >= 0)
+ http_header_add(headers, hname, octstr_get_cstr(value));
+ octstr_destroy(value);
+
+ return 0;
+}
+
+static int parse_headers(xmlNodePtr start, List *h, int sigparent)
+{
+ xmlNodePtr x;
+
+ for (x = start; x; x = x->next)
+ if (x->type != XML_COMMENT_NODE) {
+ parse_header(x, h, &sigparent);
+ parse_headers(x->xmlChildrenNode, h, sigparent);
+ }
+ return 0;
+}
+
+List *parse_soapmsg(Octstr *xml)
+{
+ xmlDocPtr doc = xmlParseMemory(octstr_get_cstr(xml), octstr_len(xml));
+ List *h;
+ int s = -1;
+ if (!doc || !doc->xmlChildrenNode)
+ return NULL;
+
+ h = http_create_empty_headers();
+
+ parse_headers(doc->xmlChildrenNode, h, s);
+
+ /* Free the doc! */
+ return h;
+}
+
+static void output_rcpt(char *hdr, List *hdrs, Octstr *p)
+{
+ List *l = http_header_find_all(hdrs, hdr);
+ char x[32];
+ int i, n;
+
+ for (i = 0, n = list_len(l), x[0]=0; i < n; i++) {
+ Octstr *h = NULL, *v = NULL;
+ int ch, j;
+ char *y;
+ http_header_get(l, i, &h, &v);
+
+ if (octstr_str_compare(h, x) != 0) {
+ if (x[0])
+ octstr_format_append(p, "%s>\n", x);
+ strncpy(x, octstr_get_cstr(h), sizeof x);
+ octstr_format_append(p, "<%S>\n", h);
+ }
+ octstr_destroy(h);
+
+ ch = octstr_get_char(v, 0);
+ if (ch == '-')
+ y = " displayOnly=\"true\"";
+ else
+ y = "";
+ j = octstr_case_search(v, octstr_imm("/TYPE=PLMN"),0);
+ if (j > 0) {
+ Octstr *z = octstr_copy(v, 2, j-2); /* skip the initial char that is only for info purposes. */
+ octstr_format_append(p, "%S\n", y, z);
+ octstr_destroy(z);
+ } else
+ octstr_format_append(p, "%s\n",
+ y, octstr_get_cstr(v) + 2); /* as above... */
+ octstr_destroy(v);
+ }
+ if (x[0]) /* close it off. */
+ octstr_format_append(p, "%s>\n", x);
+
+ http_destroy_headers(l);
+}
+
+#define XMLNSMM7 "http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3"
+/* Construct by hand. */
+Octstr *headers_to_soapxml(List *hdrs)
+{
+ Octstr *s = octstr_create("\n");
+ Octstr *p, *q, *fault, *mtype;
+ int i, n;
+
+ octstr_append_cstr(s,
+ "\n"
+ "\n");
+ p = http_header_value(hdrs, octstr_imm("TransactionID"));
+
+ octstr_format_append(s, "%S\n",
+ XMLNSMM7, p ? p : octstr_imm("none"));
+ if (p)
+ octstr_destroy(p);
+
+ octstr_append_cstr(s, "\n\n");
+
+ fault = http_header_value(hdrs, octstr_imm("Fault"));
+
+ if (fault) {
+ Octstr *fc = http_header_value(hdrs, octstr_imm("faultcode"));
+ Octstr *fs = http_header_value(hdrs, octstr_imm("faultstring"));
+
+ octstr_append_cstr(s, "\n");
+ if (fc) {
+ octstr_format_append(s, "%S\n", fc);
+ octstr_destroy(fc);
+ }
+ if (fs) {
+ octstr_format_append(s, "%S\n", fs);
+ octstr_destroy(fs);
+ }
+ octstr_append_cstr(s, "\n");
+ }
+
+
+ mtype = http_header_value(hdrs, octstr_imm("MessageType"));
+
+ octstr_format_append(s, "<%S xmlns=\"%s\">\n", mtype, XMLNSMM7);
+
+ /* Output the details. */
+ p = http_header_value(hdrs, octstr_imm("MM7Version"));
+ octstr_format_append(s, "%S\n", p);
+ octstr_destroy(p);
+
+ p = http_header_value(hdrs, octstr_imm("VASPID"));
+ q = http_header_value(hdrs, octstr_imm("VASID"));
+
+ if (p || q) {
+
+ octstr_append_cstr(s, "\n");
+ if (p)
+ octstr_format_append(s, "%S\n", p);
+
+ if (q)
+ octstr_format_append(s, "%S\n", q);
+
+ octstr_append_cstr(s, "\n");
+ if (p) octstr_destroy(p);
+ if (q) octstr_destroy(q);
+ }
+
+ p = octstr_create("");
+
+ output_rcpt("To", hdrs, p);
+ output_rcpt("Cc", hdrs, p);
+ output_rcpt("Bcc", hdrs, p);
+
+ if (octstr_len(p) > 0)
+ octstr_format_append(s, "\n%S\n", p);
+ octstr_destroy(p);
+
+
+ /* cycle through rest of headers. */
+
+ for (i = 0, n = list_len(hdrs); i < n; i++) {
+ Octstr *h = NULL, *v = NULL;
+ char *zz;
+ int tag;
+ int skip = 0;
+
+ http_header_get(hdrs, i, &h, &v);
+ tag = mms_string_to_mm7tag(h);
+ zz = octstr_get_cstr(h);
+
+ switch(tag) {
+ case MM7_TAG_MessageType:
+ case MM7_TAG_To:
+ case MM7_TAG_Cc:
+ case MM7_TAG_Bcc:
+ case MM7_TAG_Fault:
+ case MM7_TAG_faultstring:
+ case MM7_TAG_faultcode:
+ case MM7_TAG_VASID:
+ case MM7_TAG_VASPID:
+ case MM7_TAG_MM7Version:
+ case MM7_TAG_replyChargingSize:
+ case MM7_TAG_replyDeadline:
+ case MM7_TAG_TransactionID:
+ case MM7_TAG_StatusCode:
+ case MM7_TAG_StatusText:
+ skip = 1;
+ break;
+ case MM7_TAG_Content:
+ octstr_format_append(s, "\n", v);
+ skip = 1;
+ break;
+ case MM7_TAG_ReplyCharging:
+ p = http_header_value(hdrs, octstr_imm("replyChargingSize"));
+ q = http_header_value(hdrs, octstr_imm("replyDeadline"));
+
+ octstr_append_cstr(s, "\n");
+ skip = 1;
+ break;
+
+ case MM7_TAG_Status:
+ p = http_header_value(hdrs, octstr_imm("StatusCode"));
+ q = http_header_value(hdrs, octstr_imm("StatusText"));
+
+ octstr_append_cstr(s, "\n");
+ if (p) {
+ octstr_format_append(s, "%S\n", p);
+ octstr_destroy(p);
+ }
+ if (q) {
+ octstr_format_append(s, "%S\n", q);
+ octstr_destroy(q);
+ }
+ octstr_append_cstr(s, "\n");
+ skip = 1;
+ break;
+
+ default:
+ break;
+ }
+
+ if (!skip && h && v)
+ octstr_format_append(s, "<%S>%S%S>\n", h, v, h);
+
+ if (h) octstr_destroy(h);
+ if (v) octstr_destroy(v);
+ }
+ octstr_format_append(s, "%S>\n", mtype);
+ octstr_destroy(mtype);
+
+ if (fault) {
+
+ octstr_append_cstr(s, "\n");
+ octstr_append_cstr(s, "\n");
+ octstr_destroy(fault);
+ }
+
+ octstr_append_cstr(s, "\n");
+ octstr_append_cstr(s, "\n");
+
+ return s;
+}
diff --git a/mbuni/mmlib/mms_mm7soap.h b/mbuni/mmlib/mms_mm7soap.h
new file mode 100644
index 0000000..3ce07e6
--- /dev/null
+++ b/mbuni/mmlib/mms_mm7soap.h
@@ -0,0 +1,10 @@
+#ifndef __MMS_MM7SOAP_INCLUDED__
+#define __MMS_MM7SOAP_INCLUDED__
+#include "mms_util.h"
+typedef struct Mm7Soap_t *Mm7Soap_t;
+
+extern Mm7Soap_t *mms_mm7soap_from_mime(Octstr *text);
+
+extern List *parse_soapmsg(Octstr *xml);
+extern Octstr *headers_to_soapxml(List *hdrs);
+#endif
diff --git a/mbuni/mmlib/mms_queue.c b/mbuni/mmlib/mms_queue.c
index 16b3001..d6741c3 100644
--- a/mbuni/mmlib/mms_queue.c
+++ b/mbuni/mmlib/mms_queue.c
@@ -222,7 +222,7 @@ static int writeenvelope(MmsEnvelope *e, int newenv)
{
Octstr *tfname = NULL;
char *s;
- char buf[16];
+ char buf[64];
int fd;
int i, n;
int res = 0;
@@ -602,9 +602,9 @@ int mms_queue_update(MmsEnvelope *e)
MmsEnvelopeTo *x;
if (!e) return -1;
-
+
for (i = 0; i < n; i++)
- if ((x = list_get(e->to, i)) &&
+ if ((x = list_get(e->to, i)) != NULL &&
x->process) {
hasrcpt = 1;
break;
diff --git a/mbuni/mmlib/mms_strings.def b/mbuni/mmlib/mms_strings.def
index 4d9b6f0..e7aa19e 100644
--- a/mbuni/mmlib/mms_strings.def
+++ b/mbuni/mmlib/mms_strings.def
@@ -243,6 +243,66 @@ NUMBERED(descriptor_params,
ASSIGN("type", 130)
)
+NAMED(mm7tag,
+VNSTRING(MM7_5, "Bcc",MM7_TAG_Bcc)
+VNSTRING(MM7_5, "CancelReq",MM7_TAG_CancelReq)
+VNSTRING(MM7_5, "CancelRsp",MM7_TAG_CancelRsp)
+VNSTRING(MM7_5, "Cc",MM7_TAG_Cc)
+VNSTRING(MM7_5, "ChargedParty",MM7_TAG_ChargedParty)
+VNSTRING(MM7_5, "Content",MM7_TAG_Content)
+VNSTRING(MM7_5, "Date",MM7_TAG_Date)
+VNSTRING(MM7_5, "DeliverReq",MM7_TAG_DeliverReq)
+VNSTRING(MM7_5, "DeliverRsp",MM7_TAG_DeliverRsp)
+VNSTRING(MM7_5, "DeliveryReport",MM7_TAG_DeliveryReport)
+VNSTRING(MM7_5, "DeliveryReportReq",MM7_TAG_DeliveryReportReq)
+VNSTRING(MM7_5, "DeliveryReportRsp",MM7_TAG_DeliveryReportRsp)
+VNSTRING(MM7_5, "DistributionIndicator",MM7_TAG_DistributionIndicator)
+VNSTRING(MM7_5, "EarliestDeliveryTime",MM7_TAG_EarliestDeliveryTime)
+VNSTRING(MM7_5, "ExpiryDate",MM7_TAG_ExpiryDate)
+VNSTRING(MM7_5, "LinkedID",MM7_TAG_LinkedID)
+VNSTRING(MM7_5, "MM7Version",MM7_TAG_MM7Version)
+VNSTRING(MM7_5, "MMSRelayServerID",MM7_TAG_MMSRelayServerID)
+VNSTRING(MM7_5, "MMStatus",MM7_TAG_MMStatus)
+VNSTRING(MM7_5, "MessageClass",MM7_TAG_MessageClass)
+VNSTRING(MM7_5, "MessageID",MM7_TAG_MessageID)
+VNSTRING(MM7_5, "Number",MM7_TAG_Number)
+VNSTRING(MM7_5, "Priority",MM7_TAG_Priority)
+VNSTRING(MM7_5, "RFC2822Address",MM7_TAG_RFC2822Address)
+VNSTRING(MM7_5, "RSErrorRsp",MM7_TAG_RSErrorRsp)
+VNSTRING(MM7_5, "ReadReply",MM7_TAG_ReadReply)
+VNSTRING(MM7_5, "ReadReplyReq",MM7_TAG_ReadReplyReq)
+VNSTRING(MM7_5, "ReadReplyRsp",MM7_TAG_ReadReplyRsp)
+VNSTRING(MM7_5, "Recipient",MM7_TAG_Recipient)
+VNSTRING(MM7_5, "Recipients",MM7_TAG_Recipients)
+VNSTRING(MM7_5, "ReplaceReq",MM7_TAG_ReplaceReq)
+VNSTRING(MM7_5, "ReplaceRsp",MM7_TAG_ReplaceRsp)
+VNSTRING(MM7_5, "ReplyCharging",MM7_TAG_ReplyCharging)
+VNSTRING(MM7_5, "ReplyChargingID",MM7_TAG_ReplyChargingID)
+VNSTRING(MM7_5, "Sender",MM7_TAG_Sender)
+VNSTRING(MM7_5, "SenderAddress",MM7_TAG_SenderAddress)
+VNSTRING(MM7_5, "SenderIdentification",MM7_TAG_SenderIdentification)
+VNSTRING(MM7_5, "ServiceCode",MM7_TAG_ServiceCode)
+VNSTRING(MM7_5, "ShortCode",MM7_TAG_ShortCode)
+VNSTRING(MM7_5, "Status",MM7_TAG_Status)
+VNSTRING(MM7_5, "StatusCode",MM7_TAG_StatusCode)
+VNSTRING(MM7_5, "StatusText",MM7_TAG_StatusText)
+VNSTRING(MM7_5, "Subject",MM7_TAG_Subject)
+VNSTRING(MM7_5, "SubmitReq",MM7_TAG_SubmitReq)
+VNSTRING(MM7_5, "SubmitRsp",MM7_TAG_SubmitRsp)
+VNSTRING(MM7_5, "TimeStamp",MM7_TAG_TimeStamp)
+VNSTRING(MM7_5, "To",MM7_TAG_To)
+VNSTRING(MM7_5, "TransactionID",MM7_TAG_TransactionID)
+VNSTRING(MM7_5, "VASID",MM7_TAG_VASID)
+VNSTRING(MM7_5, "VASPErrorRsp",MM7_TAG_VASPErrorRsp)
+VNSTRING(MM7_5, "VASPID",MM7_TAG_VASPID)
+VNSTRING(MM7_5, "Fault",MM7_TAG_Fault)
+VNSTRING(MM7_5, "faultcode",MM7_TAG_faultcode)
+VNSTRING(MM7_5, "faultstring",MM7_TAG_faultstring)
+VNSTRING(MM7_5, "MessageType",MM7_TAG_MessageType)
+VNSTRING(MM7_5, "replyChargingSize", MM7_TAG_replyChargingSize)
+VNSTRING(MM7_5, "replyDeadline", MM7_TAG_replyDeadline)
+)
+
#undef LINEAR
#undef STRING
#undef VSTRING
diff --git a/mbuni/mmlib/mms_strings.h b/mbuni/mmlib/mms_strings.h
index f9731ea..e89cda8 100644
--- a/mbuni/mmlib/mms_strings.h
+++ b/mbuni/mmlib/mms_strings.h
@@ -15,7 +15,8 @@
typedef enum {
MS_1_1 = 1,
- MS_1_2 = 2
+ MS_1_2 = 2,
+ MM7_5 = 5
} mms_encoding;
#define MMS_DEFAULT_VERSION "1.0"
/* Declare the functions */
diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c
index be8983c..4d92284 100644
--- a/mbuni/mmlib/mms_util.c
+++ b/mbuni/mmlib/mms_util.c
@@ -38,12 +38,6 @@ static Octstr *cfg_getx(CfgGroup *grp, Octstr *item)
return v ? v : octstr_create("");
}
-/* We seem to require this on OSX */
-#ifdef __APPLE__
-#define SYMPREFIX ""
-#else
-#define SYMPREFIX ""
-#endif
static void *load_module(CfgGroup *grp, char *config_key, char *symbolname)
{
@@ -196,7 +190,7 @@ MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg)
octstr_imm("billing-module-parameters"));
/* Get and load the billing lib if any. */
- if ((m->mms_billfuncs = load_module(grp, "billing-library", SYMPREFIX "mms_billfuncs"))) {
+ 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 ||
@@ -211,7 +205,7 @@ MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg)
octstr_imm("resolver-module-parameters"));
/* Get and load the resolver lib if any. */
- if ((m->mms_resolvefuncs = load_module(grp, "resolver-library", SYMPREFIX "mms_resolvefuncs"))) {
+ 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)
@@ -224,7 +218,7 @@ MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg)
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", SYMPREFIX "mms_detokenizefuncs"))) {
+ 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 ||
@@ -292,10 +286,11 @@ Octstr *mms_makefetchurl(char *qf, Octstr *token, int 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_create("x");
+ if (!endtoken)
+ endtoken = octstr_imm("x");
} else {
if (!token)
- token = octstr_create("x");
+ endtoken = octstr_imm("x");
else
endtoken = octstr_duplicate(token);
}
@@ -325,8 +320,6 @@ Octstr *mms_find_sender_msisdn(Octstr *send_url, List *request_hdrs, Octstr *msi
List *l = octstr_split(send_url, octstr_imm("/"));
if (l && list_len(l) > 1) {
- int i, n = list_len(l);
- Octstr *s;
if (detokenizerfuncs)
phonenum = detokenizerfuncs->mms_detokenize(list_get(l, list_len(l) - 1));
}
diff --git a/mbuni/mmlib/mms_util.h b/mbuni/mmlib/mms_util.h
index 92f74ff..cb7b375 100644
--- a/mbuni/mmlib/mms_util.h
+++ b/mbuni/mmlib/mms_util.h
@@ -32,7 +32,7 @@
#define SEND_ERROR_STR(e) ((e) == MMS_SEND_OK ? "Sent" : (e) == MMS_SEND_ERROR_TRANSIENT ? "Retry later" : "Failed")
/* Useful headers. */
#define XMSISDN_HEADER "X-WAP-Network-Client-MSISDN"
-#define XIP_HEADER "X-WAP-Network-Client-Address"
+#define XIP_HEADER "X-WAP-Network-Client-IP"
#define MM_NAME "DS_MM"
typedef struct MmsProxyRelay {
diff --git a/mbuni/mmsc/mmsmobilesender.c b/mbuni/mmsc/mmsmobilesender.c
index 97e6910..415cc42 100644
--- a/mbuni/mmsc/mmsmobilesender.c
+++ b/mbuni/mmsc/mmsmobilesender.c
@@ -155,8 +155,7 @@ static int receive_push_reply(HTTPCaller *caller)
{
int http_status;
List *reply_headers;
- Octstr *final_url,
- *reply_body;
+ Octstr *final_url, *reply_body;
MmsEnvelope *env;
@@ -164,7 +163,7 @@ static int receive_push_reply(HTTPCaller *caller)
while ((env = http_receive_result(caller, &http_status, &final_url, &reply_headers,
&reply_body)) != NULL) {
- MmsEnvelopeTo *xto;
+ MmsEnvelopeTo *xto = NULL;
Octstr *to = NULL;
if (http_status == -1 || final_url == NULL) {