libosmogsm  0.10.2
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  * This program is free software; you can redistribute it and/or modify
24  * it under the terms of the GNU General Public License as published by
25  * the Free Software Foundation; either version 2 of the License, or
26  * (at your option) any later version.
27  *
28  * This program is distributed in the hope that it will be useful,
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31  * GNU General Public License for more details.
32  *
33  * You should have received a copy of the GNU General Public License
34  * along with this program. If not, see <http://www.gnu.org/licenses/>.
35  *
36  */
37 #pragma once
38 
39 #include <stdint.h>
40 #include <osmocom/core/msgb.h>
43 #include <osmocom/crypt/auth.h>
44 
45 #define OSMO_GSUP_PORT 4222
46 
48 #define OSMO_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */
49 
50 #define OSMO_GSUP_MAX_NUM_AUTH_INFO 5
51 
52 #define OSMO_GSUP_MAX_MSISDN_LEN 9
53 
54 #define OSMO_GSUP_PDP_TYPE_SIZE 2
55 
75  /* 3G support */
82 };
83 
89 
93 
95 
99 
103 
107 
111 };
112 
113 #define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00)
114 #define OSMO_GSUP_IS_MSGT_ERROR(msgt) (((msgt) & 0b00000011) == 0b01)
115 #define OSMO_GSUP_TO_MSGT_ERROR(msgt) (((msgt) & 0b11111100) | 0b01)
116 
117 extern const struct value_string osmo_gsup_message_type_names[];
118 static inline const char *
120 { return get_value_string(osmo_gsup_message_type_names, val); }
121 
123  OSMO_GSUP_CANCEL_TYPE_UPDATE = 1, /* on wire: 0 */
124  OSMO_GSUP_CANCEL_TYPE_WITHDRAW = 2, /* on wire: 1 */
125 };
126 
130 };
131 
134  unsigned int context_id;
137  uint16_t pdp_type;
140  const uint8_t *apn_enc;
142  size_t apn_enc_len;
145  const uint8_t *qos_enc;
147  size_t qos_enc_len;
150  const uint8_t *pdp_charg_enc;
153 };
154 
157  enum osmo_gsup_message_type message_type;
160  enum osmo_gsup_cancel_type cancel_type;
167  const uint8_t *msisdn_enc;
169  const uint8_t *hlr_enc;
170  size_t hlr_enc_len;
171  const uint8_t *auts;
172  const uint8_t *rand;
173  enum osmo_gsup_cn_domain cn_domain;
174  const uint8_t *pdp_charg_enc;
176 };
177 
178 int osmo_gsup_decode(const uint8_t *data, size_t data_len,
179  struct osmo_gsup_message *gsup_msg);
180 void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg);
181 
osmo_gsup_cancel_type
Definition: gsup.h:122
const uint8_t * auts
Definition: gsup.h:171
Definition: gsup.h:102
Definition: gsup.h:74
Definition: gsup.h:123
Definition: gsup.h:129
void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
Encode a GSUP message.
Definition: gsup.c:478
const struct value_string osmo_gsup_message_type_names[]
Definition: gsup.c:38
#define GSM23003_IMSI_MAX_DIGITS
Definition: gsm_23_003.h:6
Definition: gsup.h:59
Definition: gsup.h:66
Definition: gsup.h:58
size_t num_pdp_infos
Definition: gsup.h:166
#define OSMO_GSUP_MAX_NUM_AUTH_INFO
Maximum number of auth info inside osmo_gsup_message.
Definition: gsup.h:50
uint16_t pdp_type
Type of PDP context.
Definition: gsup.h:137
Definition: gsup.h:72
const uint8_t * pdp_charg_enc
Definition: gsup.h:174
int freeze_ptmsi
Definition: gsup.h:162
Definition: gsup.h:60
int have_info
Definition: gsup.h:135
int pdp_info_compl
Definition: gsup.h:161
Definition: gsup.h:79
const uint8_t * msisdn_enc
Definition: gsup.h:167
size_t hlr_enc_len
Definition: gsup.h:170
uint8_t cause
Definition: gsm_04_08.h:93
unsigned int context_id
Definition: gsup.h:134
osmo_gsup_message_type
GSUP message type.
Definition: gsup.h:85
Definition: gsup.h:96
Definition: gsup.h:81
Definition: gsup.h:94
static const char * osmo_gsup_message_type_name(enum osmo_gsup_message_type val)
Definition: gsup.h:119
Definition: gsup.h:73
Definition: gsup.h:68
osmo_gsup_iei
Information Element Identifiers for GSUP IEs.
Definition: gsup.h:57
Definition: gsup.h:106
const uint8_t * hlr_enc
Definition: gsup.h:169
size_t msisdn_enc_len
Definition: gsup.h:168
Definition: gsup.h:124
Definition: gsup.h:65
size_t qos_enc_len
length (in octets) of qos_enc
Definition: gsup.h:147
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:218
Definition: gsup.h:67
Definition: gsup.h:64
#define OSMO_GSUP_MAX_NUM_PDP_INFO
Maximum nubmer of PDP inside osmo_gsup_message.
Definition: gsup.h:48
Definition: gsup.h:71
parsed/decoded PDP context information
Definition: gsup.h:133
Definition: gsup.h:63
size_t pdp_charg_enc_len
Definition: gsup.h:175
gsm48_gmm_cause
Definition: gsm_04_08_gprs.h:175
Definition: gsup.h:61
Definition: gsup.h:105
Definition: gsup.h:97
parsed/decoded GSUP protocol message
Definition: gsup.h:156
const uint8_t * apn_enc
APN information, still in encoded form.
Definition: gsup.h:140
size_t pdp_charg_enc_len
length (in octets) of pdp_charg_enc
Definition: gsup.h:152
Definition: gsup.h:77
Definition: gsup.h:128
Definition: gsup.h:62
const uint8_t * pdp_charg_enc
PDP Charging Characteristics, still in encoded form.
Definition: gsup.h:150
const uint8_t * rand
Definition: gsup.h:172
Definition: gsup.h:80
Definition: gsup.h:76
Definition: gsup.h:101
const uint8_t * qos_enc
QoS information, still in encoded form.
Definition: gsup.h:145
Definition: gsup.h:78
Definition: gsup.h:70
Definition: gsup.h:69
Definition: gsup.h:98
size_t apn_enc_len
length (in octets) of apn_enc
Definition: gsup.h:142
Definition: auth.h:60
uint8_t data[0]
message payload data
Definition: gsm_03_41.h:108
osmo_gsup_cn_domain
Definition: gsup.h:127
size_t num_auth_vectors
Definition: gsup.h:164