SMPP optional parameter packing/unpacking
KRUCHIO Gabor <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have found, that SMPP optional parameters packing/unpacking
does not work under Solaris.
Versions:
- kannel 1.3.1
- compiler: Sun's Forte Developer 7 C 5.4
- OS: SunOS 5.8
- CPU: UltraSPARC-IIe
Problem:
in smpp_pdu_pack() / smpp_pdu_unpack() / smpp_pdu_dump()
the helper variables to handle optional parameter tag and
length should be allocated as short instead of long to
get parsing / formating work.
Here is the diff of the corrected smpp_pdu.c:
diff -c /kannel/gateway/gw/smsc/smpp_pdu.c
/kannel/gateway/gw/smsc/my_smpp_pdu.c
*** /kannel/gateway/gw/smsc/smpp_pdu.c Wed Jul 16 18:14:45 2003
--- /kannel/gateway/gw/smsc/my_smpp_pdu.c Fri Aug 29 19:12:44 2003
***************
*** 148,154 ****
Octstr *opt_tag = octstr_create_from_data((char*)
&tag_id_buffer, 2); \
Octstr *opt_val = dict_get(p->optional_parameters, opt_tag);
\
if (opt_val != NULL) {
\
! long opt_len = octstr_len(opt_val);
\
debug("smpp_pdu", 0, "Packing optional parameter "
\
"(tag = %d, val = %s, len = %ld)",
\
tag_id, octstr_get_cstr(opt_val), opt_len);
\
--- 148,154 ----
Octstr *opt_tag = octstr_create_from_data((char*)
&tag_id_buffer, 2); \
Octstr *opt_val = dict_get(p->optional_parameters, opt_tag);
\
if (opt_val != NULL) {
\
! /*long*/ short opt_len = octstr_len(opt_val);
\
debug("smpp_pdu", 0, "Packing optional parameter "
\
"(tag = %d, val = %s, len = %ld)",
\
tag_id, octstr_get_cstr(opt_val), opt_len);
\
***************
*** 219,225 ****
#define OPTIONAL_BEGIN(num_expected)
\
{ /* Read optional parameters */
\
while (pos+4 <= len) {
\
! unsigned long opt_tag, opt_len;
\
Octstr *opt_val = NULL;
\
Octstr *tag_str = NULL;
\
opt_tag = decode_integer(data_without_len, pos, 2); pos +=
2; \
--- 219,225 ----
#define OPTIONAL_BEGIN(num_expected)
\
{ /* Read optional parameters */
\
while (pos+4 <= len) {
\
! /*unsigned long*/ short opt_tag, opt_len;
\
Octstr *opt_val = NULL;
\
Octstr *tag_str = NULL;
\
opt_tag = decode_integer(data_without_len, pos, 2); pos +=
2; \
***************
*** 284,290 ****
#define OPTIONAL_BEGIN(num_expected) \
if (p->optional_parameters != NULL) { \
Octstr *key = NULL, *tag_val = NULL;
! unsigned long id;
#define TLV(tag_id, min_len, max_len) \
id = tag_id; \
key = octstr_create_from_data((char*)&id, 2); \
--- 284,290 ----
#define OPTIONAL_BEGIN(num_expected) \
if (p->optional_parameters != NULL) { \
Octstr *key = NULL, *tag_val = NULL;
! /*unsigned long*/ short id;
#define TLV(tag_id, min_len, max_len) \
id = tag_id; \
key = octstr_create_from_data((char*)&id, 2); \
Any comment?
Ciao
Gabor