libosmogsm  0.9.6-11.20170220git32ee5af8.fc31
Osmocom GSM library
gsm_03_41.h
1 #pragma once
2 
3 #include <stdint.h>
4 
5 #include <osmocom/core/endian.h>
6 #include <osmocom/gsm/protocol/gsm_04_12.h>
7 
8 #ifndef OSMO_IS_LITTLE_ENDIAN
9  #define OSMO_IS_LITTLE_ENDIAN 0
10 #endif
11 
12 /* GSM TS 03.41 definitions also TS 23.041*/
13 
14 #define GSM341_MAX_PAYLOAD (GSM412_MSG_LEN-sizeof(struct gsm341_ms_message))
15 #define GSM341_MAX_CHARS (GSM341_MAX_PAYLOAD*8/7)
16 #define GSM341_7BIT_PADDING '\r'
17 
18 /* Chapter 9.3.2 */
20  struct {
21 #if OSMO_IS_LITTLE_ENDIAN == 1
22  uint8_t code_hi:6;
23  uint8_t gs:2;
24  uint8_t update:4;
25  uint8_t code_lo:4;
26 #else
27  uint8_t gs:2;
28  uint8_t code_hi:6;
29  uint8_t code_lo:4;
30  uint8_t update:4;
31 #endif
32  } serial;
33  uint16_t msg_id;
34  struct {
35 #if OSMO_IS_LITTLE_ENDIAN == 1
36  uint8_t language:4;
37  uint8_t group:4;
38 #else
39  uint8_t group:4;
40  uint8_t language:4;
41 #endif
42  } dcs;
43  struct {
44 #if OSMO_IS_LITTLE_ENDIAN == 1
45  uint8_t total:4;
46  uint8_t current:4;
47 #else
48  uint8_t current:4;
49  uint8_t total:4;
50 #endif
51  } page;
52  uint8_t data[0];
53 } __attribute__((packed));
54 
55 /* Chapter 9.4.1.3 */
57  struct {
58 #if OSMO_IS_LITTLE_ENDIAN == 1
59  uint8_t code_hi:4;
60  uint8_t popup:1;
61  uint8_t alert:1;
62  uint8_t gs:2;
63  uint8_t update:4;
64  uint8_t code_lo:4;
65 #else
66  uint8_t gs:2;
67  uint8_t alert:1;
68  uint8_t popup:1;
69  uint8_t code_hi:4;
70  uint8_t code_lo:4;
71  uint8_t update:4;
72 #endif
73  } serial;
74  uint16_t msg_id;
75  uint16_t warning_type;
76  uint8_t data[0];
77 } __attribute__((packed));
78 
79 #define GSM341_MSG_CODE(ms) ((ms)->serial.code_lo | ((ms)->serial.code_hi << 4))
80 
81 /* Section 9.3.2.1 - Geographical Scope */
82 #define GSM341_GS_CELL_WIDE_IMMED 0
83 #define GSM341_GS_PLMN_WIDE 1
84 #define GSM341_GS_LA_WIDE 2
85 #define GSM341_GS_CELL_WIDE 3
86 
87 /* Section 9.4.1.2.2 */
88 #define GSM341_MSGID_EOTD_ASSISTANCE 0x03E8
89 #define GSM341_MSGID_DGPS_CORRECTION 0x03E9
90 #define GSM341_MSGID_DGPS_EPH_CLOCK_COR 0x03EA
91 #define GSM341_MSGID_GPS_ALMANAC_OTHER 0x03EB
92 #define GSM341_MSGID_ETWS_EARTHQUAKE 0x1100
93 #define GSM341_MSGID_ETWS_TSUNAMI 0x1101
94 #define GSM341_MSGID_ETWS_QUAKE_AND_TSUNAMI 0x1102
95 #define GSM341_MSGID_ETWS_TEST 0x1103
96 #define GSM341_MSGID_ETWS_OTHER 0x1104
97 #define GSM341_MSGID_ETWS_CMAS_PRESIDENTIAL 0x1112
98 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_OBSERVED 0x1113
99 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_LIKELY 0x1114
100 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_OBSERVED 0x1115
101 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_LIKELY 0x1116
102 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_OBSERVED 0x1117
103 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_LIKELY 0x1118
104 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_OBSERVED 0x1119
105 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_LIKELY 0x111A
106 #define GSM341_MSGID_ETWS_CMAS_AMBER 0x111B
107 #define GSM341_MSGID_ETWS_CMAS_MONTHLY_TEST 0x111C
108 #define GSM341_MSGID_ETWS_CMAS_EXERCISE 0x111D
109 #define GSM341_MSGID_ETWS_CMAS_OPERATOR_DEFINED 0x111E
110 #define GSM341_MSGID_ETWS_CMAS_PRESIDENTIAL_AL 0x111F
111 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_OBSERVED_AL 0x1120
112 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_LIKELY_AL 0x1121
113 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_OBSERVED_AL 0x1122
114 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_LIKELY_AL 0x1123
115 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_OBSERVED_AL 0x1124
116 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_LIKELY_AL 0x1125
117 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_OBSERVED_AL 0x1126
118 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_LIKELY_AL 0x1127
119 #define GSM341_MSGID_ETWS_CMAS_AMBER_AL 0x1128
120 #define GSM341_MSGID_ETWS_CMAS_MONTHLY_TEST_AL 0x1129
121 #define GSM341_MSGID_ETWS_CMAS_EXERCISE_AL 0x112A
122 #define GSM341_MSGID_ETWS_CMAS_OPERATOR_DEFINED_AL 0x112B
123 #define GSM341_MSGID_ETWS_EU_INFO_LOCAL_LANGUAGE 0x1900
Definition: gsm_03_41.h:56
Definition: gsm_03_41.h:19