Commit aa4e6946 authored by Slava Monich's avatar Slava Monich

[mms-lib] Handle more X-Mms-Response-Status values

Also, deal with unknown values according to the spec.
parent d08067e2
......@@ -811,20 +811,55 @@ static gboolean extract_rsp_status(struct wsp_header_iter *iter, void *user)
switch (p[0]) {
case MMS_MESSAGE_RSP_STATUS_OK:
case MMS_MESSAGE_RSP_STATUS_ERR_UNSPECIFIED:
case MMS_MESSAGE_RSP_STATUS_ERR_SERVICE_DENIED:
case MMS_MESSAGE_RSP_STATUS_ERR_MESSAGE_FORMAT_CORRUPT:
case MMS_MESSAGE_RSP_STATUS_ERR_SENDING_ADDRESS_UNRESOLVED:
case MMS_MESSAGE_RSP_STATUS_ERR_MESSAGE_NOT_FOUND:
case MMS_MESSAGE_RSP_STATUS_ERR_NETWORK_PROBLEM:
case MMS_MESSAGE_RSP_STATUS_ERR_CONTENT_NOT_ACCEPTED:
case MMS_MESSAGE_RSP_STATUS_ERR_UNSUPPORTED_MESSAGE:
case MMS_MESSAGE_RSP_STATUS_ERR_TRANS_FAILURE:
case MMS_MESSAGE_RSP_STATUS_ERR_TRANS_SENDING_ADDRESS_UNRESOLVED:
case MMS_MESSAGE_RSP_STATUS_ERR_TRANS_MESSAGE_NOT_FOUND:
case MMS_MESSAGE_RSP_STATUS_ERR_TRANS_NETWORK_PROBLEM:
case MMS_MESSAGE_RSP_STATUS_ERR_TRANS_PARTIAL_SUCCESS:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_FAILURE:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_SERVICE_DENIED:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_MESSAGE_FORMAT_CORRUPT:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_SENDING_ADDRESS_UNRESOLVED:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_MESSAGE_NOT_FOUND:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_CONTENT_NOT_ACCEPTED:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_REPLY_CHARGING_LIMIT_NOT_MET:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_REPLY_CHARGING_REQ_NOT_ACCEPT:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_REPLY_CHARGING_FORWARD_DENIED:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_REPLY_CHARGING_NOT_SUPPORTED:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_ADDRESS_HIDING_NOT_SUPPORTED:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_LACK_OF_PREPAID:
*out = p[0];
return TRUE;
break;
default:
/*
* 7.2.27. X-Mms-Response-Status field
*
* The values 196 through 223 are reserved for future use to
* indicate other transient failures. An MMS Client MUST react
* the same to a value in range 196 to 223 as it does to the
* value 192 (Error-transient-failure).
*
* The values 234 through 255 are reserved for future use to
* indicate other permanent failures. An MMS Client MUST react
* the same to a value in range 234 to 255 as it does to the
* value 224 (Error-permanent-failure).
*/
if (p[0] >= MMS_MESSAGE_RSP_STATUS_ERR_PERM_FAILURE)
*out = MMS_MESSAGE_RSP_STATUS_ERR_PERM_FAILURE;
else if (p[0] >= MMS_MESSAGE_RSP_STATUS_ERR_TRANS_FAILURE)
*out = MMS_MESSAGE_RSP_STATUS_ERR_TRANS_FAILURE;
break;
}
return FALSE;
return TRUE;
}
static gboolean extract_status(struct wsp_header_iter *iter, void *user)
......
......@@ -33,14 +33,30 @@ enum mms_message_type {
enum mms_message_rsp_status {
MMS_MESSAGE_RSP_STATUS_OK = 128,
MMS_MESSAGE_RSP_STATUS_ERR_UNSPECIFIED = 129,
MMS_MESSAGE_RSP_STATUS_ERR_SERVICE_DENIED = 130,
MMS_MESSAGE_RSP_STATUS_ERR_MESSAGE_FORMAT_CORRUPT = 131,
MMS_MESSAGE_RSP_STATUS_ERR_SENDING_ADDRESS_UNRESOLVED = 132,
MMS_MESSAGE_RSP_STATUS_ERR_MESSAGE_NOT_FOUND = 133,
MMS_MESSAGE_RSP_STATUS_ERR_NETWORK_PROBLEM = 134,
MMS_MESSAGE_RSP_STATUS_ERR_CONTENT_NOT_ACCEPTED = 135,
MMS_MESSAGE_RSP_STATUS_ERR_UNSUPPORTED_MESSAGE = 136,
MMS_MESSAGE_RSP_STATUS_ERR_TRANS_FAILURE = 192,
MMS_MESSAGE_RSP_STATUS_ERR_TRANS_SENDING_ADDRESS_UNRESOLVED = 193,
MMS_MESSAGE_RSP_STATUS_ERR_TRANS_MESSAGE_NOT_FOUND = 194,
MMS_MESSAGE_RSP_STATUS_ERR_TRANS_NETWORK_PROBLEM = 195,
MMS_MESSAGE_RSP_STATUS_ERR_TRANS_PARTIAL_SUCCESS = 196,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_FAILURE = 224,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_SERVICE_DENIED = 225,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_MESSAGE_FORMAT_CORRUPT = 226,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_SENDING_ADDRESS_UNRESOLVED = 227,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_MESSAGE_NOT_FOUND = 228,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_CONTENT_NOT_ACCEPTED = 229,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_REPLY_CHARGING_LIMIT_NOT_MET = 230,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_REPLY_CHARGING_REQ_NOT_ACCEPT = 231,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_REPLY_CHARGING_FORWARD_DENIED = 232,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_REPLY_CHARGING_NOT_SUPPORTED = 233,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_ADDRESS_HIDING_NOT_SUPPORTED = 234,
MMS_MESSAGE_RSP_STATUS_ERR_PERM_LACK_OF_PREPAID = 235,
};
......
......@@ -82,6 +82,9 @@ mms_task_send_done(
} else {
MMS_ERR("MMSC responded with %u", pdu->sc.rsp_status);
switch (pdu->sc.rsp_status) {
case MMS_MESSAGE_RSP_STATUS_ERR_SERVICE_DENIED:
case MMS_MESSAGE_RSP_STATUS_ERR_CONTENT_NOT_ACCEPTED:
case MMS_MESSAGE_RSP_STATUS_ERR_UNSUPPORTED_MESSAGE:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_SERVICE_DENIED:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_LACK_OF_PREPAID:
case MMS_MESSAGE_RSP_STATUS_ERR_PERM_CONTENT_NOT_ACCEPTED:
......
......@@ -71,7 +71,8 @@ int main(int argc, char* argv[])
"m-send_1.req",
"m-send_2.req",
"m-send_3.req",
"m-send.conf"
"m-send_1.conf",
"m-send_2.conf"
};
mms_log_set_type(MMS_LOG_TYPE_STDOUT, "test_mms_codec");
mms_log_stdout_timestamp = FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment