annotate uptools/libcoding/sms_submit8.c @ 429:05dc91d011a6

doc/RVTMUX: updated for the current state of FreeCalypso
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 03 Nov 2018 05:51:17 +0000
parents 759cb6dc501b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
375
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This library module implements the function for constructing outgoing
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * SMS-SUBMIT PDUs, 8-bit version for raw data or UCS-2.
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <strings.h>
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 make_sms_submit_pdu_8bit(da, pid, dcs, textsrc, textlen, udh, udhl, outbuf)
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 u_char *da, *textsrc, *udh, *outbuf;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 unsigned textlen, udhl;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 {
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 u_char *outp = outbuf;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 unsigned addr_field_len;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 unsigned udh_octets;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 unsigned udl;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 if (udh)
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 *outp++ = 0x41;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 else
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 *outp++ = 0x01;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 *outp++ = 0;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 addr_field_len = ((da[0] + 1) >> 1) + 2;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 bcopy(da, outp, addr_field_len);
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 outp += addr_field_len;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 *outp++ = pid;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 *outp++ = dcs;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 if (udh)
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 udh_octets = udhl + 1;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 else
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 udh_octets = 0;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 udl = udh_octets + textlen;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 *outp++ = udl;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 if (udh) {
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 *outp++ = udhl;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 bcopy(udh, outp, udhl);
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 outp += udhl;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 }
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 bcopy(textsrc, outp, textlen);
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 outp += textlen;
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 return (outp - outbuf);
759cb6dc501b uptools/libcoding: added function for generating SMS PDUs with 8-bit text
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 }