FreeCalypso > hg > freecalypso-tools
comparison uptools/libcoding/sms_submit8.c @ 375:759cb6dc501b
uptools/libcoding: added function for generating SMS PDUs with 8-bit text
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 08 Mar 2018 22:24:14 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 374:d1fa771abeb8 | 375:759cb6dc501b |
|---|---|
| 1 /* | |
| 2 * This library module implements the function for constructing outgoing | |
| 3 * SMS-SUBMIT PDUs, 8-bit version for raw data or UCS-2. | |
| 4 */ | |
| 5 | |
| 6 #include <sys/types.h> | |
| 7 #include <strings.h> | |
| 8 | |
| 9 make_sms_submit_pdu_8bit(da, pid, dcs, textsrc, textlen, udh, udhl, outbuf) | |
| 10 u_char *da, *textsrc, *udh, *outbuf; | |
| 11 unsigned textlen, udhl; | |
| 12 { | |
| 13 u_char *outp = outbuf; | |
| 14 unsigned addr_field_len; | |
| 15 unsigned udh_octets; | |
| 16 unsigned udl; | |
| 17 | |
| 18 if (udh) | |
| 19 *outp++ = 0x41; | |
| 20 else | |
| 21 *outp++ = 0x01; | |
| 22 *outp++ = 0; | |
| 23 addr_field_len = ((da[0] + 1) >> 1) + 2; | |
| 24 bcopy(da, outp, addr_field_len); | |
| 25 outp += addr_field_len; | |
| 26 *outp++ = pid; | |
| 27 *outp++ = dcs; | |
| 28 if (udh) | |
| 29 udh_octets = udhl + 1; | |
| 30 else | |
| 31 udh_octets = 0; | |
| 32 udl = udh_octets + textlen; | |
| 33 *outp++ = udl; | |
| 34 if (udh) { | |
| 35 *outp++ = udhl; | |
| 36 bcopy(udh, outp, udhl); | |
| 37 outp += udhl; | |
| 38 } | |
| 39 bcopy(textsrc, outp, textlen); | |
| 40 outp += textlen; | |
| 41 return (outp - outbuf); | |
| 42 } |
