libosmogsm  0.12.0.47-7c74
Osmocom GSM library
gsup.h
Go to the documentation of this file.
1 
18 /*
19  * (C) 2014 by sysmocom - s.f.m.c. GmbH, Author: Jacob Erlbeck
20  * (C) 2016 by Harald Welte <laforge@gnumonks.org>
21  * All Rights Reserved
22  *
23  * SPDX-License-Identifier: GPL-2.0+
24  *
25  * This program is free software; you can redistribute it and/or modify
26  * it under the terms of the GNU General Public License as published by
27  * the Free Software Foundation; either version 2 of the License, or
28  * (at your option) any later version.
29  *
30  * This program is distributed in the hope that it will be useful,
31  * but WITHOUT ANY WARRANTY; without even the implied warranty of
32  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33  * GNU General Public License for more details.
34  *
35  * You should have received a copy of the GNU General Public License
36  * along with this program. If not, see <http://www.gnu.org/licenses/>.
37  *
38  */
39 #pragma once
40 
41 #include <stdint.h>
42 #include <osmocom/core/msgb.h>
45 #include <osmocom/crypt/auth.h>
46 
47 #define OSMO_GSUP_PORT 4222
48 
50 #define OSMO_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */
51 
52 #define OSMO_GSUP_MAX_NUM_AUTH_INFO 5
53 
54 #define OSMO_GSUP_MAX_MSISDN_LEN 9
55 #define OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN 43 /* TS 24.008 10.5.4.7 */
56 
57 #define OSMO_GSUP_PDP_TYPE_SIZE 2
58 
78  /* 3G support */
85 
88 
91 };
92 
98 
102 
104 
108 
112 
116 
120 
124 };
125 
126 #define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00)
127 #define OSMO_GSUP_IS_MSGT_ERROR(msgt) (((msgt) & 0b00000011) == 0b01)
128 #define OSMO_GSUP_TO_MSGT_ERROR(msgt) (((msgt) & 0b11111100) | 0b01)
129 
130 extern const struct value_string osmo_gsup_message_type_names[];
131 static inline const char *
134 
136  OSMO_GSUP_CANCEL_TYPE_UPDATE = 1, /* on wire: 0 */
137  OSMO_GSUP_CANCEL_TYPE_WITHDRAW = 2, /* on wire: 1 */
138 };
139 
143 };
144 
155 };
156 
157 extern const struct value_string osmo_gsup_session_state_names[];
158 static inline const char *
161 
164  unsigned int context_id;
167  uint16_t pdp_type;
170  const uint8_t *apn_enc;
172  size_t apn_enc_len;
175  const uint8_t *qos_enc;
177  size_t qos_enc_len;
180  const uint8_t *pdp_charg_enc;
183 };
184 
187  enum osmo_gsup_message_type message_type;
190  enum osmo_gsup_cancel_type cancel_type;
197  const uint8_t *msisdn_enc;
199  const uint8_t *hlr_enc;
200  size_t hlr_enc_len;
201  const uint8_t *auts;
202  const uint8_t *rand;
203  enum osmo_gsup_cn_domain cn_domain;
204  const uint8_t *pdp_charg_enc;
206 
208  enum osmo_gsup_session_state session_state;
211  uint32_t session_id;
212 
214  uint8_t *ss_info;
215  size_t ss_info_len;
216 };
217 
218 int osmo_gsup_decode(const uint8_t *data, size_t data_len,
219  struct osmo_gsup_message *gsup_msg);
220 int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg);
222 
osmo_gsup_cancel_type
Definition: gsup.h:135
const uint8_t * auts
Definition: gsup.h:201
Definition: gsup.h:111
Definition: gsup.h:77
Definition: gsup.h:136
Indication of the session end.
Definition: gsup.h:154
Definition: gsup.h:142
const struct value_string osmo_gsup_message_type_names[]
Definition: gsup.c:39
const char * get_value_string(const struct value_string *vs, uint32_t val)
#define GSM23003_IMSI_MAX_DIGITS
Definition: gsm_23_003.h:6
Definition: gsup.h:62
Definition: gsup.h:69
Definition: gsup.h:61
size_t num_pdp_infos
Definition: gsup.h:196
#define OSMO_GSUP_MAX_NUM_AUTH_INFO
Maximum number of auth info inside osmo_gsup_message.
Definition: gsup.h:52
uint16_t pdp_type
Type of PDP context.
Definition: gsup.h:167
Definition: gsup.h:75
const uint8_t * pdp_charg_enc
Definition: gsup.h:204
int freeze_ptmsi
Definition: gsup.h:192
Definition: gsup.h:63
Definition: gsup.h:87
int have_info
Definition: gsup.h:165
int pdp_info_compl
Definition: gsup.h:191
Definition: gsup.h:82
const uint8_t * msisdn_enc
Definition: gsup.h:197
size_t hlr_enc_len
Definition: gsup.h:200
Initiation of a new session.
Definition: gsup.h:150
size_t ss_info_len
Definition: gsup.h:215
uint8_t cause
Definition: gsm_04_08.h:559
unsigned int context_id
Definition: gsup.h:164
osmo_gsup_session_state
TCAP-like session state.
Definition: gsup.h:146
osmo_gsup_message_type
GSUP message type.
Definition: gsup.h:94
Definition: gsup.h:105
Definition: gsup.h:84
Definition: gsup.h:103
static const char * osmo_gsup_message_type_name(enum osmo_gsup_message_type val)
Definition: gsup.h:132
Definition: gsup.h:76
Definition: gsup.h:71
osmo_gsup_iei
Information Element Identifiers for GSUP IEs.
Definition: gsup.h:60
Definition: gsup.h:115
const uint8_t * hlr_enc
Definition: gsup.h:199
Definition: gsup.h:121
Definition: gsup.h:86
uint8_t * ss_info
ASN.1 encoded MAP payload for Supplementary Services.
Definition: gsup.h:214
size_t msisdn_enc_len
Definition: gsup.h:198
Definition: gsup.h:137
Definition: gsup.h:68
size_t qos_enc_len
length (in octets) of qos_enc
Definition: gsup.h:177
int osmo_gsup_decode(const uint8_t *data, size_t data_len, struct osmo_gsup_message *gsup_msg)
Decode (parse) a GSUP message.
Definition: gsup.c:255
Definition: gsup.h:70
Definition: gsup.h:67
uint32_t session_id
Unique session identifier and origination flag.
Definition: gsup.h:211
Supplementary Services payload.
Definition: gsup.h:90
Definition: gsup.h:123
#define OSMO_GSUP_MAX_NUM_PDP_INFO
Maximum nubmer of PDP inside osmo_gsup_message.
Definition: gsup.h:50
Definition: gsup.h:74
parsed/decoded PDP context information
Definition: gsup.h:163
Definition: gsup.h:66
size_t pdp_charg_enc_len
Definition: gsup.h:205
gsm48_gmm_cause
Definition: gsm_04_08_gprs.h:175
Definition: gsup.h:64
const struct value_string osmo_gsup_session_state_names[]
Definition: gsup.c:73
Definition: gsup.h:114
static const char * osmo_gsup_session_state_name(enum osmo_gsup_session_state val)
Definition: gsup.h:159
Definition: gsup.h:106
parsed/decoded GSUP protocol message
Definition: gsup.h:186
const uint8_t * apn_enc
APN information, still in encoded form.
Definition: gsup.h:170
size_t pdp_charg_enc_len
length (in octets) of pdp_charg_enc
Definition: gsup.h:182
Definition: gsup.h:80
Definition: gsup.h:141
Definition: gsup.h:65
const uint8_t * pdp_charg_enc
PDP Charging Characteristics, still in encoded form.
Definition: gsup.h:180
const uint8_t * rand
Definition: gsup.h:202
Definition: gsup.h:122
Definition: gsup.h:83
Definition: gsup.h:79
int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
Encode a GSUP message.
Definition: gsup.c:529
Definition: gsup.h:110
const uint8_t * qos_enc
QoS information, still in encoded form.
Definition: gsup.h:175
Definition: gsup.h:81
Definition: gsup.h:73
Definition: gsup.h:72
Undefined session state.
Definition: gsup.h:148
Definition: gsup.h:107
size_t apn_enc_len
length (in octets) of apn_enc
Definition: gsup.h:172
Communication of an existing session.
Definition: gsup.h:152
Definition: auth.h:60
uint8_t data[0]
message payload data
Definition: gsm_03_41.h:90
int osmo_gsup_get_err_msg_type(enum osmo_gsup_message_type type_in)
return the error message type corresponding to type_in
Definition: gsup.c:84
osmo_gsup_cn_domain
Definition: gsup.h:140
size_t num_auth_vectors
Definition: gsup.h:194