catenate the ff fe prefix in UTF-16 encoded octstr and swapping bytes in words (if it tnecessary)

Yury Mikhienko <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Mobicom-Kavkaz
Message-ID <[email protected]>
Hi developers!

I use kannel as SMSGW on the SPARC (with SunOS) platform and I was oblige to implement the following futures in some functions :))

in gwlib/octstr.c 

void octstr_swap_bytes(Octstr *ostr)
{
 unsigned char ch = 0;
 long pos;
 
 seems_valid(ostr);
 
 for(pos = 0;pos < ostr->len - 1;pos += 2)
 {
  ch = ostr->data[pos];
  ostr->data[pos] = ostr->data[pos + 1];
  ostr->data[pos + 1] = ch;
 }
}

in gwlib/octstr.h

void octstr_swap_bytes(Octstr *ostr);

in gw/smsc/smsc_smpp.c (in msg_to_pdu function)

.... 
   /*
     * only re-encoding if using default smsc charset that is defined via
     * alt-charset in smsc group and if MT is not binary
     */

...
    if (msg->sms.coding == DC_UCS2) {
        /*
         * remove the first two bytes FE FF from octetstring (add from yuryx for SMSCv3.2)
         * 
         */
         Octstr *octstr_tmp = NULL;
         short UTF_16_PREFIX = 0xfeff;
         
         #if (defined (__sparc__) || defined (__sparc) || defined (__sun)) 
              octstr_swap_bytes(pdu->u.submit_sm.short_message);
         #endif

         octstr_tmp = octstr_create("");
         octstr_append_data(octstr_tmp, (char*) &UTF_16_PREFIX, 2);
         if(octstr_ncompare(pdu->u.submit_sm.short_message, octstr_tmp, 2) == 0) {
            octstr_delete(pdu->u.submit_sm.short_message, 0, 2);
         }
         octstr_destroy(octstr_tmp);
    }

    /* prepend udh if present */
...


What are mean about the add that code in next CVS commit?


-- 
 
Best regards,
Yury Mikhienko.
IT ERP group head, ZAO "Mobicom-Kavkaz"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.