Allowed setting of MM7/SOAP interface version
This commit is contained in:
parent
89c9b8eddb
commit
a22898306a
|
@ -1,3 +1,5 @@
|
|||
2007-04-10 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* MM7/SOAP XMLNS string now configurable via setting per-MMC (or per-VASP) interface version
|
||||
2007-04-02 Vincent Chavanis <vincent@telemaque.fr>
|
||||
* Added group-id field to VAS GW MMC config
|
||||
2007-03-20 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
|
|
|
@ -1688,6 +1688,23 @@ vasp-url
|
|||
This should be one of: soap, eaif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign=top >
|
||||
<tt>mm7-version</tt>
|
||||
</td>
|
||||
<td valign=top >
|
||||
String
|
||||
</td>
|
||||
<td valign=top >
|
||||
Optional. The MM7 version to use on this interface. (defaults are "5.1.0" for
|
||||
XML/SOAP, "3.0" for EAIF.) For SOAP, this is
|
||||
used primarily to build the XML Namespace URL. For EAIF it is
|
||||
reported in the HTTP headers.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign=top >
|
||||
<tt>short-code</tt>
|
||||
|
@ -2005,6 +2022,21 @@ Supported configuration parameters are:
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign=top >
|
||||
<tt>mm7-version</tt>
|
||||
</td>
|
||||
<td valign=top >
|
||||
String
|
||||
</td>
|
||||
<td valign=top >
|
||||
Optional. The MM7 version to use on this interface. (defaults are "5.1.0" for
|
||||
XML/SOAP, "3.0" for EAIF.) For SOAP, this is
|
||||
used primarily to build the XML Namespace URL. For EAIF it is
|
||||
reported in the HTTP headers.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign=top >
|
||||
<tt>mmsc-url</tt>
|
||||
|
|
|
@ -97,6 +97,7 @@ MULTI_GROUP(mmsproxy,
|
|||
MULTI_GROUP(mms-vasp,
|
||||
OCTSTR(vasp-id)
|
||||
OCTSTR(type)
|
||||
OCTSTR(mm7-version)
|
||||
OCTSTR(short-code)
|
||||
OCTSTR(vasp-username)
|
||||
OCTSTR(vasp-password)
|
||||
|
@ -127,6 +128,7 @@ MULTI_GROUP(mmsc,
|
|||
OCTSTR(incoming-port-ssl)
|
||||
OCTSTR(max-throughput)
|
||||
OCTSTR(type)
|
||||
OCTSTR(mm7-version)
|
||||
)
|
||||
|
||||
MULTI_GROUP(mms-service,
|
||||
|
|
|
@ -360,13 +360,15 @@ static void output_rcpt(char *hdr, List *hdrs, Octstr *p)
|
|||
http_destroy_headers(l);
|
||||
}
|
||||
|
||||
#define XMLNSMM7 "http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2"
|
||||
#define XMLNSMM7 "http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-%d-MM7-%d-%d"
|
||||
#define SOAP_ENV "SOAP-ENV"
|
||||
|
||||
/* Construct by hand. */
|
||||
Octstr *headers_to_soapxml(List *hdrs)
|
||||
static Octstr *headers_to_soapxml(List *hdrs, MM7Version_t *ver)
|
||||
{
|
||||
Octstr *s = octstr_create("<?xml version='1.0' encoding='UTF-8'?>\n");
|
||||
Octstr *xmlns = octstr_format(XMLNSMM7, ver->major, ver->minor1, ver->minor2);
|
||||
|
||||
Octstr *p, *q, *r, *fault, *mtype;
|
||||
int i, n;
|
||||
time_t t;
|
||||
|
@ -378,7 +380,7 @@ Octstr *headers_to_soapxml(List *hdrs)
|
|||
p = http_header_value(hdrs, octstr_imm("TransactionID"));
|
||||
|
||||
octstr_format_append(s, "<mm7:TransactionID xmlns:mm7=\"%s\" " SOAP_ENV ":mustUnderstand=\"1\">%S</mm7:TransactionID>\n",
|
||||
XMLNSMM7, p ? p : octstr_imm("none"));
|
||||
octstr_get_cstr(xmlns), p ? p : octstr_imm("none"));
|
||||
if (p)
|
||||
octstr_destroy(p);
|
||||
|
||||
|
@ -406,13 +408,15 @@ Octstr *headers_to_soapxml(List *hdrs)
|
|||
mtype = http_header_value(hdrs, octstr_imm("MessageType"));
|
||||
mtag = mms_string_to_mm7tag(mtype);
|
||||
|
||||
octstr_format_append(s, "<mm7:%S xmlns:mm7=\"%s\">\n", mtype, XMLNSMM7);
|
||||
octstr_format_append(s, "<mm7:%S xmlns:mm7=\"%s\">\n", mtype, octstr_get_cstr(xmlns));
|
||||
|
||||
/* Output the details. */
|
||||
p = http_header_value(hdrs, octstr_imm("MM7Version"));
|
||||
octstr_format_append(s, "<mm7:MM7Version>%S</mm7:MM7Version>\n", p);
|
||||
octstr_destroy(p);
|
||||
|
||||
if ((p = http_header_value(hdrs, octstr_imm("MM7Version"))) != NULL) {
|
||||
octstr_format_append(s, "<mm7:MM7Version>%S</mm7:MM7Version>\n", p);
|
||||
octstr_destroy(p);
|
||||
} else
|
||||
octstr_format_append(s, "<mm7:MM7Version>%d.%d.%d</mm7:MM7Version>\n", ver->major, ver->minor1, ver->minor2);
|
||||
|
||||
p = http_header_value(hdrs, octstr_imm("VASPID"));
|
||||
q = http_header_value(hdrs, octstr_imm("VASID"));
|
||||
r = http_header_value(hdrs, octstr_imm("SenderAddress"));
|
||||
|
@ -452,8 +456,8 @@ Octstr *headers_to_soapxml(List *hdrs)
|
|||
octstr_format_append(s, "<mm7:Recipient>\n%S</mm7:Recipient>\n", p);
|
||||
octstr_destroy(q);
|
||||
}
|
||||
octstr_destroy(p);
|
||||
|
||||
octstr_destroy(p);
|
||||
octstr_destroy(xmlns);
|
||||
|
||||
/* cycle through rest of headers. */
|
||||
|
||||
|
@ -573,7 +577,7 @@ Octstr *headers_to_soapxml(List *hdrs)
|
|||
return s;
|
||||
}
|
||||
|
||||
int mm7_soapmsg_to_httpmsg(MSoapMsg_t *m, List **hdrs, Octstr **body)
|
||||
int mm7_soapmsg_to_httpmsg(MSoapMsg_t *m, MM7Version_t *ver, List **hdrs, Octstr **body)
|
||||
{
|
||||
MIMEEntity *mime;
|
||||
Octstr *ctype, *s;
|
||||
|
@ -613,7 +617,7 @@ int mm7_soapmsg_to_httpmsg(MSoapMsg_t *m, List **hdrs, Octstr **body)
|
|||
mime_replace_headers(xml, hx);
|
||||
http_destroy_headers(hx);
|
||||
|
||||
s = headers_to_soapxml(hh);
|
||||
s = headers_to_soapxml(hh,ver);
|
||||
mime_entity_set_body(xml, s);
|
||||
octstr_destroy(s);
|
||||
|
||||
|
@ -633,7 +637,7 @@ int mm7_soapmsg_to_httpmsg(MSoapMsg_t *m, List **hdrs, Octstr **body)
|
|||
mime_entity_destroy(c);
|
||||
} else {
|
||||
ctype = octstr_imm("text/xml");
|
||||
s = headers_to_soapxml(m->envelope);
|
||||
s = headers_to_soapxml(m->envelope, ver);
|
||||
mime_entity_set_body(mime,s);
|
||||
octstr_destroy(s);
|
||||
}
|
||||
|
@ -888,7 +892,7 @@ static MSoapMsg_t *mm7_soap_create(int msgtype, Octstr *otransid)
|
|||
m->msg = NULL;
|
||||
|
||||
http_header_add(m->envelope, "MessageType", (char *)mms_mm7tag_to_cstr(msgtype));
|
||||
http_header_add(m->envelope, "MM7Version", MM7_DEFAULT_VERSION);
|
||||
/* http_header_add(m->envelope, "MM7Version", MM7_DEFAULT_VERSION); */
|
||||
http_header_add(m->envelope, "TransactionID",
|
||||
otransid ? octstr_get_cstr(otransid) : "0000");
|
||||
return m;
|
||||
|
|
|
@ -23,11 +23,15 @@
|
|||
|
||||
typedef struct MSoapMsg_t MSoapMsg_t;
|
||||
|
||||
typedef struct MM7Version_t {
|
||||
int major, minor1, minor2; /* e.g. 5.1.0. */
|
||||
} MM7Version_t;
|
||||
|
||||
/* Parse SOAP message given http headers and body. */
|
||||
extern MSoapMsg_t *mm7_parse_soap(List *headers, Octstr *body);
|
||||
|
||||
/* Convert SOAP message to http headers and body. */
|
||||
extern int mm7_soapmsg_to_httpmsg(MSoapMsg_t *m, List **hdrs, Octstr **body);
|
||||
extern int mm7_soapmsg_to_httpmsg(MSoapMsg_t *m, MM7Version_t *ver, List **hdrs, Octstr **body);
|
||||
|
||||
/* Convert SOAP message to an MMS message. */
|
||||
extern MmsMsg *mm7_soap_to_mmsmsg(MSoapMsg_t *m, Octstr *from);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#define XIP_HEADER "X-WAP-Network-Client-IP"
|
||||
#define MM_NAME "Mbuni"
|
||||
|
||||
#define EAIF_VERSION "3.0"
|
||||
#define EAIF_VERSION "%d.%d"
|
||||
|
||||
/* used by mmbox and queue code -- directory stuff. */
|
||||
#define _TT "0123456789abcdefghijklmnopqrstuvwxyz"
|
||||
|
|
|
@ -240,7 +240,7 @@ static void mm7soap_receive(MmsHTTPClientInfo *h)
|
|||
|
||||
done:
|
||||
|
||||
if (mresp && mm7_soapmsg_to_httpmsg(mresp, &rh, &reply_body) == 0)
|
||||
if (mresp && mm7_soapmsg_to_httpmsg(mresp, &h->m->ver, &rh, &reply_body) == 0)
|
||||
http_send_reply(h->client, hstatus, rh, reply_body);
|
||||
else
|
||||
http_close_client(h->client);
|
||||
|
@ -292,7 +292,7 @@ static void mm7eaif_receive(MmsHTTPClientInfo *h)
|
|||
Octstr *subject = NULL, *otransid = NULL, *msgid = NULL;
|
||||
Octstr *hfrom = NULL;
|
||||
time_t expiryt = -1, deliveryt = -1;
|
||||
Octstr *qf = NULL;
|
||||
Octstr *qf = NULL, *xver;
|
||||
int msize = h->body ? octstr_len(h->body) : 0;
|
||||
int dlr;
|
||||
int mtype;
|
||||
|
@ -423,7 +423,10 @@ static void mm7eaif_receive(MmsHTTPClientInfo *h)
|
|||
}
|
||||
|
||||
done:
|
||||
http_header_add(rh, "X-NOKIA-MMSC-Version", EAIF_VERSION);
|
||||
|
||||
xver = octstr_format(EAIF_VERSION, h->m->ver.major, h->m->ver.minor1);
|
||||
http_header_add(rh, "X-NOKIA-MMSC-Version", octstr_get_cstr(xver));
|
||||
octstr_destroy(xver);
|
||||
|
||||
http_send_reply(h->client, hstatus, rh, octstr_imm(""));
|
||||
|
||||
|
@ -577,7 +580,7 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, Octstr *to,
|
|||
goto done1;
|
||||
}
|
||||
|
||||
if (mm7_soapmsg_to_httpmsg(mreq, &rh, &body) < 0) {
|
||||
if (mm7_soapmsg_to_httpmsg(mreq, &mmc->ver, &rh, &body) < 0) {
|
||||
*error = octstr_format("Failed to convert SOAP message to HTTP Msg!");
|
||||
goto done1;
|
||||
}
|
||||
|
@ -667,7 +670,7 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, Octstr *to,
|
|||
int mtype = mms_messagetype(m);
|
||||
int hstatus = HTTP_OK;
|
||||
List *rh = http_create_empty_headers(), *ph = NULL;
|
||||
Octstr *body = NULL, *rbody = NULL, *url = NULL;
|
||||
Octstr *body = NULL, *rbody = NULL, *url = NULL, *xver;
|
||||
char *msgtype;
|
||||
|
||||
|
||||
|
@ -679,7 +682,10 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, Octstr *to,
|
|||
http_header_remove_all(rh, "X-Mms-Allow-Adaptations");
|
||||
http_header_add(rh, "X-NOKIA-MMSC-To", octstr_get_cstr(to));
|
||||
http_header_add(rh, "X-NOKIA-MMSC-From", octstr_get_cstr(from));
|
||||
http_header_add(rh, "X-NOKIA-MMSC-Version", EAIF_VERSION);
|
||||
|
||||
xver = octstr_format(EAIF_VERSION, mmc->ver.major, mmc->ver.minor1);
|
||||
http_header_add(rh, "X-NOKIA-MMSC-Version", octstr_get_cstr(xver));
|
||||
octstr_destroy(xver);
|
||||
|
||||
if (mtype == MMS_MSGTYPE_SEND_REQ ||
|
||||
mtype == MMS_MSGTYPE_RETRIEVE_CONF) {
|
||||
|
|
|
@ -141,7 +141,8 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
|
|||
MmscGrp *m = gw_malloc(sizeof *m);
|
||||
int ssl = 0;
|
||||
Octstr *type;
|
||||
|
||||
Octstr *xver;
|
||||
|
||||
memset(m, 0, sizeof *m);
|
||||
|
||||
m->id = _mms_cfg_getx(x, octstr_imm("id"));
|
||||
|
@ -181,7 +182,23 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
|
|||
else
|
||||
warning(0, "MMSBox: Unknown MMSC type [%s]!",
|
||||
octstr_get_cstr(type));
|
||||
if ((xver = _mms_cfg_getx(x, octstr_imm("mm7-version"))) != NULL &&
|
||||
octstr_len(xver) > 0)
|
||||
sscanf(octstr_get_cstr(xver),
|
||||
"%d.%d.%d",
|
||||
&m->ver.major, &m->ver.minor1, &m->ver.minor2);
|
||||
else { /* Put in some defaults. */
|
||||
if (m->type == SOAP_MMSC) {
|
||||
m->ver.major = 5;
|
||||
m->ver.minor1 = 1;
|
||||
m->ver.minor2 = 2;
|
||||
} else if (m->type == EAIF_MMSC) {
|
||||
m->ver.major = 3;
|
||||
m->ver.minor1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
octstr_destroy(xver);
|
||||
octstr_destroy(type);
|
||||
|
||||
if (m->incoming.port > 0 &&
|
||||
|
|
|
@ -29,6 +29,8 @@ typedef struct MmscGrp {
|
|||
long throughput; /* Max send rate. */
|
||||
long threadid; /* handler thread. */
|
||||
|
||||
MM7Version_t ver; /* supported MM7/SOAP version. */
|
||||
|
||||
Mutex *mutex;
|
||||
} MmscGrp;
|
||||
|
||||
|
|
|
@ -313,6 +313,22 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
|
|||
else
|
||||
mv->type = NONE_VASP;
|
||||
octstr_destroy(s);
|
||||
|
||||
mv->ver.major = mv->ver.minor1 = mv->ver.minor2 = 0;
|
||||
if ((s = _mms_cfg_getx(grp, octstr_imm("mm7-version"))) != NULL &&
|
||||
octstr_len(s) > 0)
|
||||
sscanf(octstr_get_cstr(s), "%d.%d.%d", &mv->ver.major, &mv->ver.minor1, &mv->ver.minor2);
|
||||
else {
|
||||
if (mv->type == SOAP_VASP) {
|
||||
mv->ver.major = 5;
|
||||
mv->ver.minor1 = 1;
|
||||
mv->ver.minor2 = 2;
|
||||
} else if (mv->type == EAIF_VASP) {
|
||||
mv->ver.major = 3;
|
||||
mv->ver.minor1 = 0;
|
||||
}
|
||||
}
|
||||
octstr_destroy(s);
|
||||
|
||||
/* Set the handler vasp accounts. */
|
||||
if (mms_cfg_get_bool(grp, octstr_imm("mms-to-email-handler"), &ibool) == 0 &&
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef struct MmsVasp {
|
|||
enum {SOAP_VASP, EAIF_VASP, NONE_VASP} type;
|
||||
Octstr *vasp_username, *vasp_password;
|
||||
Octstr *vasp_url;
|
||||
MM7Version_t ver;
|
||||
} MmsVasp;
|
||||
|
||||
typedef struct MmscSettings {
|
||||
|
|
|
@ -554,7 +554,7 @@ static int mm7soap_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgId,
|
|||
goto done1;
|
||||
}
|
||||
|
||||
if (mm7_soapmsg_to_httpmsg(mreq, &rh, &body) < 0) {
|
||||
if (mm7_soapmsg_to_httpmsg(mreq, &vasp->ver, &rh, &body) < 0) {
|
||||
*error = octstr_format("Failed to convert SOAP message 2 HTTP Msg!");
|
||||
goto done1;
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ static int mm7eaif_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgid,
|
|||
int mtype = mms_messagetype(m);
|
||||
int hstatus = HTTP_OK;
|
||||
List *rh = http_create_empty_headers(), *ph = NULL;
|
||||
Octstr *body = NULL, *rbody = NULL, *url = NULL;
|
||||
Octstr *body = NULL, *rbody = NULL, *url = NULL, *xver;
|
||||
HTTPCaller *caller = http_caller_create();
|
||||
void *xx;
|
||||
char *msgtype;
|
||||
|
@ -645,8 +645,11 @@ static int mm7eaif_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgid,
|
|||
http_header_add(rh, "X-NOKIA-MMSC-From", octstr_get_cstr(from));
|
||||
if (msgid)
|
||||
http_header_add(rh, "X-NOKIA-MMSC-Message-Id", octstr_get_cstr(msgid));
|
||||
http_header_add(rh, "X-NOKIA-MMSC-Version", EAIF_VERSION);
|
||||
|
||||
|
||||
xver = octstr_format(EAIF_VERSION, vasp->ver.major, vasp->ver.minor1);
|
||||
http_header_add(rh, "X-NOKIA-MMSC-Version", octstr_get_cstr(xver));
|
||||
octstr_destroy(xver);
|
||||
|
||||
if (mtype == MMS_MSGTYPE_SEND_REQ ||
|
||||
mtype == MMS_MSGTYPE_RETRIEVE_CONF) {
|
||||
msgtype = "MultiMediaMessage";
|
||||
|
|
|
@ -1613,7 +1613,7 @@ static void mm7soap_dispatch(MmsHTTPClientInfo *h)
|
|||
switch (mm7_msgtype(mreq)) {
|
||||
case MM7_TAG_SubmitReq:
|
||||
mm7_get_envelope(mreq, &from, &to, &subject, &vasid, &expiryt, &delivert);
|
||||
m = mm7_soap_to_mmsmsg(mreq, from ? from : sender);
|
||||
m = mm7_soap_to_mmsmsg(mreq, from ? from : sender);
|
||||
if (m) {
|
||||
Octstr *value = NULL;
|
||||
int dlr;
|
||||
|
@ -1750,7 +1750,7 @@ static void mm7soap_dispatch(MmsHTTPClientInfo *h)
|
|||
done:
|
||||
|
||||
|
||||
if (mresp && mm7_soapmsg_to_httpmsg(mresp, &rh, &reply_body) == 0)
|
||||
if (mresp && mm7_soapmsg_to_httpmsg(mresp, &h->vasp->ver, &rh, &reply_body) == 0)
|
||||
http_send_reply(h->client, hstatus, rh, reply_body);
|
||||
else
|
||||
http_close_client(h->client);
|
||||
|
@ -1803,7 +1803,7 @@ static void mm7eaif_dispatch(MmsHTTPClientInfo *h)
|
|||
List *mh = NULL;
|
||||
int hstatus = HTTP_NO_CONTENT;
|
||||
List *rh = http_create_empty_headers();
|
||||
Octstr *reply_body = NULL, *value;
|
||||
Octstr *reply_body = NULL, *value, *xver;
|
||||
|
||||
List *to = gwlist_create(), *hto = NULL;
|
||||
Octstr *subject = NULL, *otransid = NULL, *msgid = NULL;
|
||||
|
@ -1906,7 +1906,10 @@ static void mm7eaif_dispatch(MmsHTTPClientInfo *h)
|
|||
hstatus = HTTP_INTERNAL_SERVER_ERROR;
|
||||
|
||||
done:
|
||||
http_header_add(rh, "X-NOKIA-MMSC-Version", EAIF_VERSION);
|
||||
xver = octstr_format(EAIF_VERSION, h->vasp->ver.major, h->vasp->ver.minor1);
|
||||
http_header_add(rh, "X-NOKIA-MMSC-Version", octstr_get_cstr(xver));
|
||||
octstr_destroy(xver);
|
||||
|
||||
if (msgid)
|
||||
http_header_add(rh, "X-NOKIA-MMSC-Message-Id", octstr_get_cstr(msgid));
|
||||
|
||||
|
|
Loading…
Reference in New Issue