libosmogsm  0.9.6.311-c977
Osmocom GSM library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gsup.h
Go to the documentation of this file.
1 
3 /*
4  * (C) 2014 by sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck
5  * (C) 2016 by Harald Welte <laforge@gnumonks.org>
6  * All Rights Reserved
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 #pragma once
23 
24 #include <stdint.h>
25 #include <osmocom/core/msgb.h>
26 #include <osmocom/gsm/protocol/gsm_23_003.h>
27 #include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
28 #include <osmocom/crypt/auth.h>
29 
31 #define OSMO_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */
32 
33 #define OSMO_GSUP_MAX_NUM_AUTH_INFO 5
34 
35 #define OSMO_GSUP_MAX_MSISDN_LEN 9
36 
37 #define OSMO_GSUP_PDP_TYPE_SIZE 2
38 
57  /* 3G support */
64 };
65 
71 
75 
77 
81 
85 
89 
93 };
94 
95 #define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00)
96 #define OSMO_GSUP_IS_MSGT_ERROR(msgt) (((msgt) & 0b00000011) == 0b01)
97 #define OSMO_GSUP_TO_MSGT_ERROR(msgt) (((msgt) & 0b11111100) | 0b01)
98 
99 extern const struct value_string osmo_gsup_message_type_names[];
100 static inline const char *
102 { return get_value_string(osmo_gsup_message_type_names, val); }
103 
105  OSMO_GSUP_CANCEL_TYPE_UPDATE = 1, /* on wire: 0 */
106  OSMO_GSUP_CANCEL_TYPE_WITHDRAW = 2, /* on wire: 1 */
107 };
108 
112 };
113 
116  unsigned int context_id;
119  uint16_t pdp_type;
122  const uint8_t *apn_enc;
124  size_t apn_enc_len;
127  const uint8_t *qos_enc;
129  size_t qos_enc_len;
130 };
131 
135  char imsi[GSM23003_IMSI_MAX_DIGITS+2];
136  enum gsm48_gmm_cause cause;
140  struct osmo_auth_vector auth_vectors[OSMO_GSUP_MAX_NUM_AUTH_INFO];
144  const uint8_t *msisdn_enc;
146  const uint8_t *hlr_enc;
147  size_t hlr_enc_len;
148  const uint8_t *auts;
149  const uint8_t *rand;
151 };
152 
153 int osmo_gsup_decode(const uint8_t *data, size_t data_len,
154  struct osmo_gsup_message *gsup_msg);
155 void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg);
Definition: gsup.h:46
const uint8_t * auts
Definition: gsup.h:148
static const char * osmo_gsup_message_type_name(enum osmo_gsup_message_type val)
Definition: gsup.h:101
Definition: gsup.h:55
void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
Encode a GSUP message.
Definition: gsup.c:464
const struct value_string osmo_gsup_message_type_names[]
Definition: gsup.c:39
size_t num_pdp_infos
Definition: gsup.h:143
Definition: gsup.h:47
uint16_t pdp_type
Type of PDP context.
Definition: gsup.h:119
struct osmo_gsup_pdp_info pdp_infos[OSMO_GSUP_MAX_NUM_PDP_INFO]
Definition: gsup.h:142
int freeze_ptmsi
Definition: gsup.h:139
Definition: gsup.h:60
Definition: gsup.h:105
int have_info
Definition: gsup.h:117
enum gsm48_gmm_cause cause
Definition: gsup.h:136
int pdp_info_compl
Definition: gsup.h:138
#define OSMO_GSUP_MAX_NUM_AUTH_INFO
Maximum number of auth info inside osmo_gsup_message.
Definition: gsup.h:33
const uint8_t * msisdn_enc
Definition: gsup.h:144
size_t hlr_enc_len
Definition: gsup.h:147
osmo_gsup_cn_domain
Definition: gsup.h:109
char imsi[GSM23003_IMSI_MAX_DIGITS+2]
Definition: gsup.h:135
Definition: gsup.h:59
Definition: gsup.h:78
unsigned int context_id
Definition: gsup.h:116
Definition: gsup.h:41
Definition: gsup.h:79
const uint8_t * hlr_enc
Definition: gsup.h:146
size_t msisdn_enc_len
Definition: gsup.h:145
Definition: gsup.h:48
Definition: gsup.h:76
size_t qos_enc_len
length (in octets) of qos_enc
Definition: gsup.h:129
struct osmo_auth_vector auth_vectors[OSMO_GSUP_MAX_NUM_AUTH_INFO]
Definition: gsup.h:140
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:214
Definition: gsup.h:62
Definition: gsup.h:52
Definition: gsup.h:63
enum osmo_gsup_cn_domain cn_domain
Definition: gsup.h:150
Definition: gsup.h:56
Definition: gsup.h:49
parsed/decoded PDP context information
Definition: gsup.h:115
Definition: gsup.h:111
Definition: gsup.h:61
Definition: gsup.h:54
Definition: gsup.h:106
Definition: gsup.h:53
Definition: gsup.h:110
parsed/decoded GSUP protocol message
Definition: gsup.h:133
#define OSMO_GSUP_MAX_NUM_PDP_INFO
Maximum nubmer of PDP inside osmo_gsup_message.
Definition: gsup.h:31
const uint8_t * apn_enc
APN information, still in encoded form.
Definition: gsup.h:122
Definition: gsup.h:50
Definition: gsup.h:43
const uint8_t * rand
Definition: gsup.h:149
Definition: gsup.h:42
Definition: gsup.h:80
enum osmo_gsup_cancel_type cancel_type
Definition: gsup.h:137
osmo_gsup_iei
Information Element Identifiers for GSUP IEs.
Definition: gsup.h:40
Definition: gsup.h:45
const uint8_t * qos_enc
QoS information, still in encoded form.
Definition: gsup.h:127
Definition: gsup.h:51
size_t apn_enc_len
length (in octets) of apn_enc
Definition: gsup.h:124
Definition: gsup.h:44
Definition: gsup.h:58
enum osmo_gsup_message_type message_type
Definition: gsup.h:134
osmo_gsup_message_type
GSUP message type.
Definition: gsup.h:67
osmo_gsup_cancel_type
Definition: gsup.h:104
size_t num_auth_vectors
Definition: gsup.h:141