libosmogsm  0.10.2.279.178b
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 
56 #define OSMO_GSUP_PDP_TYPE_SIZE 2
57 
77  /* 3G support */
84 };
85 
91 
95 
97 
101 
105 
109 
113 };
114 
115 #define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00)
116 #define OSMO_GSUP_IS_MSGT_ERROR(msgt) (((msgt) & 0b00000011) == 0b01)
117 #define OSMO_GSUP_TO_MSGT_ERROR(msgt) (((msgt) & 0b11111100) | 0b01)
118 
119 extern const struct value_string osmo_gsup_message_type_names[];
120 static inline const char *
123 
125  OSMO_GSUP_CANCEL_TYPE_UPDATE = 1, /* on wire: 0 */
126  OSMO_GSUP_CANCEL_TYPE_WITHDRAW = 2, /* on wire: 1 */
127 };
128 
132 };
133 
136  unsigned int context_id;
139  uint16_t pdp_type;
142  const uint8_t *apn_enc;
144  size_t apn_enc_len;
147  const uint8_t *qos_enc;
149  size_t qos_enc_len;
152  const uint8_t *pdp_charg_enc;
155 };
156 
159  enum osmo_gsup_message_type message_type;
162  enum osmo_gsup_cancel_type cancel_type;
169  const uint8_t *msisdn_enc;
171  const uint8_t *hlr_enc;
172  size_t hlr_enc_len;
173  const uint8_t *auts;
174  const uint8_t *rand;
175  enum osmo_gsup_cn_domain cn_domain;
176  const uint8_t *pdp_charg_enc;
178 };
179 
180 int osmo_gsup_decode(const uint8_t *data, size_t data_len,
181  struct osmo_gsup_message *gsup_msg);
182 int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg);
183 
osmo_gsup_cancel_type
Definition: gsup.h:124
const uint8_t * auts
Definition: gsup.h:173
Definition: gsup.h:104
Definition: gsup.h:76
Definition: gsup.h:125
Definition: gsup.h:131
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:61
Definition: gsup.h:68
Definition: gsup.h:60
size_t num_pdp_infos
Definition: gsup.h:168
#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:139
Definition: gsup.h:74
const uint8_t * pdp_charg_enc
Definition: gsup.h:176
int freeze_ptmsi
Definition: gsup.h:164
Definition: gsup.h:62
int have_info
Definition: gsup.h:137
int pdp_info_compl
Definition: gsup.h:163
Definition: gsup.h:81
const uint8_t * msisdn_enc
Definition: gsup.h:169
size_t hlr_enc_len
Definition: gsup.h:172
uint8_t cause
Definition: gsm_04_08.h:504
unsigned int context_id
Definition: gsup.h:136
osmo_gsup_message_type
GSUP message type.
Definition: gsup.h:87
Definition: gsup.h:98
Definition: gsup.h:83
Definition: gsup.h:96
static const char * osmo_gsup_message_type_name(enum osmo_gsup_message_type val)
Definition: gsup.h:121
Definition: gsup.h:75
Definition: gsup.h:70
osmo_gsup_iei
Information Element Identifiers for GSUP IEs.
Definition: gsup.h:59
Definition: gsup.h:108
const uint8_t * hlr_enc
Definition: gsup.h:171
size_t msisdn_enc_len
Definition: gsup.h:170
Definition: gsup.h:126
Definition: gsup.h:67
size_t qos_enc_len
length (in octets) of qos_enc
Definition: gsup.h:149
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:219
Definition: gsup.h:69
Definition: gsup.h:66
#define OSMO_GSUP_MAX_NUM_PDP_INFO
Maximum nubmer of PDP inside osmo_gsup_message.
Definition: gsup.h:50
Definition: gsup.h:73
parsed/decoded PDP context information
Definition: gsup.h:135
Definition: gsup.h:65
size_t pdp_charg_enc_len
Definition: gsup.h:177
gsm48_gmm_cause
Definition: gsm_04_08_gprs.h:175
Definition: gsup.h:63
Definition: gsup.h:107
Definition: gsup.h:99
parsed/decoded GSUP protocol message
Definition: gsup.h:158
const uint8_t * apn_enc
APN information, still in encoded form.
Definition: gsup.h:142
size_t pdp_charg_enc_len
length (in octets) of pdp_charg_enc
Definition: gsup.h:154
Definition: gsup.h:79
Definition: gsup.h:130
Definition: gsup.h:64
const uint8_t * pdp_charg_enc
PDP Charging Characteristics, still in encoded form.
Definition: gsup.h:152
const uint8_t * rand
Definition: gsup.h:174
Definition: gsup.h:82
Definition: gsup.h:78
int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
Encode a GSUP message.
Definition: gsup.c:480
Definition: gsup.h:103
const uint8_t * qos_enc
QoS information, still in encoded form.
Definition: gsup.h:147
Definition: gsup.h:80
Definition: gsup.h:72
Definition: gsup.h:71
Definition: gsup.h:100
size_t apn_enc_len
length (in octets) of apn_enc
Definition: gsup.h:144
Definition: auth.h:60
uint8_t data[0]
message payload data
Definition: gsm_03_41.h:109
osmo_gsup_cn_domain
Definition: gsup.h:129
size_t num_auth_vectors
Definition: gsup.h:166