libosmogsm 1.13.1.1-afb4 Osmocom GSM library

gsm_04_11.h
Go to the documentation of this file.
1
3#pragma once
4
5#include <stdint.h>
6
7/* GSM TS 04.11 definitions */
8
9/* Chapter 5.2.3: SMC-CS states at the user/network side */
10 enum gsm411_cp_state {
11 GSM411_CPS_IDLE = 0,
12 GSM411_CPS_MM_CONN_PENDING = 1, /* only MT ! */
13 GSM411_CPS_WAIT_CP_ACK = 2,
14 GSM411_CPS_MM_ESTABLISHED = 3,
15};
16
17/* Chapter 6.2.2: SMR states at the user/network side */
18 enum gsm411_rp_state {
19 GSM411_RPS_IDLE = 0,
20 GSM411_RPS_WAIT_FOR_RP_ACK = 1,
21 GSM411_RPS_WAIT_TO_TX_RP_ACK = 3,
22 GSM411_RPS_WAIT_FOR_RETRANS_T = 4,
23};
24
25/* Chapter 8.1.2 (refers to GSM 04.07 Chapter 11.2.3.1.1 */
26#define GSM411_PDISC_SMS 0x09
27
28/* Chapter 8.1.3 */
29#define GSM411_MT_CP_DATA 0x01
30#define GSM411_MT_CP_ACK 0x04
31#define GSM411_MT_CP_ERROR 0x10
32
33 enum gsm411_cp_ie {
34 GSM411_CP_IE_USER_DATA = 0x01, /* 8.1.4.1 */
35 GSM411_CP_IE_CAUSE = 0x02, /* 8.1.4.2. */
36};
37
38/* Section 8.1.4.2 / Table 8.2 */
39 enum gsm411_cp_cause {
40 GSM411_CP_CAUSE_NET_FAIL = 17,
41 GSM411_CP_CAUSE_CONGESTION = 22,
42 GSM411_CP_CAUSE_INV_TRANS_ID = 81,
43 GSM411_CP_CAUSE_SEMANT_INC_MSG = 95,
44 GSM411_CP_CAUSE_INV_MAND_INF = 96,
45 GSM411_CP_CAUSE_MSGTYPE_NOTEXIST= 97,
46 GSM411_CP_CAUSE_MSG_INCOMP_STATE= 98,
47 GSM411_CP_CAUSE_IE_NOTEXIST = 99,
48 GSM411_CP_CAUSE_PROTOCOL_ERR = 111,
49};
50
51/* Chapter 8.2.2 */
52#define GSM411_MT_RP_DATA_MO 0x00
53#define GSM411_MT_RP_DATA_MT 0x01
54#define GSM411_MT_RP_ACK_MO 0x02
55#define GSM411_MT_RP_ACK_MT 0x03
56#define GSM411_MT_RP_ERROR_MO 0x04
57#define GSM411_MT_RP_ERROR_MT 0x05
58#define GSM411_MT_RP_SMMA_MO 0x06
59
60 enum gsm411_rp_ie {
61 GSM411_IE_RP_USER_DATA = 0x41, /* 8.2.5.3 */
62 GSM411_IE_RP_CAUSE = 0x42, /* 8.2.5.4 */
63};
64
65/* Sections 8.2.5.1 and 8.2.5.2 set limits on the length of an SMSC-address.
66 * The spec states these limits in terms of min and max values of the length
67 * octet in type 4 IEs SM-RP-OA and SM-RP-DA; these IE length limits translate
68 * into a minimum of 1 digit and a maximum of 20 digits.
69 */
70#define GSM411_SMSC_ADDR_MIN_OCTETS 2
71#define GSM411_SMSC_ADDR_MAX_OCTETS 11
72#define GSM411_SMSC_ADDR_MIN_DIGITS 1
73#define GSM411_SMSC_ADDR_MAX_DIGITS 20
74
75/* Chapter 8.2.5.4 Table 8.4 */
76 enum gsm411_rp_cause {
77 /* valid only for MO */
78 GSM411_RP_CAUSE_MO_NUM_UNASSIGNED = 1,
79 GSM411_RP_CAUSE_MO_OP_DET_BARR = 8,
80 GSM411_RP_CAUSE_MO_CALL_BARRED = 10,
81 GSM411_RP_CAUSE_MO_SMS_REJECTED = 21,
82 GSM411_RP_CAUSE_MO_DEST_OUT_OF_ORDER = 27,
83 GSM411_RP_CAUSE_MO_UNIDENTIFIED_SUBSCR = 28,
84 GSM411_RP_CAUSE_MO_FACILITY_REJ = 29,
85 GSM411_RP_CAUSE_MO_UNKNOWN_SUBSCR = 30,
86 GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER = 38,
87 GSM411_RP_CAUSE_MO_TEMP_FAIL = 41,
88 GSM411_RP_CAUSE_MO_CONGESTION = 42,
89 GSM411_RP_CAUSE_MO_RES_UNAVAIL = 47,
90 GSM411_RP_CAUSE_MO_REQ_FAC_NOTSUBSCR = 50,
91 GSM411_RP_CAUSE_MO_REQ_FAC_NOTIMPL = 69,
92 GSM411_RP_CAUSE_MO_INTERWORKING = 127,
93 /* valid only for MT */
94 GSM411_RP_CAUSE_MT_MEM_EXCEEDED = 22,
95 /* valid for both directions */
96 GSM411_RP_CAUSE_INV_TRANS_REF = 81,
97 GSM411_RP_CAUSE_SEMANT_INC_MSG = 95,
98 GSM411_RP_CAUSE_INV_MAND_INF = 96,
99 GSM411_RP_CAUSE_MSGTYPE_NOTEXIST = 97,
100 GSM411_RP_CAUSE_MSG_INCOMP_STATE = 98,
101 GSM411_RP_CAUSE_IE_NOTEXIST = 99,
102 GSM411_RP_CAUSE_PROTOCOL_ERR = 111,
103};
104
105/* Chapter 10: Timers */
106#define GSM411_TMR_TR1M 40, 0 /* 35 < x < 45 seconds */
107#define GSM411_TMR_TRAM 30, 0 /* 25 < x < 35 seconds */
108#define GSM411_TMR_TR2M 15, 0 /* 12 < x < 20 seconds */
109
110#define GSM411_TMR_TC1A 30, 0 /* TR1M - 10 */
111#define GSM411_TMR_TC1A_SEC 30 /* TR1M - 10 */
112
113/* Chapter 8.2.1 */
114 struct gsm411_rp_hdr {
115 uint8_t len;
116 uint8_t msg_type;
117 uint8_t msg_ref;
118 uint8_t data[0];
119} __attribute__ ((packed));
120
121/* our own enum, not related to on-air protocol */
122 enum sms_alphabet {
123 DCS_NONE,
124 DCS_7BIT_DEFAULT,
125 DCS_UCS2,
126 DCS_8BIT_DATA,
127};
128
129/* GSM 03.40 / Chapter 9.2.3.1: TP-Message-Type-Indicator */
130#define GSM340_SMS_DELIVER_SC2MS 0x00
131#define GSM340_SMS_DELIVER_REP_MS2SC 0x00
132#define GSM340_SMS_STATUS_REP_SC2MS 0x02
133#define GSM340_SMS_COMMAND_MS2SC 0x02
134#define GSM340_SMS_SUBMIT_MS2SC 0x01
135#define GSM340_SMS_SUBMIT_REP_SC2MS 0x01
136#define GSM340_SMS_RESERVED 0x03
137
138/* GSM 03.40 / Chapter 9.2.3.2: TP-More-Messages-to-Send */
139#define GSM340_TP_MMS_MORE 0
140#define GSM340_TP_MMS_NO_MORE 1
141
142/* GSM 03.40 / Chapter 9.2.3.3: TP-Validity-Period-Format */
143#define GSM340_TP_VPF_NONE 0
144#define GSM340_TP_VPF_RELATIVE 2
145#define GSM340_TP_VPF_ENHANCED 1
146#define GSM340_TP_VPF_ABSOLUTE 3
147
148/* GSM 03.40 / Chapter 9.2.3.4: TP-Status-Report-Indication */
149#define GSM340_TP_SRI_NONE 0
150#define GSM340_TP_SRI_PRESENT 1
151
152/* GSM 03.40 / Chapter 9.2.3.5: TP-Status-Report-Request */
153#define GSM340_TP_SRR_NONE 0
154#define GSM340_TP_SRR_REQUESTED 1
155
156/* GSM 03.40 / Chapter 9.2.3.9: TP-Protocol-Identifier */
157/* telematic interworking (001 or 111 in bits 7-5) */
158#define GSM340_TP_PID_IMPLICIT 0x00
159#define GSM340_TP_PID_TELEX 0x01
160#define GSM340_TP_PID_FAX_G3 0x02
161#define GSM340_TP_PID_FAX_G4 0x03
162#define GSM340_TP_PID_VOICE 0x04
163#define GSM430_TP_PID_ERMES 0x05
164#define GSM430_TP_PID_NATIONAL_PAGING 0x06
165#define GSM430_TP_PID_VIDEOTEX 0x07
166#define GSM430_TP_PID_TELETEX_UNSPEC 0x08
167#define GSM430_TP_PID_TELETEX_PSPDN 0x09
168#define GSM430_TP_PID_TELETEX_CSPDN 0x0a
169#define GSM430_TP_PID_TELETEX_PSTN 0x0b
170#define GSM430_TP_PID_TELETEX_ISDN 0x0c
171#define GSM430_TP_PID_TELETEX_UCI 0x0d
172#define GSM430_TP_PID_MSG_HANDLING 0x10
173#define GSM430_TP_PID_MSG_X400 0x11
174#define GSM430_TP_PID_EMAIL 0x12
175#define GSM430_TP_PID_GSM_MS 0x1f
176/* if bit 7 = 0 and bit 6 = 1 */
177#define GSM430_TP_PID_SMS_TYPE_0 0
178#define GSM430_TP_PID_SMS_TYPE_1 1
179#define GSM430_TP_PID_SMS_TYPE_2 2
180#define GSM430_TP_PID_SMS_TYPE_3 3
181#define GSM430_TP_PID_SMS_TYPE_4 4
182#define GSM430_TP_PID_SMS_TYPE_5 5
183#define GSM430_TP_PID_SMS_TYPE_6 6
184#define GSM430_TP_PID_SMS_TYPE_7 7
185#define GSM430_TP_PID_RETURN_CALL_MSG 0x1f
186#define GSM430_TP_PID_ME_DATA_DNLOAD 0x3d
187#define GSM430_TP_PID_ME_DE_PERSONAL 0x3e
188#define GSM430_TP_PID_ME_SIM_DNLOAD 0x3f
189
190/* GSM 03.38 Chapter 4: SMS Data Coding Scheme */
191#define GSM338_DCS_00_
192
193#define GSM338_DCS_1110_7BIT (0 << 2)
194#define GSM338_DCS_1111_7BIT (0 << 2)
195#define GSM338_DCS_1111_8BIT_DATA (1 << 2)
196#define GSM338_DCS_1111_CLASS0 0
197#define GSM338_DCS_1111_CLASS1_ME 1
198#define GSM338_DCS_1111_CLASS2_SIM 2
199#define GSM338_DCS_1111_CLASS3_TE 3 /* See TS 07.05 */
gsm411_cp_ie
gsm411_cp_ie
Definition: gsm_04_11.h:33
GSM411_CP_IE_USER_DATA
@ GSM411_CP_IE_USER_DATA
Definition: gsm_04_11.h:34
GSM411_CP_IE_CAUSE
@ GSM411_CP_IE_CAUSE
Definition: gsm_04_11.h:35
gsm411_cp_cause
gsm411_cp_cause
Definition: gsm_04_11.h:39
GSM411_CP_CAUSE_MSG_INCOMP_STATE
@ GSM411_CP_CAUSE_MSG_INCOMP_STATE
Definition: gsm_04_11.h:46
GSM411_CP_CAUSE_NET_FAIL
@ GSM411_CP_CAUSE_NET_FAIL
Definition: gsm_04_11.h:40
GSM411_CP_CAUSE_CONGESTION
@ GSM411_CP_CAUSE_CONGESTION
Definition: gsm_04_11.h:41
GSM411_CP_CAUSE_INV_TRANS_ID
@ GSM411_CP_CAUSE_INV_TRANS_ID
Definition: gsm_04_11.h:42
GSM411_CP_CAUSE_PROTOCOL_ERR
@ GSM411_CP_CAUSE_PROTOCOL_ERR
Definition: gsm_04_11.h:48
GSM411_CP_CAUSE_MSGTYPE_NOTEXIST
@ GSM411_CP_CAUSE_MSGTYPE_NOTEXIST
Definition: gsm_04_11.h:45
GSM411_CP_CAUSE_IE_NOTEXIST
@ GSM411_CP_CAUSE_IE_NOTEXIST
Definition: gsm_04_11.h:47
GSM411_CP_CAUSE_SEMANT_INC_MSG
@ GSM411_CP_CAUSE_SEMANT_INC_MSG
Definition: gsm_04_11.h:43
GSM411_CP_CAUSE_INV_MAND_INF
@ GSM411_CP_CAUSE_INV_MAND_INF
Definition: gsm_04_11.h:44
gsm411_cp_state
gsm411_cp_state
Definition: gsm_04_11.h:10
GSM411_CPS_MM_ESTABLISHED
@ GSM411_CPS_MM_ESTABLISHED
Definition: gsm_04_11.h:14
GSM411_CPS_WAIT_CP_ACK
@ GSM411_CPS_WAIT_CP_ACK
Definition: gsm_04_11.h:13
GSM411_CPS_IDLE
@ GSM411_CPS_IDLE
Definition: gsm_04_11.h:11
GSM411_CPS_MM_CONN_PENDING
@ GSM411_CPS_MM_CONN_PENDING
Definition: gsm_04_11.h:12
gsm411_rp_cause
gsm411_rp_cause
Definition: gsm_04_11.h:76
GSM411_RP_CAUSE_MO_REQ_FAC_NOTIMPL
@ GSM411_RP_CAUSE_MO_REQ_FAC_NOTIMPL
Definition: gsm_04_11.h:91
GSM411_RP_CAUSE_MSGTYPE_NOTEXIST
@ GSM411_RP_CAUSE_MSGTYPE_NOTEXIST
Definition: gsm_04_11.h:99
GSM411_RP_CAUSE_MO_OP_DET_BARR
@ GSM411_RP_CAUSE_MO_OP_DET_BARR
Definition: gsm_04_11.h:79
GSM411_RP_CAUSE_MO_INTERWORKING
@ GSM411_RP_CAUSE_MO_INTERWORKING
Definition: gsm_04_11.h:92
GSM411_RP_CAUSE_MO_FACILITY_REJ
@ GSM411_RP_CAUSE_MO_FACILITY_REJ
Definition: gsm_04_11.h:84
GSM411_RP_CAUSE_INV_MAND_INF
@ GSM411_RP_CAUSE_INV_MAND_INF
Definition: gsm_04_11.h:98
GSM411_RP_CAUSE_MO_UNKNOWN_SUBSCR
@ GSM411_RP_CAUSE_MO_UNKNOWN_SUBSCR
Definition: gsm_04_11.h:85
GSM411_RP_CAUSE_MO_CALL_BARRED
@ GSM411_RP_CAUSE_MO_CALL_BARRED
Definition: gsm_04_11.h:80
GSM411_RP_CAUSE_MO_TEMP_FAIL
@ GSM411_RP_CAUSE_MO_TEMP_FAIL
Definition: gsm_04_11.h:87
GSM411_RP_CAUSE_MT_MEM_EXCEEDED
@ GSM411_RP_CAUSE_MT_MEM_EXCEEDED
Definition: gsm_04_11.h:94
GSM411_RP_CAUSE_INV_TRANS_REF
@ GSM411_RP_CAUSE_INV_TRANS_REF
Definition: gsm_04_11.h:96
GSM411_RP_CAUSE_MO_RES_UNAVAIL
@ GSM411_RP_CAUSE_MO_RES_UNAVAIL
Definition: gsm_04_11.h:89
GSM411_RP_CAUSE_SEMANT_INC_MSG
@ GSM411_RP_CAUSE_SEMANT_INC_MSG
Definition: gsm_04_11.h:97
GSM411_RP_CAUSE_MO_SMS_REJECTED
@ GSM411_RP_CAUSE_MO_SMS_REJECTED
Definition: gsm_04_11.h:81
GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER
@ GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER
Definition: gsm_04_11.h:86
GSM411_RP_CAUSE_MO_NUM_UNASSIGNED
@ GSM411_RP_CAUSE_MO_NUM_UNASSIGNED
Definition: gsm_04_11.h:78
GSM411_RP_CAUSE_IE_NOTEXIST
@ GSM411_RP_CAUSE_IE_NOTEXIST
Definition: gsm_04_11.h:101
GSM411_RP_CAUSE_MO_CONGESTION
@ GSM411_RP_CAUSE_MO_CONGESTION
Definition: gsm_04_11.h:88
GSM411_RP_CAUSE_MO_DEST_OUT_OF_ORDER
@ GSM411_RP_CAUSE_MO_DEST_OUT_OF_ORDER
Definition: gsm_04_11.h:82
GSM411_RP_CAUSE_MO_UNIDENTIFIED_SUBSCR
@ GSM411_RP_CAUSE_MO_UNIDENTIFIED_SUBSCR
Definition: gsm_04_11.h:83
GSM411_RP_CAUSE_MSG_INCOMP_STATE
@ GSM411_RP_CAUSE_MSG_INCOMP_STATE
Definition: gsm_04_11.h:100
GSM411_RP_CAUSE_MO_REQ_FAC_NOTSUBSCR
@ GSM411_RP_CAUSE_MO_REQ_FAC_NOTSUBSCR
Definition: gsm_04_11.h:90
GSM411_RP_CAUSE_PROTOCOL_ERR
@ GSM411_RP_CAUSE_PROTOCOL_ERR
Definition: gsm_04_11.h:102
gsm411_rp_ie
gsm411_rp_ie
Definition: gsm_04_11.h:60
GSM411_IE_RP_CAUSE
@ GSM411_IE_RP_CAUSE
Definition: gsm_04_11.h:62
GSM411_IE_RP_USER_DATA
@ GSM411_IE_RP_USER_DATA
Definition: gsm_04_11.h:61
gsm411_rp_state
gsm411_rp_state
Definition: gsm_04_11.h:18
GSM411_RPS_WAIT_TO_TX_RP_ACK
@ GSM411_RPS_WAIT_TO_TX_RP_ACK
Definition: gsm_04_11.h:21
GSM411_RPS_WAIT_FOR_RETRANS_T
@ GSM411_RPS_WAIT_FOR_RETRANS_T
Definition: gsm_04_11.h:22
GSM411_RPS_IDLE
@ GSM411_RPS_IDLE
Definition: gsm_04_11.h:19
GSM411_RPS_WAIT_FOR_RP_ACK
@ GSM411_RPS_WAIT_FOR_RP_ACK
Definition: gsm_04_11.h:20
__attribute__
enum sms_alphabet __attribute__
sms_alphabet
sms_alphabet
Definition: gsm_04_11.h:122
DCS_UCS2
@ DCS_UCS2
Definition: gsm_04_11.h:125
DCS_7BIT_DEFAULT
@ DCS_7BIT_DEFAULT
Definition: gsm_04_11.h:124
DCS_8BIT_DATA
@ DCS_8BIT_DATA
Definition: gsm_04_11.h:126
DCS_NONE
@ DCS_NONE
Definition: gsm_04_11.h:123
gsm411_rp_hdr
Definition: gsm_04_11.h:114
gsm411_rp_hdr::msg_type
uint8_t msg_type
Definition: gsm_04_11.h:116
gsm411_rp_hdr::len
uint8_t len
Definition: gsm_04_11.h:115
gsm411_rp_hdr::data
uint8_t data[0]
Definition: gsm_04_11.h:118
gsm411_rp_hdr::msg_ref
uint8_t msg_ref
Definition: gsm_04_11.h:117