From 714b170f895dfdc2f0d725ab110baf3dc14ef874 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 7 Apr 2016 12:27:11 +0200 Subject: NAT: allow allocating BSC in arbitrary order Check for existing BSC before allocating new one. Track number of remaining BSCs on deallocation. Explicitly use BSC number in allocation function. --- openbsc/include/openbsc/bsc_nat.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 309adb1ba..c5fefe172 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -320,7 +320,8 @@ struct bsc_nat_ussd_con { }; /* create and init the structures */ -struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token); +struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token, + unsigned int number); struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num); struct bsc_config *bsc_config_by_token(struct bsc_nat *nat, const char *token, int len); void bsc_config_free(struct bsc_config *); -- cgit v1.2.3 From 82f5ecde6a10c3c22980822a892a3fb5c69acf4f Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 12 Apr 2016 16:59:25 +0200 Subject: NAT: move BSC config into separate file Introduce new configuration option bscs-config-file which includes BSC configuration from the given file. Both absolute and relative (to the main config file) paths are supported. Add 'show bscs-config' command to display current BSC configuration. Note: it is still possible to have BSC configuration in the main file (provided proper index number is used) and in runtime but BSC configuration is no longer saved automatically. The management of included configuration file is left to external tools. Update configuration examples. Fixes: OS#1669 Sponsored-by: On-Waves ehf --- openbsc/include/openbsc/bsc_nat.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index c5fefe172..5ccc02e18 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -264,6 +264,11 @@ struct bsc_nat { struct bsc_endpoint *bsc_endpoints; + /* path to file with BSC config */ + char *include_file; + char *include_base; + char *resolved_path; + /* filter */ char *acc_lst_name; -- cgit v1.2.3 From 4936448761a6ca42ab661d130f5202dfdabca426 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 13 Apr 2016 11:36:39 +0200 Subject: NAT: reload BSCs config dynamically Add vty tests for BSC configuration reloading. Load BSCs configuration on bscs-config-file command: * remove all runtime configured BSC not in the config file * close connections to all BSC with updated token value Fixes: OS#1670 Sponsored-by: On-Waves ehf --- openbsc/include/openbsc/bsc_nat.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 5ccc02e18..94ab0e5ff 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -35,6 +35,7 @@ #include #include +#include #define DIR_BSC 1 #define DIR_MSC 2 @@ -164,6 +165,10 @@ struct bsc_config { /* audio handling */ int max_endpoints; + /* used internally for reload handling */ + bool remove; + bool token_updated; + /* backpointer */ struct bsc_nat *nat; -- cgit v1.2.3 From f3f3505f493f63e9e79c72e407907783913b9c9c Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 15 Apr 2016 16:04:44 +0200 Subject: Add SI2quater support to SI3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Advertise SI2 quater presence and location (if available) using SI3 according to 3GPP TS 44.018 ยง 10.5.2.34 --- openbsc/include/openbsc/rest_octets.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/rest_octets.h b/openbsc/include/openbsc/rest_octets.h index 963b010c9..9560b14c5 100644 --- a/openbsc/include/openbsc/rest_octets.h +++ b/openbsc/include/openbsc/rest_octets.h @@ -43,7 +43,8 @@ struct gsm48_si_ro_info { present:1; } scheduling; struct gsm48_si3_gprs_ind gprs_ind; - + /* SI 3 specific */ + uint8_t si2quater_indicator; /* SI 4 specific */ struct gsm48_lsa_params lsa_params; uint16_t cell_id; -- cgit v1.2.3 From 5fa7e36bbc100c5cec4542280ca717ae4800b316 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 15 Apr 2016 16:04:45 +0200 Subject: Refactor SI-related code Move define to header file. Use inline functions where appropriate. Change int variables which are used as boolean into actual bool to make code easier to follow. --- openbsc/include/openbsc/abis_rsl.h | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index b27595e4a..100a6d11f 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -31,6 +31,7 @@ struct gsm_lchan; struct gsm_subscriber; struct gsm_bts_trx_ts; +#define GSM48_LEN2PLEN(a) (((a) << 2) | 1) int rsl_bcch_info(struct gsm_bts_trx *trx, uint8_t type, const uint8_t *data, int len); -- cgit v1.2.3 From 59a1bf3dae0d0a9e914d3c615c6aa7fc8955d7b5 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 15 Apr 2016 16:04:46 +0200 Subject: Add basic SI2quater support * support for sending arbitrary static SI2quater. * vty interface for neightbor EARFCNs specific to SI2quater. * dynamic generation of SI2quater messages. * unit test for SI2quater messages. Fixes: OS#1630 --- openbsc/include/openbsc/gsm_data_shared.h | 5 +++++ openbsc/include/openbsc/rest_octets.h | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 000207dd9..cbc0c77f0 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -105,6 +105,7 @@ struct gsm_abis_mo { #define A38_XOR_MAX_KEY_LEN 16 #define A38_COMP128_KEY_LEN 16 #define RSL_ENC_ALG_A5(x) (x+1) +#define MAX_EARFCN_LIST 512 /* is the data link established? who established it? */ #define LCHAN_SAPI_UNUSED 0 @@ -715,12 +716,16 @@ struct gsm_bts { struct bitvec neigh_list; struct bitvec cell_alloc; struct bitvec si5_neigh_list; + struct bitvec si2quater_na_list; + struct osmo_earfcn_si2q si2quater_neigh_list; struct { /* bitmask large enough for all possible ARFCN's */ uint8_t neigh_list[1024/8]; uint8_t cell_alloc[1024/8]; /* If the user wants a different neighbor list in SI5 than in SI2 */ uint8_t si5_neigh_list[1024/8]; + uint8_t meas_bw_list[MAX_EARFCN_LIST]; + uint16_t earfcn_list[MAX_EARFCN_LIST]; } data; } si_common; diff --git a/openbsc/include/openbsc/rest_octets.h b/openbsc/include/openbsc/rest_octets.h index 9560b14c5..fd5ec6a74 100644 --- a/openbsc/include/openbsc/rest_octets.h +++ b/openbsc/include/openbsc/rest_octets.h @@ -1,10 +1,15 @@ #ifndef _REST_OCTETS_H #define _REST_OCTETS_H +#include #include +#include /* generate SI1 rest octets */ int rest_octets_si1(uint8_t *data, uint8_t *nch_pos, int is1800_net); +int rest_octets_si2quater(uint8_t *data, + const struct osmo_earfcn_si2q *e, bool uarfcn, + bool earfcn); struct gsm48_si_selection_params { uint16_t penalty_time:5, -- cgit v1.2.3 From 27c3e76aa7e0912d3404b96a4a043e7208044d0f Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 20 Apr 2016 15:57:12 +0200 Subject: Cleanup shared data structure * remove unused variable. * lower max number of (e|u)arfcns to more realistic value. --- openbsc/include/openbsc/gsm_data_shared.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index cbc0c77f0..52e480583 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -105,7 +105,7 @@ struct gsm_abis_mo { #define A38_XOR_MAX_KEY_LEN 16 #define A38_COMP128_KEY_LEN 16 #define RSL_ENC_ALG_A5(x) (x+1) -#define MAX_EARFCN_LIST 512 +#define MAX_EARFCN_LIST 32 /* is the data link established? who established it? */ #define LCHAN_SAPI_UNUSED 0 @@ -716,7 +716,6 @@ struct gsm_bts { struct bitvec neigh_list; struct bitvec cell_alloc; struct bitvec si5_neigh_list; - struct bitvec si2quater_na_list; struct osmo_earfcn_si2q si2quater_neigh_list; struct { /* bitmask large enough for all possible ARFCN's */ -- cgit v1.2.3 From 26679e0475593aca645c7029e1aad899da73217a Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 20 Apr 2016 15:57:13 +0200 Subject: Add basic UARFCN support * add data structures, generation functions * vty interface for neightbor UARFCNs specific to SI2quater * vty test * unit test Fixes: OS#1666 --- openbsc/include/openbsc/gsm_data_shared.h | 3 +++ openbsc/include/openbsc/rest_octets.h | 8 +++++--- openbsc/include/openbsc/system_information.h | 9 ++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 52e480583..8658fe717 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -717,6 +717,7 @@ struct gsm_bts { struct bitvec cell_alloc; struct bitvec si5_neigh_list; struct osmo_earfcn_si2q si2quater_neigh_list; + size_t uarfcn_length; /* index for uarfcn and scramble lists */ struct { /* bitmask large enough for all possible ARFCN's */ uint8_t neigh_list[1024/8]; @@ -725,6 +726,8 @@ struct gsm_bts { uint8_t si5_neigh_list[1024/8]; uint8_t meas_bw_list[MAX_EARFCN_LIST]; uint16_t earfcn_list[MAX_EARFCN_LIST]; + uint16_t uarfcn_list[MAX_EARFCN_LIST]; + uint16_t scramble_list[MAX_EARFCN_LIST]; } data; } si_common; diff --git a/openbsc/include/openbsc/rest_octets.h b/openbsc/include/openbsc/rest_octets.h index fd5ec6a74..32b996317 100644 --- a/openbsc/include/openbsc/rest_octets.h +++ b/openbsc/include/openbsc/rest_octets.h @@ -5,11 +5,13 @@ #include #include +#define SI2Q_MAX_LEN 160 +#define SI2Q_MIN_LEN 18 + /* generate SI1 rest octets */ int rest_octets_si1(uint8_t *data, uint8_t *nch_pos, int is1800_net); -int rest_octets_si2quater(uint8_t *data, - const struct osmo_earfcn_si2q *e, bool uarfcn, - bool earfcn); +int rest_octets_si2quater(uint8_t *data, const struct osmo_earfcn_si2q *e, + const uint16_t *u, const uint16_t *sc, size_t u_len); struct gsm48_si_selection_params { uint16_t penalty_time:5, diff --git a/openbsc/include/openbsc/system_information.h b/openbsc/include/openbsc/system_information.h index 6a5684821..ecc696422 100644 --- a/openbsc/include/openbsc/system_information.h +++ b/openbsc/include/openbsc/system_information.h @@ -6,5 +6,12 @@ struct gsm_bts; int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type); - +uint16_t encode_fdd(uint16_t scramble, bool diversity); +unsigned uarfcn_size(const uint16_t *u, const uint16_t *sc, size_t u_len); +unsigned earfcn_size(const struct osmo_earfcn_si2q *e); +unsigned range1024_p(unsigned n); +unsigned range512_q(unsigned m); +int bts_uarfcn_del(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble); +int bts_uarfcn_add(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble, + bool diversity); #endif -- cgit v1.2.3 From aafff96c4060e9bf6ceb9dee9652a91d293a6e1e Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 20 Apr 2016 15:57:14 +0200 Subject: Add vty check for max si2quater size Explicitly check if added (U|E)ARFCN will fit into available si2quater message. --- openbsc/include/openbsc/system_information.h | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/system_information.h b/openbsc/include/openbsc/system_information.h index ecc696422..7e3ceaa29 100644 --- a/openbsc/include/openbsc/system_information.h +++ b/openbsc/include/openbsc/system_information.h @@ -11,6 +11,7 @@ unsigned uarfcn_size(const uint16_t *u, const uint16_t *sc, size_t u_len); unsigned earfcn_size(const struct osmo_earfcn_si2q *e); unsigned range1024_p(unsigned n); unsigned range512_q(unsigned m); +bool si2q_size_check(const struct gsm_bts *bts); int bts_uarfcn_del(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble); int bts_uarfcn_add(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble, bool diversity); -- cgit v1.2.3 From 121e9a4164e65dfb68b2bf09297a8537a2f659c5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 20 Apr 2016 13:13:19 +0200 Subject: Start to use struct osmo_auth_vector from gsm_auth_tuple Rather than having a 'private' structure for kc, sres and rand, we now finally (with 4 years delay) use osmo_auth_vector from libosmogsm, which encapsulates authentication vectors that can be either GSM triplets or UMTS quintuples or a combination of both. gsm_auth_tuple becomes a wrapper around osmo_auth_vector, adding use_count and key_seq to it. key_seq is no longer initialized inside gprs_gsup_messages.c, as there is no CKSN / key_seq inside the message anyway. If a usre of the code needs key_seq, they need to manage it themselves. --- openbsc/include/openbsc/gprs_gsup_messages.h | 4 ++-- openbsc/include/openbsc/gsm_data.h | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gprs_gsup_messages.h b/openbsc/include/openbsc/gprs_gsup_messages.h index 8cbc809f7..66a75a801 100644 --- a/openbsc/include/openbsc/gprs_gsup_messages.h +++ b/openbsc/include/openbsc/gprs_gsup_messages.h @@ -104,8 +104,8 @@ struct gprs_gsup_message { enum gprs_gsup_cancel_type cancel_type; int pdp_info_compl; int freeze_ptmsi; - struct gsm_auth_tuple auth_tuples[GPRS_GSUP_MAX_NUM_AUTH_INFO]; - size_t num_auth_tuples; + struct osmo_auth_vector auth_vectors[GPRS_GSUP_MAX_NUM_AUTH_INFO]; + size_t num_auth_vectors; struct gprs_gsup_pdp_info pdp_infos[GPRS_GSUP_MAX_NUM_PDP_INFO]; size_t num_pdp_infos; const uint8_t *msisdn_enc; diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 6d7aba358..f229e7499 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -5,6 +5,7 @@ #include #include +#include #include @@ -47,9 +48,7 @@ struct gsm_auth_info { struct gsm_auth_tuple { int use_count; int key_seq; - uint8_t rand[16]; - uint8_t sres[4]; - uint8_t kc[8]; + struct osmo_auth_vector vec; }; #define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */ -- cgit v1.2.3 From 53373bca8f9fe79ca981f9fc1ef644586bd5c3b2 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 20 Apr 2016 17:11:43 +0200 Subject: move gsm_04_08_gprs.h to libosmocore This requres the corresponding commit in libosmocore. --- openbsc/include/openbsc/Makefile.am | 2 +- openbsc/include/openbsc/gprs_gsup_messages.h | 3 +- openbsc/include/openbsc/gsm_04_08_gprs.h | 397 --------------------------- openbsc/include/openbsc/oap_messages.h | 2 +- 4 files changed, 3 insertions(+), 401 deletions(-) delete mode 100644 openbsc/include/openbsc/gsm_04_08_gprs.h (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index d42f775d9..631a74e5e 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -8,7 +8,7 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \ vty.h socket.h e1_config.h trau_upqueue.h token_auth.h \ handover_decision.h rrlp.h \ crc24.h gprs_llc.h gprs_gmm.h \ - gb_proxy.h gprs_sgsn.h gsm_04_08_gprs.h sgsn.h \ + gb_proxy.h gprs_sgsn.h sgsn.h \ auth.h osmo_msc.h bsc_msc.h bsc_nat.h \ osmo_bsc_rf.h osmo_bsc.h network_listen.h bsc_nat_sccp.h \ osmo_msc_data.h osmo_bsc_grace.h sms_queue.h abis_om2000.h \ diff --git a/openbsc/include/openbsc/gprs_gsup_messages.h b/openbsc/include/openbsc/gprs_gsup_messages.h index 66a75a801..c4e97570c 100644 --- a/openbsc/include/openbsc/gprs_gsup_messages.h +++ b/openbsc/include/openbsc/gprs_gsup_messages.h @@ -22,8 +22,7 @@ #pragma once #include -#include -#include +#include /* Needed for GSM_IMSI_LENGTH: */ #include diff --git a/openbsc/include/openbsc/gsm_04_08_gprs.h b/openbsc/include/openbsc/gsm_04_08_gprs.h deleted file mode 100644 index f35d11b60..000000000 --- a/openbsc/include/openbsc/gsm_04_08_gprs.h +++ /dev/null @@ -1,397 +0,0 @@ -#ifndef _GSM48_GPRS_H -#define _GSM48_GPRS_H - -#include -#include - -/* Table 10.4 / 10.4a, GPRS Mobility Management (GMM) */ -#define GSM48_MT_GMM_ATTACH_REQ 0x01 -#define GSM48_MT_GMM_ATTACH_ACK 0x02 -#define GSM48_MT_GMM_ATTACH_COMPL 0x03 -#define GSM48_MT_GMM_ATTACH_REJ 0x04 -#define GSM48_MT_GMM_DETACH_REQ 0x05 -#define GSM48_MT_GMM_DETACH_ACK 0x06 - -#define GSM48_MT_GMM_RA_UPD_REQ 0x08 -#define GSM48_MT_GMM_RA_UPD_ACK 0x09 -#define GSM48_MT_GMM_RA_UPD_COMPL 0x0a -#define GSM48_MT_GMM_RA_UPD_REJ 0x0b - -#define GSM48_MT_GMM_PTMSI_REALL_CMD 0x10 -#define GSM48_MT_GMM_PTMSI_REALL_COMPL 0x11 -#define GSM48_MT_GMM_AUTH_CIPH_REQ 0x12 -#define GSM48_MT_GMM_AUTH_CIPH_RESP 0x13 -#define GSM48_MT_GMM_AUTH_CIPH_REJ 0x14 -#define GSM48_MT_GMM_ID_REQ 0x15 -#define GSM48_MT_GMM_ID_RESP 0x16 -#define GSM48_MT_GMM_STATUS 0x20 -#define GSM48_MT_GMM_INFO 0x21 - -/* Table 10.4a, GPRS Session Management (GSM) */ -#define GSM48_MT_GSM_ACT_PDP_REQ 0x41 -#define GSM48_MT_GSM_ACT_PDP_ACK 0x42 -#define GSM48_MT_GSM_ACT_PDP_REJ 0x43 -#define GSM48_MT_GSM_REQ_PDP_ACT 0x44 -#define GSM48_MT_GSM_REQ_PDP_ACT_REJ 0x45 -#define GSM48_MT_GSM_DEACT_PDP_REQ 0x46 -#define GSM48_MT_GSM_DEACT_PDP_ACK 0x47 -#define GSM48_MT_GSM_ACT_AA_PDP_REQ 0x50 -#define GSM48_MT_GSM_ACT_AA_PDP_ACK 0x51 -#define GSM48_MT_GSM_ACT_AA_PDP_REJ 0x52 -#define GSM48_MT_GSM_DEACT_AA_PDP_REQ 0x53 -#define GSM48_MT_GSM_DEACT_AA_PDP_ACK 0x54 -#define GSM48_MT_GSM_STATUS 0x55 - -/* Chapter 10.5.5.2 / Table 10.5.135 */ -#define GPRS_ATT_T_ATTACH 1 -#define GPRS_ATT_T_ATT_WHILE_IMSI 2 -#define GPRS_ATT_T_COMBINED 3 - -extern const struct value_string *gprs_att_t_strs; - -/* Chapter 10.5.5.5 / Table 10.5.138 */ -#define GPRS_DET_T_MO_GPRS 1 -#define GPRS_DET_T_MO_IMSI 2 -#define GPRS_DET_T_MO_COMBINED 3 -/* Network to MS direction */ -#define GPRS_DET_T_MT_REATT_REQ 1 -#define GPRS_DET_T_MT_REATT_NOTREQ 2 -#define GPRS_DET_T_MT_IMSI 3 - -extern const struct value_string *gprs_det_t_mo_strs; -extern const struct value_string *gprs_det_t_mt_strs; - -/* Chapter 10.5.5.18 / Table 105.150 */ -#define GPRS_UPD_T_RA 0 -#define GPRS_UPD_T_RA_LA 1 -#define GPRS_UPD_T_RA_LA_IMSI_ATT 2 -#define GPRS_UPD_T_PERIODIC 3 - -extern const struct value_string *gprs_upd_t_strs; - -enum gsm48_gprs_ie_mm { - GSM48_IE_GMM_CIPH_CKSN = 0x08, /* 10.5.1.2 */ - GSM48_IE_GMM_TIMER_READY = 0x17, /* 10.5.7.3 */ - GSM48_IE_GMM_ALLOC_PTMSI = 0x18, /* 10.5.1.4 */ - GSM48_IE_GMM_PTMSI_SIG = 0x19, /* 10.5.5.8 */ - GSM48_IE_GMM_AUTH_RAND = 0x21, /* 10.5.3.1 */ - GSM48_IE_GMM_AUTH_SRES = 0x22, /* 10.5.3.2 */ - GSM48_IE_GMM_IMEISV = 0x23, /* 10.5.1.4 */ - GSM48_IE_GMM_CAUSE = 0x25, /* 10.5.5.14 */ - GSM48_IE_GMM_DRX_PARAM = 0x27, /* 10.5.5.6 */ - GSM48_IE_GMM_MS_NET_CAPA = 0x31, /* 10.5.5.12 */ - GSM48_IE_GMM_PDP_CTX_STATUS = 0x32, /* 10.5.7.1 */ - GSM48_IE_GMM_PS_LCS_CAPA = 0x33, /* 10.5.5.22 */ - GSM48_IE_GMM_GMM_MBMS_CTX_ST = 0x35, /* 10.5.7.6 */ -}; - -enum gsm48_gprs_ie_sm { - GSM48_IE_GSM_APN = 0x28, /* 10.5.6.1 */ - GSM48_IE_GSM_PROTO_CONF_OPT = 0x27, /* 10.5.6.3 */ - GSM48_IE_GSM_PDP_ADDR = 0x2b, /* 10.5.6.4 */ - GSM48_IE_GSM_AA_TMR = 0x29, /* 10.5.7.3 */ - GSM48_IE_GSM_NAME_FULL = 0x43, /* 10.5.3.5a */ - GSM48_IE_GSM_NAME_SHORT = 0x45, /* 10.5.3.5a */ - GSM48_IE_GSM_TIMEZONE = 0x46, /* 10.5.3.8 */ - GSM48_IE_GSM_UTC_AND_TZ = 0x47, /* 10.5.3.9 */ - GSM48_IE_GSM_LSA_ID = 0x48, /* 10.5.3.11 */ - - /* Fake IEs that are not present on the Layer3 air interface, - * but which we use to simplify internal APIs */ - OSMO_IE_GSM_REQ_QOS = 0xfd, - OSMO_IE_GSM_REQ_PDP_ADDR = 0xfe, - OSMO_IE_GSM_SUB_QOS = 0xff, -}; - -/* Chapter 9.4.15 / Table 9.4.15 */ -struct gsm48_ra_upd_ack { - uint8_t force_stby:4, /* 10.5.5.7 */ - upd_result:4; /* 10.5.5.17 */ - uint8_t ra_upd_timer; /* 10.5.7.3 */ - struct gsm48_ra_id ra_id; /* 10.5.5.15 */ - uint8_t data[0]; -} __attribute__((packed)); - -/* Chapter 10.5.7.3 */ -enum gsm48_gprs_tmr_unit { - GPRS_TMR_2SECONDS = 0 << 5, - GPRS_TMR_MINUTE = 1 << 5, - GPRS_TMR_6MINUTE = 2 << 5, - GPRS_TMR_DEACTIVATED = 7 << 5, -}; - -#define GPRS_TMR_UNIT_MASK (7 << 5) -#define GPRS_TMR_FACT_MASK ((1 << 5)-1) - -/* Chapter 9.4.2 / Table 9.4.2 */ -struct gsm48_attach_ack { - uint8_t att_result:4, /* 10.5.5.7 */ - force_stby:4; /* 10.5.5.1 */ - uint8_t ra_upd_timer; /* 10.5.7.3 */ - uint8_t radio_prio; /* 10.5.7.2 */ - struct gsm48_ra_id ra_id; /* 10.5.5.15 */ - uint8_t data[0]; -} __attribute__((packed)); - -/* Chapter 9.4.9 / Table 9.4.9 */ -struct gsm48_auth_ciph_req { - uint8_t ciph_alg:4, /* 10.5.5.3 */ - imeisv_req:4; /* 10.5.5.10 */ - uint8_t force_stby:4, /* 10.5.5.7 */ - ac_ref_nr:4; /* 10.5.5.19 */ - uint8_t data[0]; -} __attribute__((packed)); -/* optional: TV RAND, TV CKSN */ - -struct gsm48_auth_ciph_resp { - uint8_t ac_ref_nr:4, - spare:4; - uint8_t data[0]; -} __attribute__((packed)); - -/* Chapter 9.5.1 / Table 9.5.1 */ -struct gsm48_act_pdp_ctx_req { - uint8_t req_nsapi; - uint8_t req_llc_sapi; - uint8_t data[0]; -} __attribute__((packed)); - -/* Chapter 10.5.5.14 / Table 10.5.147 */ -enum gsm48_gmm_cause { - GMM_CAUSE_IMSI_UNKNOWN = 0x02, - GMM_CAUSE_ILLEGAL_MS = 0x03, - GMM_CAUSE_ILLEGAL_ME = 0x06, - GMM_CAUSE_GPRS_NOTALLOWED = 0x07, - GMM_CAUSE_GPRS_OTHER_NOTALLOWED = 0x08, - GMM_CAUSE_MS_ID_NOT_DERIVED = 0x09, - GMM_CAUSE_IMPL_DETACHED = 0x0a, - GMM_CAUSE_PLMN_NOTALLOWED = 0x0b, - GMM_CAUSE_LA_NOTALLOWED = 0x0c, - GMM_CAUSE_ROAMING_NOTALLOWED = 0x0d, - GMM_CAUSE_NO_GPRS_PLMN = 0x0e, - GMM_CAUSE_MSC_TEMP_NOTREACH = 0x10, - GMM_CAUSE_NET_FAIL = 0x11, - GMM_CAUSE_CONGESTION = 0x16, - GMM_CAUSE_SEM_INCORR_MSG = 0x5f, - GMM_CAUSE_INV_MAND_INFO = 0x60, - GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL = 0x61, - GMM_CAUSE_MSGT_INCOMP_P_STATE = 0x62, - GMM_CAUSE_IE_NOTEXIST_NOTIMPL = 0x63, - GMM_CAUSE_COND_IE_ERR = 0x64, - GMM_CAUSE_MSG_INCOMP_P_STATE = 0x65, - GMM_CAUSE_PROTO_ERR_UNSPEC = 0x6f, -}; - -extern const struct value_string *gsm48_gmm_cause_names; - -/* Chapter 10.4.6.6 / Table 10.5.157 */ -enum gsm48_gsm_cause { - GSM_CAUSE_INSUFF_RSRC = 0x1a, - GSM_CAUSE_MISSING_APN = 0x1b, - GSM_CAUSE_UNKNOWN_PDP = 0x1c, - GSM_CAUSE_AUTH_FAILED = 0x1d, - GSM_CAUSE_ACT_REJ_GGSN = 0x1e, - GSM_CAUSE_ACT_REJ_UNSPEC = 0x1f, - GSM_CAUSE_SERV_OPT_NOTSUPP = 0x20, - GSM_CAUSE_REQ_SERV_OPT_NOTSUB = 0x21, - GSM_CAUSE_SERV_OPT_TEMP_OOO = 0x22, - GSM_CAUSE_NSAPI_IN_USE = 0x23, - GSM_CAUSE_DEACT_REGULAR = 0x24, - GSM_CAUSE_QOS_NOT_ACCEPTED = 0x25, - GSM_CAUSE_NET_FAIL = 0x26, - GSM_CAUSE_REACT_RQD = 0x27, - GSM_CAUSE_FEATURE_NOTSUPP = 0x28, - GSM_CAUSE_INVALID_TRANS_ID = 0x51, - GSM_CAUSE_SEM_INCORR_MSG = 0x5f, - GSM_CAUSE_INV_MAND_INFO = 0x60, - GSM_CAUSE_MSGT_NOTEXIST_NOTIMPL = 0x61, - GSM_CAUSE_MSGT_INCOMP_P_STATE = 0x62, - GSM_CAUSE_IE_NOTEXIST_NOTIMPL = 0x63, - GSM_CAUSE_COND_IE_ERR = 0x64, - GSM_CAUSE_MSG_INCOMP_P_STATE = 0x65, - GSM_CAUSE_PROTO_ERR_UNSPEC = 0x6f, -}; - -extern const struct value_string *gsm48_gsm_cause_names; - -/* Section 6.1.2.2: Session management states on the network side */ -enum gsm48_pdp_state { - PDP_S_INACTIVE, - PDP_S_ACTIVE_PENDING, - PDP_S_ACTIVE, - PDP_S_INACTIVE_PENDING, - PDP_S_MODIFY_PENDING, -}; - -/* Table 10.5.155/3GPP TS 24.008 */ -enum gsm48_pdp_type_org { - PDP_TYPE_ORG_ETSI = 0x00, - PDP_TYPE_ORG_IETF = 0x01, -}; -enum gsm48_pdp_type_nr { - PDP_TYPE_N_ETSI_RESERVED = 0x00, - PDP_TYPE_N_ETSI_PPP = 0x01, - PDP_TYPE_N_IETF_IPv4 = 0x21, - PDP_TYPE_N_IETF_IPv6 = 0x57, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_reliab_class { - GSM48_QOS_RC_LLC_ACK_RLC_ACK_DATA_PROT = 2, - GSM48_QOS_RC_LLC_UN_RLC_ACK_DATA_PROT = 3, - GSM48_QOS_RC_LLC_UN_RLC_UN_PROT_DATA = 4, - GSM48_QOS_RC_LLC_UN_RLC_UN_DATA_UN = 5, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_preced_class { - GSM48_QOS_PC_HIGH = 1, - GSM48_QOS_PC_NORMAL = 2, - GSM48_QOS_PC_LOW = 3, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_peak_tput { - GSM48_QOS_PEAK_TPUT_1000bps = 1, - GSM48_QOS_PEAK_TPUT_2000bps = 2, - GSM48_QOS_PEAK_TPUT_4000bps = 3, - GSM48_QOS_PEAK_TPUT_8000bps = 4, - GSM48_QOS_PEAK_TPUT_16000bps = 5, - GSM48_QOS_PEAK_TPUT_32000bps = 6, - GSM48_QOS_PEAK_TPUT_64000bps = 7, - GSM48_QOS_PEAK_TPUT_128000bps = 8, - GSM48_QOS_PEAK_TPUT_256000bps = 9, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_mean_tput { - GSM48_QOS_MEAN_TPUT_100bph = 1, - GSM48_QOS_MEAN_TPUT_200bph = 2, - GSM48_QOS_MEAN_TPUT_500bph = 3, - GSM48_QOS_MEAN_TPUT_1000bph = 4, - GSM48_QOS_MEAN_TPUT_2000bph = 5, - GSM48_QOS_MEAN_TPUT_5000bph = 6, - GSM48_QOS_MEAN_TPUT_10000bph = 7, - GSM48_QOS_MEAN_TPUT_20000bph = 8, - GSM48_QOS_MEAN_TPUT_50000bph = 9, - GSM48_QOS_MEAN_TPUT_100kbph = 10, - GSM48_QOS_MEAN_TPUT_200kbph = 11, - GSM48_QOS_MEAN_TPUT_500kbph = 0xc, - GSM48_QOS_MEAN_TPUT_1Mbph = 0xd, - GSM48_QOS_MEAN_TPUT_2Mbph = 0xe, - GSM48_QOS_MEAN_TPUT_5Mbph = 0xf, - GSM48_QOS_MEAN_TPUT_10Mbph = 0x10, - GSM48_QOS_MEAN_TPUT_20Mbph = 0x11, - GSM48_QOS_MEAN_TPUT_50Mbph = 0x12, - GSM48_QOS_MEAN_TPUT_BEST_EFFORT = 0x1f, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_err_sdu { - GSM48_QOS_ERRSDU_NODETECT = 1, - GSM48_QOS_ERRSDU_YES = 2, - GSM48_QOS_ERRSDU_NO = 3, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_deliv_order { - GSM48_QOS_DO_ORDERED = 1, - GSM48_QOS_DO_UNORDERED = 2, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_traf_class { - GSM48_QOS_TC_CONVERSATIONAL = 1, - GSM48_QOS_TC_STREAMING = 2, - GSM48_QOS_TC_INTERACTIVE = 3, - GSM48_QOS_TC_BACKGROUND = 4, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_max_sdu_size { - /* values below in 10 octet granularity */ - GSM48_QOS_MAXSDU_1502 = 0x97, - GSM48_QOS_MAXSDU_1510 = 0x98, - GSM48_QOS_MAXSDU_1520 = 0x99, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_max_bitrate { - GSM48_QOS_MBRATE_1k = 0x01, - GSM48_QOS_MBRATE_63k = 0x3f, - GSM48_QOS_MBRATE_64k = 0x40, - GSM48_QOS_MBRATE_568k = 0x7f, - GSM48_QOS_MBRATE_576k = 0x80, - GSM48_QOS_MBRATE_8640k = 0xfe, - GSM48_QOS_MBRATE_0k = 0xff, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_resid_ber { - GSM48_QOS_RBER_5e_2 = 0x01, - GSM48_QOS_RBER_1e_2 = 0x02, - GSM48_QOS_RBER_5e_3 = 0x03, - GSM48_QOS_RBER_4e_3 = 0x04, - GSM48_QOS_RBER_1e_3 = 0x05, - GSM48_QOS_RBER_1e_4 = 0x06, - GSM48_QOS_RBER_1e_5 = 0x07, - GSM48_QOS_RBER_1e_6 = 0x08, - GSM48_QOS_RBER_6e_8 = 0x09, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -enum gsm48_qos_sdu_err { - GSM48_QOS_SERR_1e_2 = 0x01, - GSM48_QOS_SERR_7e_2 = 0x02, - GSM48_QOS_SERR_1e_3 = 0x03, - GSM48_QOS_SERR_1e_4 = 0x04, - GSM48_QOS_SERR_1e_5 = 0x05, - GSM48_QOS_SERR_1e_6 = 0x06, - GSM48_QOS_SERR_1e_1 = 0x07, -}; - -/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ -struct gsm48_qos { - /* octet 3 */ - uint8_t reliab_class:3; - uint8_t delay_class:3; - uint8_t spare:2; - /* octet 4 */ - uint8_t preced_class:3; - uint8_t spare2:1; - uint8_t peak_tput:4; - /* octet 5 */ - uint8_t mean_tput:5; - uint8_t spare3:3; - /* octet 6 */ - uint8_t deliv_err_sdu:3; - uint8_t deliv_order:2; - uint8_t traf_class:3; - /* octet 7 */ - uint8_t max_sdu_size; - /* octet 8 */ - uint8_t max_bitrate_up; - /* octet 9 */ - uint8_t max_bitrate_down; - /* octet 10 */ - uint8_t sdu_err_ratio:4; - uint8_t resid_ber:4; - /* octet 11 */ - uint8_t handling_prio:2; - uint8_t xfer_delay:6; - /* octet 12 */ - uint8_t guar_bitrate_up; - /* octet 13 */ - uint8_t guar_bitrate_down; - /* octet 14 */ - uint8_t src_stats_desc:4; - uint8_t sig_ind:1; - uint8_t spare5:3; - /* octet 15 */ - uint8_t max_bitrate_down_ext; - /* octet 16 */ - uint8_t guar_bitrate_down_ext; -}; - - -#endif /* _GSM48_GPRS_H */ diff --git a/openbsc/include/openbsc/oap_messages.h b/openbsc/include/openbsc/oap_messages.h index a7a254c2e..b7f4ccada 100644 --- a/openbsc/include/openbsc/oap_messages.h +++ b/openbsc/include/openbsc/oap_messages.h @@ -22,7 +22,7 @@ #pragma once #include -#include +#include #include /* Some numbers are out of sequence because (so far) they match gprs_gsup_iei. -- cgit v1.2.3 From d3fa84dbba3b67cdbe2d8c789b2833b5ddf42068 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 20 Apr 2016 17:50:17 +0200 Subject: use new libosmocore gsm_23_003.h for IMEI/IMSI length ... rather than our private definitions everwhere. As an added benefit, gprs_gsup_messages.h is now free of any header dependencies within openbsc. --- openbsc/include/openbsc/gprs_gsup_messages.h | 7 ++++--- openbsc/include/openbsc/gprs_sgsn.h | 7 +++---- openbsc/include/openbsc/gsm_subscriber.h | 7 +++---- openbsc/include/openbsc/ipaccess.h | 3 ++- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gprs_gsup_messages.h b/openbsc/include/openbsc/gprs_gsup_messages.h index c4e97570c..fe8bef555 100644 --- a/openbsc/include/openbsc/gprs_gsup_messages.h +++ b/openbsc/include/openbsc/gprs_gsup_messages.h @@ -22,9 +22,10 @@ #pragma once #include +#include +#include #include -/* Needed for GSM_IMSI_LENGTH: */ -#include +#include #define GPRS_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */ #define GPRS_GSUP_MAX_NUM_AUTH_INFO 5 @@ -98,7 +99,7 @@ struct gprs_gsup_pdp_info { struct gprs_gsup_message { enum gprs_gsup_message_type message_type; - char imsi[GSM_IMSI_LENGTH]; + char imsi[GSM23003_IMSI_MAX_DIGITS+2]; enum gsm48_gmm_cause cause; enum gprs_gsup_cancel_type cancel_type; int pdp_info_compl; diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index 49d5407f5..898b7a514 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -9,11 +9,10 @@ #include #include +#include #include -#define GSM_IMSI_LENGTH 17 -#define GSM_IMEI_LENGTH 17 #define GSM_EXTENSION_LENGTH 15 #define GSM_APN_LENGTH 102 @@ -98,12 +97,12 @@ struct sgsn_ggsn_lookup { struct sgsn_mm_ctx { struct llist_head list; - char imsi[GSM_IMSI_LENGTH]; + char imsi[GSM23003_IMSI_MAX_DIGITS+1]; enum gprs_mm_state mm_state; uint32_t p_tmsi; uint32_t p_tmsi_old; /* old P-TMSI before new is confirmed */ uint32_t p_tmsi_sig; - char imei[GSM_IMEI_LENGTH]; + char imei[GSM23003_IMEISV_NUM_DIGITS+1]; /* Opt: Software Version Numbber / TS 23.195 */ char msisdn[GSM_EXTENSION_LENGTH]; struct gprs_ra_id ra; diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h index 7d6c776bc..9df989a79 100644 --- a/openbsc/include/openbsc/gsm_subscriber.h +++ b/openbsc/include/openbsc/gsm_subscriber.h @@ -3,9 +3,8 @@ #include "gsm_data.h" #include +#include -#define GSM_IMEI_LENGTH 17 -#define GSM_IMSI_LENGTH 17 #define GSM_NAME_LENGTH 160 #define GSM_EXTENSION_LENGTH 15 /* MSISDN can only be 15 digits length */ @@ -32,7 +31,7 @@ struct gsm_subscriber_group { struct gsm_equipment { long long unsigned int id; - char imei[GSM_IMEI_LENGTH]; + char imei[GSM23003_IMEISV_NUM_DIGITS+1]; char name[GSM_NAME_LENGTH]; struct gsm48_classmark1 classmark1; @@ -45,7 +44,7 @@ struct gsm_equipment { struct gsm_subscriber { struct gsm_subscriber_group *group; long long unsigned int id; - char imsi[GSM_IMSI_LENGTH]; + char imsi[GSM23003_IMSI_MAX_DIGITS+1]; uint32_t tmsi; uint16_t lac; char name[GSM_NAME_LENGTH]; diff --git a/openbsc/include/openbsc/ipaccess.h b/openbsc/include/openbsc/ipaccess.h index 38151c477..82e89c27d 100644 --- a/openbsc/include/openbsc/ipaccess.h +++ b/openbsc/include/openbsc/ipaccess.h @@ -5,13 +5,14 @@ #include "gsm_subscriber.h" #include #include +#include struct ipac_msgt_sccp_state { uint8_t src_ref[3]; uint8_t dst_ref[3]; uint8_t trans_id; uint8_t invoke_id; - char imsi[GSM_IMSI_LENGTH]; + char imsi[GSM23003_IMSI_MAX_DIGITS+1]; uint8_t data[0]; } __attribute__((packed)); -- cgit v1.2.3 From 28903a99eae60cee616901fd3863960b1321ff54 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 25 Apr 2016 14:53:43 +0200 Subject: Rename gprs_gsup_* to osmo_gsup_* This is a preparation to move the related code to libosmocore, whilst at the same time generalizing it from GPRS Subscriber Update Protocol to the Osmocom Generic Subscriber Update Protoco. --- openbsc/include/openbsc/Makefile.am | 2 +- openbsc/include/openbsc/gprs_gsup_messages.h | 119 -------------------------- openbsc/include/openbsc/osmo_gsup_messages.h | 120 +++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 120 deletions(-) delete mode 100644 openbsc/include/openbsc/gprs_gsup_messages.h create mode 100644 openbsc/include/openbsc/osmo_gsup_messages.h (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 631a74e5e..8a31fe5a9 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -15,7 +15,7 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \ bss.h gsm_data_shared.h ipaccess.h mncc_int.h \ arfcn_range_encode.h nat_rewrite_trie.h bsc_nat_callstats.h \ osmux.h mgcp_transcode.h gprs_utils.h utils.h \ - gprs_gb_parse.h smpp.h meas_feed.h gprs_gsup_messages.h \ + gprs_gb_parse.h smpp.h meas_feed.h osmo_gsup_messages.h \ gprs_gsup_client.h bsc_msg_filter.h \ oap.h oap_messages.h \ gtphub.h diff --git a/openbsc/include/openbsc/gprs_gsup_messages.h b/openbsc/include/openbsc/gprs_gsup_messages.h deleted file mode 100644 index fe8bef555..000000000 --- a/openbsc/include/openbsc/gprs_gsup_messages.h +++ /dev/null @@ -1,119 +0,0 @@ -/* GPRS Subscriber Update Protocol message encoder/decoder */ - -/* (C) 2014 by Sysmocom s.f.m.c. GmbH - * All Rights Reserved - * - * Author: Jacob Erlbeck - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ -#pragma once - -#include -#include -#include -#include -#include - -#define GPRS_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */ -#define GPRS_GSUP_MAX_NUM_AUTH_INFO 5 -#define GPRS_GSUP_MAX_MSISDN_LEN 9 - -#define GPRS_GSUP_PDP_TYPE_SIZE 2 - -enum gprs_gsup_iei { - GPRS_GSUP_IMSI_IE = 0x01, - GPRS_GSUP_CAUSE_IE = 0x02, - GPRS_GSUP_AUTH_TUPLE_IE = 0x03, - GPRS_GSUP_PDP_INFO_COMPL_IE = 0x04, - GPRS_GSUP_PDP_INFO_IE = 0x05, - GPRS_GSUP_CANCEL_TYPE_IE = 0x06, - GPRS_GSUP_FREEZE_PTMSI_IE = 0x07, - GPRS_GSUP_MSISDN_IE = 0x08, - GPRS_GSUP_HLR_NUMBER_IE = 0x09, - GPRS_GSUP_PDP_CONTEXT_ID_IE = 0x10, - GPRS_GSUP_PDP_TYPE_IE = 0x11, - GPRS_GSUP_ACCESS_POINT_NAME_IE = 0x12, - GPRS_GSUP_PDP_QOS_IE = 0x13, - GPRS_GSUP_RAND_IE = 0x20, - GPRS_GSUP_SRES_IE = 0x21, - GPRS_GSUP_KC_IE = 0x22 -}; - -enum gprs_gsup_message_type { - GPRS_GSUP_MSGT_UPDATE_LOCATION_REQUEST = 0b00000100, - GPRS_GSUP_MSGT_UPDATE_LOCATION_ERROR = 0b00000101, - GPRS_GSUP_MSGT_UPDATE_LOCATION_RESULT = 0b00000110, - - GPRS_GSUP_MSGT_SEND_AUTH_INFO_REQUEST = 0b00001000, - GPRS_GSUP_MSGT_SEND_AUTH_INFO_ERROR = 0b00001001, - GPRS_GSUP_MSGT_SEND_AUTH_INFO_RESULT = 0b00001010, - - GPRS_GSUP_MSGT_PURGE_MS_REQUEST = 0b00001100, - GPRS_GSUP_MSGT_PURGE_MS_ERROR = 0b00001101, - GPRS_GSUP_MSGT_PURGE_MS_RESULT = 0b00001110, - - GPRS_GSUP_MSGT_INSERT_DATA_REQUEST = 0b00010000, - GPRS_GSUP_MSGT_INSERT_DATA_ERROR = 0b00010001, - GPRS_GSUP_MSGT_INSERT_DATA_RESULT = 0b00010010, - - GPRS_GSUP_MSGT_DELETE_DATA_REQUEST = 0b00010100, - GPRS_GSUP_MSGT_DELETE_DATA_ERROR = 0b00010101, - GPRS_GSUP_MSGT_DELETE_DATA_RESULT = 0b00010110, - - GPRS_GSUP_MSGT_LOCATION_CANCEL_REQUEST = 0b00011100, - GPRS_GSUP_MSGT_LOCATION_CANCEL_ERROR = 0b00011101, - GPRS_GSUP_MSGT_LOCATION_CANCEL_RESULT = 0b00011110, -}; - -#define GPRS_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00) -#define GPRS_GSUP_IS_MSGT_ERROR(msgt) (((msgt) & 0b00000011) == 0b01) -#define GPRS_GSUP_TO_MSGT_ERROR(msgt) (((msgt) & 0b11111100) | 0b01) - -enum gprs_gsup_cancel_type { - GPRS_GSUP_CANCEL_TYPE_UPDATE = 1, /* on wire: 0 */ - GPRS_GSUP_CANCEL_TYPE_WITHDRAW = 2, /* on wire: 1 */ -}; - -struct gprs_gsup_pdp_info { - unsigned int context_id; - int have_info; - uint16_t pdp_type; - const uint8_t *apn_enc; - size_t apn_enc_len; - const uint8_t *qos_enc; - size_t qos_enc_len; -}; - -struct gprs_gsup_message { - enum gprs_gsup_message_type message_type; - char imsi[GSM23003_IMSI_MAX_DIGITS+2]; - enum gsm48_gmm_cause cause; - enum gprs_gsup_cancel_type cancel_type; - int pdp_info_compl; - int freeze_ptmsi; - struct osmo_auth_vector auth_vectors[GPRS_GSUP_MAX_NUM_AUTH_INFO]; - size_t num_auth_vectors; - struct gprs_gsup_pdp_info pdp_infos[GPRS_GSUP_MAX_NUM_PDP_INFO]; - size_t num_pdp_infos; - const uint8_t *msisdn_enc; - size_t msisdn_enc_len; - const uint8_t *hlr_enc; - size_t hlr_enc_len; -}; - -int gprs_gsup_decode(const uint8_t *data, size_t data_len, - struct gprs_gsup_message *gsup_msg); -void gprs_gsup_encode(struct msgb *msg, const struct gprs_gsup_message *gsup_msg); diff --git a/openbsc/include/openbsc/osmo_gsup_messages.h b/openbsc/include/openbsc/osmo_gsup_messages.h new file mode 100644 index 000000000..bdc46aaee --- /dev/null +++ b/openbsc/include/openbsc/osmo_gsup_messages.h @@ -0,0 +1,120 @@ +/* Osmocom Subscriber Update Protocol message encoder/decoder */ + +/* (C) 2014 by Sysmocom s.f.m.c. GmbH + * (C) 2016 by Harald Welte + * All Rights Reserved + * + * Author: Jacob Erlbeck + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#include +#include +#include +#include +#include + +#define OSMO_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */ +#define OSMO_GSUP_MAX_NUM_AUTH_INFO 5 +#define OSMO_GSUP_MAX_MSISDN_LEN 9 + +#define OSMO_GSUP_PDP_TYPE_SIZE 2 + +enum osmo_gsup_iei { + OSMO_GSUP_IMSI_IE = 0x01, + OSMO_GSUP_CAUSE_IE = 0x02, + OSMO_GSUP_AUTH_TUPLE_IE = 0x03, + OSMO_GSUP_PDP_INFO_COMPL_IE = 0x04, + OSMO_GSUP_PDP_INFO_IE = 0x05, + OSMO_GSUP_CANCEL_TYPE_IE = 0x06, + OSMO_GSUP_FREEZE_PTMSI_IE = 0x07, + OSMO_GSUP_MSISDN_IE = 0x08, + OSMO_GSUP_HLR_NUMBER_IE = 0x09, + OSMO_GSUP_PDP_CONTEXT_ID_IE = 0x10, + OSMO_GSUP_PDP_TYPE_IE = 0x11, + OSMO_GSUP_ACCESS_POINT_NAME_IE = 0x12, + OSMO_GSUP_PDP_QOS_IE = 0x13, + OSMO_GSUP_RAND_IE = 0x20, + OSMO_GSUP_SRES_IE = 0x21, + OSMO_GSUP_KC_IE = 0x22, +}; + +enum osmo_gsup_message_type { + OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST = 0b00000100, + OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR = 0b00000101, + OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT = 0b00000110, + + OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST = 0b00001000, + OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR = 0b00001001, + OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT = 0b00001010, + + OSMO_GSUP_MSGT_PURGE_MS_REQUEST = 0b00001100, + OSMO_GSUP_MSGT_PURGE_MS_ERROR = 0b00001101, + OSMO_GSUP_MSGT_PURGE_MS_RESULT = 0b00001110, + + OSMO_GSUP_MSGT_INSERT_DATA_REQUEST = 0b00010000, + OSMO_GSUP_MSGT_INSERT_DATA_ERROR = 0b00010001, + OSMO_GSUP_MSGT_INSERT_DATA_RESULT = 0b00010010, + + OSMO_GSUP_MSGT_DELETE_DATA_REQUEST = 0b00010100, + OSMO_GSUP_MSGT_DELETE_DATA_ERROR = 0b00010101, + OSMO_GSUP_MSGT_DELETE_DATA_RESULT = 0b00010110, + + OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST = 0b00011100, + OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR = 0b00011101, + OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT = 0b00011110, +}; + +#define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00) +#define OSMO_GSUP_IS_MSGT_ERROR(msgt) (((msgt) & 0b00000011) == 0b01) +#define OSMO_GSUP_TO_MSGT_ERROR(msgt) (((msgt) & 0b11111100) | 0b01) + +enum osmo_gsup_cancel_type { + OSMO_GSUP_CANCEL_TYPE_UPDATE = 1, /* on wire: 0 */ + OSMO_GSUP_CANCEL_TYPE_WITHDRAW = 2, /* on wire: 1 */ +}; + +struct osmo_gsup_pdp_info { + unsigned int context_id; + int have_info; + uint16_t pdp_type; + const uint8_t *apn_enc; + size_t apn_enc_len; + const uint8_t *qos_enc; + size_t qos_enc_len; +}; + +struct osmo_gsup_message { + enum osmo_gsup_message_type message_type; + char imsi[GSM23003_IMSI_MAX_DIGITS+2]; + enum gsm48_gmm_cause cause; + enum osmo_gsup_cancel_type cancel_type; + int pdp_info_compl; + int freeze_ptmsi; + struct osmo_auth_vector auth_vectors[OSMO_GSUP_MAX_NUM_AUTH_INFO]; + size_t num_auth_vectors; + struct osmo_gsup_pdp_info pdp_infos[OSMO_GSUP_MAX_NUM_PDP_INFO]; + size_t num_pdp_infos; + const uint8_t *msisdn_enc; + size_t msisdn_enc_len; + const uint8_t *hlr_enc; + size_t hlr_enc_len; +}; + +int osmo_gsup_decode(const uint8_t *data, size_t data_len, + struct osmo_gsup_message *gsup_msg); +void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg); -- cgit v1.2.3 From 842674b8b3d245a2eecb352eb89609ed44cb0832 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 25 Apr 2016 15:14:01 +0200 Subject: rename gprs_shift_*() to osmo_shift_*() This rename is the first step of moving the associated functions into libosmocore. Also, rename gprs_match_* to osmo_match_shift_* to indicate that it is not just matching the TLV, but also shifting the data portion. --- openbsc/include/openbsc/gprs_utils.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gprs_utils.h b/openbsc/include/openbsc/gprs_utils.h index 474eb45da..b5bee2b6a 100644 --- a/openbsc/include/openbsc/gprs_utils.h +++ b/openbsc/include/openbsc/gprs_utils.h @@ -42,15 +42,15 @@ int gprs_is_mi_imsi(const uint8_t *value, size_t value_len); int gprs_parse_mi_tmsi(const uint8_t *value, size_t value_len, uint32_t *tmsi); void gprs_parse_tmsi(const uint8_t *value, uint32_t *tmsi); -int gprs_shift_v_fixed(uint8_t **data, size_t *data_len, +int osmo_shift_v_fixed(uint8_t **data, size_t *data_len, size_t len, uint8_t **value); -int gprs_match_tv_fixed(uint8_t **data, size_t *data_len, - uint8_t tag, size_t len, uint8_t **value); -int gprs_shift_tlv(uint8_t **data, size_t *data_len, +int osmo_match_shift_tv_fixed(uint8_t **data, size_t *data_len, + uint8_t tag, size_t len, uint8_t **value); +int osmo_shift_tlv(uint8_t **data, size_t *data_len, uint8_t *tag, uint8_t **value, size_t *value_len); -int gprs_match_tlv(uint8_t **data, size_t *data_len, +int osmo_match_shift_tlv(uint8_t **data, size_t *data_len, uint8_t tag, uint8_t **value, size_t *value_len); -int gprs_shift_lv(uint8_t **data, size_t *data_len, +int osmo_shift_lv(uint8_t **data, size_t *data_len, uint8_t **value, size_t *value_len); int gprs_ra_id_equals(const struct gprs_ra_id *id1, const struct gprs_ra_id *id2); -- cgit v1.2.3 From 85234a32db7ab91f9361d4a54bea9523e2c7a5b9 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 25 Apr 2016 15:20:51 +0200 Subject: move osmo_shift_* / osmo_match_shift_* to libosmogsm --- openbsc/include/openbsc/gprs_utils.h | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gprs_utils.h b/openbsc/include/openbsc/gprs_utils.h index b5bee2b6a..603605c7a 100644 --- a/openbsc/include/openbsc/gprs_utils.h +++ b/openbsc/include/openbsc/gprs_utils.h @@ -42,15 +42,4 @@ int gprs_is_mi_imsi(const uint8_t *value, size_t value_len); int gprs_parse_mi_tmsi(const uint8_t *value, size_t value_len, uint32_t *tmsi); void gprs_parse_tmsi(const uint8_t *value, uint32_t *tmsi); -int osmo_shift_v_fixed(uint8_t **data, size_t *data_len, - size_t len, uint8_t **value); -int osmo_match_shift_tv_fixed(uint8_t **data, size_t *data_len, - uint8_t tag, size_t len, uint8_t **value); -int osmo_shift_tlv(uint8_t **data, size_t *data_len, - uint8_t *tag, uint8_t **value, size_t *value_len); -int osmo_match_shift_tlv(uint8_t **data, size_t *data_len, - uint8_t tag, uint8_t **value, size_t *value_len); -int osmo_shift_lv(uint8_t **data, size_t *data_len, - uint8_t **value, size_t *value_len); - int gprs_ra_id_equals(const struct gprs_ra_id *id1, const struct gprs_ra_id *id2); -- cgit v1.2.3 From 7ca035decaaed460e66286868b1f14ccd3e00013 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 25 Apr 2016 15:36:08 +0200 Subject: gsup_messages: Add UMTS AKA related encoding/decoding support --- openbsc/include/openbsc/osmo_gsup_messages.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/osmo_gsup_messages.h b/openbsc/include/openbsc/osmo_gsup_messages.h index bdc46aaee..4ccc029fc 100644 --- a/openbsc/include/openbsc/osmo_gsup_messages.h +++ b/openbsc/include/openbsc/osmo_gsup_messages.h @@ -51,6 +51,12 @@ enum osmo_gsup_iei { OSMO_GSUP_RAND_IE = 0x20, OSMO_GSUP_SRES_IE = 0x21, OSMO_GSUP_KC_IE = 0x22, + /* 3G support */ + OSMO_GSUP_IK_IE = 0x23, + OSMO_GSUP_CK_IE = 0x24, + OSMO_GSUP_AUTN_IE = 0x25, + OSMO_GSUP_AUTS_IE = 0x26, + OSMO_GSUP_RES_IE = 0x27, }; enum osmo_gsup_message_type { @@ -113,6 +119,7 @@ struct osmo_gsup_message { size_t msisdn_enc_len; const uint8_t *hlr_enc; size_t hlr_enc_len; + const uint8_t *auts; }; int osmo_gsup_decode(const uint8_t *data, size_t data_len, -- cgit v1.2.3 From eff215a8bb766e62a02bcc0f4334470a53475001 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 25 Apr 2016 16:01:15 +0200 Subject: osmo_gsup_messge.[ch] documentation update (doxygen) --- openbsc/include/openbsc/osmo_gsup_messages.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/osmo_gsup_messages.h b/openbsc/include/openbsc/osmo_gsup_messages.h index 4ccc029fc..8156b739b 100644 --- a/openbsc/include/openbsc/osmo_gsup_messages.h +++ b/openbsc/include/openbsc/osmo_gsup_messages.h @@ -1,11 +1,9 @@ /* Osmocom Subscriber Update Protocol message encoder/decoder */ -/* (C) 2014 by Sysmocom s.f.m.c. GmbH +/* (C) 2014 by Sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck * (C) 2016 by Harald Welte * All Rights Reserved * - * Author: Jacob Erlbeck - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -28,12 +26,16 @@ #include #include +/*! Maximum nubmer of PDP inside \ref osmo_gsup_message */ #define OSMO_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */ +/*! Maximum number of auth info inside \ref osmo_gsup_message */ #define OSMO_GSUP_MAX_NUM_AUTH_INFO 5 +/*! Maximum number of octets encoding MSISDN in BCD format */ #define OSMO_GSUP_MAX_MSISDN_LEN 9 #define OSMO_GSUP_PDP_TYPE_SIZE 2 +/*! Information Element Identifiers for GSUP IEs */ enum osmo_gsup_iei { OSMO_GSUP_IMSI_IE = 0x01, OSMO_GSUP_CAUSE_IE = 0x02, @@ -59,6 +61,7 @@ enum osmo_gsup_iei { OSMO_GSUP_RES_IE = 0x27, }; +/*! GSUP message type */ enum osmo_gsup_message_type { OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST = 0b00000100, OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR = 0b00000101, @@ -94,16 +97,25 @@ enum osmo_gsup_cancel_type { OSMO_GSUP_CANCEL_TYPE_WITHDRAW = 2, /* on wire: 1 */ }; +/*! parsed/decoded PDP context information */ struct osmo_gsup_pdp_info { unsigned int context_id; int have_info; + /*! Type of PDP context */ uint16_t pdp_type; + /*! APN information, still in encoded form. Can be NULL if no + * APN information included */ const uint8_t *apn_enc; + /*! length (in octets) of apn_enc */ size_t apn_enc_len; + /*! QoS information, still in encoded form. Can be NULL if no + * QoS information included */ const uint8_t *qos_enc; + /*! length (in octets) of qos_enc */ size_t qos_enc_len; }; +/*! parsed/decoded GSUP protocol message */ struct osmo_gsup_message { enum osmo_gsup_message_type message_type; char imsi[GSM23003_IMSI_MAX_DIGITS+2]; -- cgit v1.2.3 From 50f1c0af567423b6ade9a84aaa5197ecf6237819 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 25 Apr 2016 19:01:26 +0200 Subject: move utils.h functions to libosmocore This needs the corresponding commit in libosmocore which imports the related functions --- openbsc/include/openbsc/Makefile.am | 2 +- openbsc/include/openbsc/utils.h | 26 -------------------------- 2 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 openbsc/include/openbsc/utils.h (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 8a31fe5a9..893c7aa6e 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -14,7 +14,7 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \ osmo_msc_data.h osmo_bsc_grace.h sms_queue.h abis_om2000.h \ bss.h gsm_data_shared.h ipaccess.h mncc_int.h \ arfcn_range_encode.h nat_rewrite_trie.h bsc_nat_callstats.h \ - osmux.h mgcp_transcode.h gprs_utils.h utils.h \ + osmux.h mgcp_transcode.h gprs_utils.h \ gprs_gb_parse.h smpp.h meas_feed.h osmo_gsup_messages.h \ gprs_gsup_client.h bsc_msg_filter.h \ oap.h oap_messages.h \ diff --git a/openbsc/include/openbsc/utils.h b/openbsc/include/openbsc/utils.h deleted file mode 100644 index d6054873b..000000000 --- a/openbsc/include/openbsc/utils.h +++ /dev/null @@ -1,26 +0,0 @@ -/* OpenBSC kitchen sink */ - -#pragma once - -#include -#include - -/* Compare count bytes of exp to rel. Return 0 if they are identical, 1 - * otherwise. Do not return a mismatch on the first mismatching byte, - * but always compare all bytes, regardless. The idea is that the amount of - * matching bytes cannot be inferred from the time the comparison took.*/ -int constant_time_cmp(const uint8_t *exp, const uint8_t *rel, const int count); - -/* This is like osmo_load64be_ext, except that if data_len is less than - * sizeof(uint64_t), the data is interpreted as the least significant bytes - * (osmo_load64be_ext loads them as the most significant bytes into the - * returned uint64_t). In this way, any integer size up to 64 bits can be - * decoded conveniently by using sizeof(), without the need to call specific - * numbered functions (osmo_load16, 32, ...). */ -uint64_t decode_big_endian(const uint8_t *data, size_t data_len); - -/* This is like osmo_store64be_ext, except that this returns a static buffer of - * the result (for convenience, but not threadsafe). If data_len is less than - * sizeof(uint64_t), only the least significant bytes of value are encoded. */ -uint8_t *encode_big_endian(uint64_t value, size_t data_len); - -- cgit v1.2.3 From 23d77d56ea47bbb971bf2fc5d93d6ae2d7d30f03 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 25 Apr 2016 19:07:34 +0200 Subject: Move osmo_gsup_messages.[ch] to libosmocore This requires the corresponding commit in libosmocore. --- openbsc/include/openbsc/Makefile.am | 2 +- openbsc/include/openbsc/osmo_gsup_messages.h | 139 --------------------------- 2 files changed, 1 insertion(+), 140 deletions(-) delete mode 100644 openbsc/include/openbsc/osmo_gsup_messages.h (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 893c7aa6e..c272b14de 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -15,7 +15,7 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \ bss.h gsm_data_shared.h ipaccess.h mncc_int.h \ arfcn_range_encode.h nat_rewrite_trie.h bsc_nat_callstats.h \ osmux.h mgcp_transcode.h gprs_utils.h \ - gprs_gb_parse.h smpp.h meas_feed.h osmo_gsup_messages.h \ + gprs_gb_parse.h smpp.h meas_feed.h \ gprs_gsup_client.h bsc_msg_filter.h \ oap.h oap_messages.h \ gtphub.h diff --git a/openbsc/include/openbsc/osmo_gsup_messages.h b/openbsc/include/openbsc/osmo_gsup_messages.h deleted file mode 100644 index 8156b739b..000000000 --- a/openbsc/include/openbsc/osmo_gsup_messages.h +++ /dev/null @@ -1,139 +0,0 @@ -/* Osmocom Subscriber Update Protocol message encoder/decoder */ - -/* (C) 2014 by Sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck - * (C) 2016 by Harald Welte - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ -#pragma once - -#include -#include -#include -#include -#include - -/*! Maximum nubmer of PDP inside \ref osmo_gsup_message */ -#define OSMO_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */ -/*! Maximum number of auth info inside \ref osmo_gsup_message */ -#define OSMO_GSUP_MAX_NUM_AUTH_INFO 5 -/*! Maximum number of octets encoding MSISDN in BCD format */ -#define OSMO_GSUP_MAX_MSISDN_LEN 9 - -#define OSMO_GSUP_PDP_TYPE_SIZE 2 - -/*! Information Element Identifiers for GSUP IEs */ -enum osmo_gsup_iei { - OSMO_GSUP_IMSI_IE = 0x01, - OSMO_GSUP_CAUSE_IE = 0x02, - OSMO_GSUP_AUTH_TUPLE_IE = 0x03, - OSMO_GSUP_PDP_INFO_COMPL_IE = 0x04, - OSMO_GSUP_PDP_INFO_IE = 0x05, - OSMO_GSUP_CANCEL_TYPE_IE = 0x06, - OSMO_GSUP_FREEZE_PTMSI_IE = 0x07, - OSMO_GSUP_MSISDN_IE = 0x08, - OSMO_GSUP_HLR_NUMBER_IE = 0x09, - OSMO_GSUP_PDP_CONTEXT_ID_IE = 0x10, - OSMO_GSUP_PDP_TYPE_IE = 0x11, - OSMO_GSUP_ACCESS_POINT_NAME_IE = 0x12, - OSMO_GSUP_PDP_QOS_IE = 0x13, - OSMO_GSUP_RAND_IE = 0x20, - OSMO_GSUP_SRES_IE = 0x21, - OSMO_GSUP_KC_IE = 0x22, - /* 3G support */ - OSMO_GSUP_IK_IE = 0x23, - OSMO_GSUP_CK_IE = 0x24, - OSMO_GSUP_AUTN_IE = 0x25, - OSMO_GSUP_AUTS_IE = 0x26, - OSMO_GSUP_RES_IE = 0x27, -}; - -/*! GSUP message type */ -enum osmo_gsup_message_type { - OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST = 0b00000100, - OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR = 0b00000101, - OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT = 0b00000110, - - OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST = 0b00001000, - OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR = 0b00001001, - OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT = 0b00001010, - - OSMO_GSUP_MSGT_PURGE_MS_REQUEST = 0b00001100, - OSMO_GSUP_MSGT_PURGE_MS_ERROR = 0b00001101, - OSMO_GSUP_MSGT_PURGE_MS_RESULT = 0b00001110, - - OSMO_GSUP_MSGT_INSERT_DATA_REQUEST = 0b00010000, - OSMO_GSUP_MSGT_INSERT_DATA_ERROR = 0b00010001, - OSMO_GSUP_MSGT_INSERT_DATA_RESULT = 0b00010010, - - OSMO_GSUP_MSGT_DELETE_DATA_REQUEST = 0b00010100, - OSMO_GSUP_MSGT_DELETE_DATA_ERROR = 0b00010101, - OSMO_GSUP_MSGT_DELETE_DATA_RESULT = 0b00010110, - - OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST = 0b00011100, - OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR = 0b00011101, - OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT = 0b00011110, -}; - -#define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00) -#define OSMO_GSUP_IS_MSGT_ERROR(msgt) (((msgt) & 0b00000011) == 0b01) -#define OSMO_GSUP_TO_MSGT_ERROR(msgt) (((msgt) & 0b11111100) | 0b01) - -enum osmo_gsup_cancel_type { - OSMO_GSUP_CANCEL_TYPE_UPDATE = 1, /* on wire: 0 */ - OSMO_GSUP_CANCEL_TYPE_WITHDRAW = 2, /* on wire: 1 */ -}; - -/*! parsed/decoded PDP context information */ -struct osmo_gsup_pdp_info { - unsigned int context_id; - int have_info; - /*! Type of PDP context */ - uint16_t pdp_type; - /*! APN information, still in encoded form. Can be NULL if no - * APN information included */ - const uint8_t *apn_enc; - /*! length (in octets) of apn_enc */ - size_t apn_enc_len; - /*! QoS information, still in encoded form. Can be NULL if no - * QoS information included */ - const uint8_t *qos_enc; - /*! length (in octets) of qos_enc */ - size_t qos_enc_len; -}; - -/*! parsed/decoded GSUP protocol message */ -struct osmo_gsup_message { - enum osmo_gsup_message_type message_type; - char imsi[GSM23003_IMSI_MAX_DIGITS+2]; - enum gsm48_gmm_cause cause; - enum osmo_gsup_cancel_type cancel_type; - int pdp_info_compl; - int freeze_ptmsi; - struct osmo_auth_vector auth_vectors[OSMO_GSUP_MAX_NUM_AUTH_INFO]; - size_t num_auth_vectors; - struct osmo_gsup_pdp_info pdp_infos[OSMO_GSUP_MAX_NUM_PDP_INFO]; - size_t num_pdp_infos; - const uint8_t *msisdn_enc; - size_t msisdn_enc_len; - const uint8_t *hlr_enc; - size_t hlr_enc_len; - const uint8_t *auts; -}; - -int osmo_gsup_decode(const uint8_t *data, size_t data_len, - struct osmo_gsup_message *gsup_msg); -void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg); -- cgit v1.2.3 From 31760a1f6089fb59475ba79faa3eb97e4cf00f68 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 27 Apr 2016 15:17:14 +0200 Subject: oap_message.h: Remove dependency to openbsc include This is a first step to moving oap_messages.h to libosmocore --- openbsc/include/openbsc/oap_messages.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/oap_messages.h b/openbsc/include/openbsc/oap_messages.h index b7f4ccada..e76287bae 100644 --- a/openbsc/include/openbsc/oap_messages.h +++ b/openbsc/include/openbsc/oap_messages.h @@ -22,8 +22,8 @@ #pragma once #include +#include #include -#include /* Some numbers are out of sequence because (so far) they match gprs_gsup_iei. */ -- cgit v1.2.3 From 564c06525b9acb3f4b90d4c92970e7d9cc5b1d8e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 27 Apr 2016 18:14:14 +0200 Subject: OAP: use osmo_oap_ prefix for OAP, rather than plain oap_ this is in preparation of moving related code to libosmocore. --- openbsc/include/openbsc/oap.h | 4 ++-- openbsc/include/openbsc/oap_messages.h | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/oap.h b/openbsc/include/openbsc/oap.h index 2370cbe07..2206184d1 100644 --- a/openbsc/include/openbsc/oap.h +++ b/openbsc/include/openbsc/oap.h @@ -25,7 +25,7 @@ #include struct msgb; -struct oap_message; +struct osmo_oap_message; /* This is the config part for vty. It is essentially copied in oap_state, * where values are copied over once the config is considered valid. */ @@ -74,5 +74,5 @@ int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb * /* Allocate a msgb and in it, return the encoded oap_msg. Return NULL on * error. (Like oap_encode(), but also allocates a msgb.) * About the name: the idea is do_something(oap_encoded(my_struct)) */ -struct msgb *oap_encoded(const struct oap_message *oap_msg); +struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg); diff --git a/openbsc/include/openbsc/oap_messages.h b/openbsc/include/openbsc/oap_messages.h index e76287bae..496a6de88 100644 --- a/openbsc/include/openbsc/oap_messages.h +++ b/openbsc/include/openbsc/oap_messages.h @@ -36,7 +36,7 @@ enum oap_iei { OAP_CLIENT_ID_IE = 0x30, }; -enum oap_message_type { +enum osmo_oap_message_type { OAP_MSGT_REGISTER_REQUEST = 0b00000100, OAP_MSGT_REGISTER_ERROR = 0b00000101, OAP_MSGT_REGISTER_RESULT = 0b00000110, @@ -50,8 +50,8 @@ enum oap_message_type { OAP_MSGT_SYNC_RESULT = 0b00001110, }; -struct oap_message { - enum oap_message_type message_type; +struct osmo_oap_message { + enum osmo_oap_message_type message_type; enum gsm48_gmm_cause cause; uint16_t client_id; int rand_present; @@ -64,7 +64,7 @@ struct oap_message { uint8_t auts[16]; }; -int oap_decode(const uint8_t *data, size_t data_len, - struct oap_message *oap_msg); -void oap_encode(struct msgb *msg, const struct oap_message *oap_msg); +int osmo_oap_decode(const uint8_t *data, size_t data_len, + struct osmo_oap_message *oap_msg); +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); -- cgit v1.2.3 From 5d547a4358edbd18744d1996d6ecb40328f09061 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 27 Apr 2016 18:21:16 +0200 Subject: osmo_oap_decode(): Use common argument ordering In general, if a function generates output data like a msgb (or in this case filling an osmo_oap_message structure), the output argument precedes the source. This is what we use all over libosmo*, and it is modelled after memcpy(), where dst is the first argument, before src. Let's align osmo_oap_decode(). Intestingly, osmo_oap_encode was already correct, so the encode/decode functions used different conventions before. --- openbsc/include/openbsc/oap_messages.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/oap_messages.h b/openbsc/include/openbsc/oap_messages.h index 496a6de88..ecb66df34 100644 --- a/openbsc/include/openbsc/oap_messages.h +++ b/openbsc/include/openbsc/oap_messages.h @@ -64,7 +64,7 @@ struct osmo_oap_message { uint8_t auts[16]; }; -int osmo_oap_decode(const uint8_t *data, size_t data_len, - struct osmo_oap_message *oap_msg); +int osmo_oap_decode(struct osmo_oap_message *oap_msg, + const uint8_t *data, size_t data_len); void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); -- cgit v1.2.3