91 dcs = (dcs & 0x03) | 0xC0;
93 dcs = (dcs & 0x03) | 0x08;
115 dcs |= (0x10 |
msg->sms.mclass);
117 dcs |= (
msg->sms.coding << 2);
124 dcs |= (
msg->sms.coding << 2);
128 dcs |=
msg->sms.mclass;
142 if ((dcs & 0xF0) == 0xF0) {
145 (*msg)->sms.mclass = dcs & 0x03;
146 (*msg)->sms.alt_dcs = 1;
150 else if ((dcs & 0xC0) == 0x00) {
151 (*msg)->sms.alt_dcs = 0;
152 (*msg)->sms.compress = ((dcs & 0x20) == 0x20) ? 1 : 0;
153 (*msg)->sms.mclass = ((dcs & 0x10) == 0x10) ? dcs & 0x03 :
MC_UNDEF;
155 (*msg)->sms.coding = (dcs & 0x0C) >> 2;
159 else if ((dcs & 0xC0) == 0xC0) {
160 (*msg)->sms.alt_dcs = 0;
165 (*msg)->sms.mwi = dcs ;
186 if (!
msg || !
msg->sms.msgdata)
205 if (
msg->sms.sender != NULL &&
msg->sms.receiver != NULL) {
206 sender =
msg->sms.sender;
207 msg->sms.sender =
msg->sms.receiver;
208 msg->sms.receiver = sender;
221 #define CATENATE_UDH_LEN 5 227 if (sms->sms.udhdata == NULL)
238 sms->sms.msg_left = 0;
254 if (max_part_len <
octstr_len(msgdata) && split_chars != NULL)
255 for (i = max_part_len; i > 0; i--)
270 Octstr *temp = NULL, *temp_utf;
311 int catenate,
unsigned long msg_sequence,
314 long max_part_len, udh_len, hf_len, nlsuf_len;
315 unsigned long total_messages, msgno;
326 max_part_len = max_octets - udh_len - hf_len;
328 max_part_len = (max_octets - udh_len) * 8 / 7 - hf_len;
336 max_part_len = max_octets - udh_len - hf_len;
338 max_part_len = (max_octets - udh_len) * 8 / 7 - hf_len;
342 max_part_len = max_part_len > 0 ? max_part_len : 0;
359 part->sms.dlr_url = NULL;
360 part->sms.dlr_mask = 0;
368 max_part_len - nlsuf_len);
377 if (!last && nonlast_suffix)
382 total_messages = msgno;
384 if (catenate && total_messages > 1) {
385 for (msgno = 1; msgno <= total_messages; msgno++) {
402 if (msg1->sms.priority > msg2->sms.priority)
404 else if (msg1->sms.priority < msg2->sms.priority)
407 if (msg1->sms.time > msg2->sms.time)
409 else if (msg1->sms.time < msg2->sms.time)
435 error(0,
"Failed to convert msgdata from charset <%s> to <%s>, will leave as is.",
444 error(0,
"Failed to convert msgdata from charset <%s> to <%s>, will leave as is.",
void error(int err, const char *fmt,...)
Msg * msg_duplicate(Msg *msg)
gw_assert(wtls_machine->packet_to_send !=NULL)
void gwlist_append(List *list, void *item)
void octstr_append(Octstr *ostr1, const Octstr *ostr2)
void * gwlist_get(List *list, long pos)
void octstr_append_char(Octstr *ostr, int ch)
int sms_msgdata_len(Msg *msg)
void charset_utf8_to_gsm(Octstr *ostr)
void uuid_generate(uuid_t out)
static Octstr * extract_msgdata_part(Octstr *msgdata, Octstr *split_chars, int max_part_len)
#define octstr_get_cstr(ostr)
#define octstr_copy(ostr, from, len)
List * sms_split(Msg *orig, Octstr *header, Octstr *footer, Octstr *nonlast_suffix, Octstr *split_chars, int catenate, unsigned long msg_sequence, int max_messages, int max_octets)
long octstr_search_char(const Octstr *ostr, int ch, long pos)
static Octstr * extract_msgdata_part_by_coding(Msg *msg, Octstr *split_chars, int max_part_len)
int sms_priority_compare(const void *a, const void *b)
void octstr_insert(Octstr *ostr1, const Octstr *ostr2, long pos)
void octstr_delete(Octstr *ostr1, long pos, long len)
#define octstr_duplicate(ostr)
void msg_destroy(Msg *msg)
void octstr_destroy(Octstr *ostr)
int sms_charset_processing(Octstr *charset, Octstr *body, int coding)
#define octstr_create(cstr)
int fields_to_dcs(Msg *msg, int mode)
#define SMS_PARAM_UNDEFINED
long octstr_len(const Octstr *ostr)
void octstr_format_append(Octstr *os, const char *fmt,...)
int dcs_to_fields(Msg **msg, int dcs)
void prepend_catenation_udh(Msg *sms, int part_no, int num_messages, int msg_sequence)
int octstr_get_char(const Octstr *ostr, long pos)
#define DLR_IS_ENABLED(dlr)
void octstr_set_char(Octstr *ostr, long pos, int ch)
static XMLRPCDocument * msg
int charset_gsm_truncate(Octstr *gsm, long max)
int charset_convert(Octstr *string, char *charset_from, char *charset_to)
void charset_gsm_to_utf8(Octstr *ostr)