diff options
Diffstat (limited to 'src/host/layer23/include/osmocom/bb/common/sim.h')
-rw-r--r-- | src/host/layer23/include/osmocom/bb/common/sim.h | 66 |
1 files changed, 61 insertions, 5 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/sim.h b/src/host/layer23/include/osmocom/bb/common/sim.h index 8b1f830c..8aae1fc8 100644 --- a/src/host/layer23/include/osmocom/bb/common/sim.h +++ b/src/host/layer23/include/osmocom/bb/common/sim.h @@ -13,12 +13,14 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ +#pragma once + +#include <osmocom/gsm/protocol/gsm_04_08.h> +#include <osmocom/core/endian.h> + +struct osmocom_ms; /* 9.2 commands */ #define GSM1111_CLASS_GSM 0xa0 @@ -212,6 +214,7 @@ struct gsm1111_response_mfdf { } __attribute__ ((packed)); struct gsm1111_response_mfdf_gsm { +#if OSMO_IS_LITTLE_ENDIAN uint8_t file_char; uint8_t num_df; uint8_t num_ef; @@ -230,10 +233,24 @@ struct gsm1111_response_mfdf_gsm { rfu5:3, unblk2_init:1; uint8_t more_data[0]; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t file_char; + uint8_t num_df; + uint8_t num_ef; + uint8_t num_codes; + uint8_t rfu1; + uint8_t chv1_init:1, rfu2:3, chv1_remain:4; + uint8_t unblk1_init:1, rfu3:3, unblk1_remain:4; + uint8_t chv2_init:1, rfu4:3, chv2_remain:4; + uint8_t unblk2_init:1, rfu5:3, unblk2_remain:4; + uint8_t more_data[0]; +#endif } __attribute__ ((packed)); /* Section 9.2.1 (response to selecting EF) */ struct gsm1111_response_ef { +#if OSMO_IS_LITTLE_ENDIAN uint16_t rfu1; uint16_t file_size; uint16_t file_id; @@ -251,6 +268,20 @@ struct gsm1111_response_ef { rfu4:5; uint8_t length; uint8_t structure; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint16_t rfu1; + uint16_t file_size; + uint16_t file_id; + uint8_t tof; + uint8_t inc_allowed; + uint8_t acc_read:4, acc_update:4; + uint8_t acc_inc:4, rfu2:4; + uint8_t acc_reha:4, acc_inval:4; + uint8_t rfu4:5, ru_inval:1, rfu3:1, not_inval:1; + uint8_t length; + uint8_t structure; +#endif } __attribute__ ((packed)); /* Section 10.3.17 */ @@ -258,9 +289,34 @@ struct gsm1111_ef_loci { uint32_t tmsi; struct gsm48_loc_area_id lai; uint8_t tmsi_time; - uint8_t lupd_status; + uint8_t lupd_status; /* enum gsm1111_ef_loci_lupd_status */ } __attribute__ ((packed)); +enum gsm1111_ef_loci_lupd_status { + GSM1111_EF_LOCI_LUPD_ST_UPDATED = 0, + GSM1111_EF_LOCI_LUPD_ST_NOT_UPDATED = 1, + GSM1111_EF_LOCI_LUPD_ST_PLMN_NOT_ALLOWED = 2, + GSM1111_EF_LOCI_LUPD_ST_LA_NOT_ALLOWED = 3, + GSM1111_EF_LOCI_LUPD_ST_RESERVED = 7, +}; + +/* Section 10.3.33 */ +struct gsm1111_ef_locigprs { + uint32_t ptmsi; + uint16_t ptmsi_sig_hi; + uint8_t ptmsi_sig_lo; + struct gsm48_ra_id rai; + uint8_t rau_status; /* enum gsm1111_ef_locigprs_rau_status */ +} __attribute__ ((packed)); + +enum gsm1111_ef_locigprs_rau_status { + GSM1111_EF_LOCIGPRS_RAU_ST_UPDATED = 0, + GSM1111_EF_LOCIGPRS_RAU_ST_NOT_UPDATED = 1, + GSM1111_EF_LOCIGPRS_RAU_ST_PLMN_NOT_ALLOWED = 2, + GSM1111_EF_LOCIGPRS_RAU_ST_RA_NOT_ALLOWED = 3, + GSM1111_EF_LOCIGPRS_RAU_ST_RESERVED = 7, +}; + /* Section 10.5.1 */ struct gsm1111_ef_adn { uint8_t len_bcd; |