summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/include/osmocom/bb
diff options
context:
space:
mode:
authorAndreas.Eversberg2010-08-28 11:46:36 +0200
committerAndreas.Eversberg2010-08-28 11:46:36 +0200
commitf20a1c3de81e9bd807534a384fb62c6062fe28c2 (patch)
tree0561492f263bb8bc6f072574263ecd3b12598728 /src/host/layer23/include/osmocom/bb
parent[layer23] Adding SIM client (diff)
downloadosmocom-f20a1c3de81e9bd807534a384fb62c6062fe28c2.tar.gz
osmocom-f20a1c3de81e9bd807534a384fb62c6062fe28c2.tar.xz
osmocom-f20a1c3de81e9bd807534a384fb62c6062fe28c2.zip
[layer23] Layer 3 now uses SIM client to request and update SIM data
The SIM reader can be selected via VTY, but because it is not yet implemented in layer1, nothing happens when selecting it.
Diffstat (limited to 'src/host/layer23/include/osmocom/bb')
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h2
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/settings.h2
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/subscriber.h41
3 files changed, 33 insertions, 12 deletions
diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h b/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h
index 68c00d4..e8b44dc 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h
@@ -187,6 +187,8 @@ struct msgb *gsm48_l3_msgb_alloc(void);
struct msgb *gsm48_rr_msgb_alloc(int msg_type);
int gsm48_decode_lai(struct gsm48_loc_area_id *lai, uint16_t *mcc,
uint16_t *mnc, uint16_t *lac);
+int gsm48_encode_lai(struct gsm48_loc_area_id *lai, uint16_t mcc,
+ uint16_t mnc, uint16_t lac);
int gsm48_rr_enc_cm2(struct osmocom_ms *ms, struct gsm48_classmark2 *cm);
int gsm48_rr_tx_rand_acc(struct osmocom_ms *ms, struct msgb *msg);
int gsm48_rr_los(struct osmocom_ms *ms);
diff --git a/src/host/layer23/include/osmocom/bb/mobile/settings.h b/src/host/layer23/include/osmocom/bb/mobile/settings.h
index be13d20..2dc6220 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/settings.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/settings.h
@@ -11,7 +11,7 @@ struct gsm_settings {
int plmn_mode; /* PLMN_MODE_* */
/* SIM */
- int simtype; /* selects card on power on */
+ int sim_type; /* selects card on power on */
char emergency_imsi[20]; /* just in case... */
/* test card simulator settings */
diff --git a/src/host/layer23/include/osmocom/bb/mobile/subscriber.h b/src/host/layer23/include/osmocom/bb/mobile/subscriber.h
index 34f4528..cf0e5ac 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/subscriber.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/subscriber.h
@@ -22,32 +22,37 @@ struct gsm_sub_plmn_na {
enum {
GSM_SIM_TYPE_NONE = 0,
- GSM_SIM_TYPE_SLOT,
+ GSM_SIM_TYPE_READER,
GSM_SIM_TYPE_TEST
};
+/* state of reading SIM */
+enum {
+ SUBSCR_SIM_NULL = 0,
+};
+
struct gsm_subscriber {
struct osmocom_ms *ms;
/* status */
+ uint8_t sim_type; /* type of sim */
uint8_t sim_valid; /* sim inserted and valid */
uint8_t ustate; /* update status */
uint8_t imsi_attached; /* attached state */
- /* LAI */
- uint8_t lai_valid;
- uint16_t lai_mcc, lai_mnc, lai_lac;
-
- /* IMSI */
+ /* IMSI & co */
char imsi[GSM_IMSI_LENGTH];
+ char msisdn[31]; /* may include access codes */
+ char iccid[21]; /* 20 + termination */
+
+ /* TMSI / LAI */
+ uint32_t tmsi; /* invalid tmsi: 0xffffffff */
+ uint16_t mcc, mnc, lac; /* invalid lac: 0x0000 */
- /* TMSI */
- uint8_t tmsi_valid;
- uint32_t tmsi;
/* key */
uint8_t key_seq; /* ciphering key sequence number */
- uint8_t key[32]; /* up to 256 bit */
+ uint8_t key[64]; /* 64 bit */
/* other */
struct llist_head plmn_list; /* PLMN Selector field */
@@ -57,7 +62,8 @@ struct gsm_subscriber {
/* special things */
uint8_t always_search_hplmn;
/* search hplmn in other countries also (for test cards) */
- char sim_name[32]; /* name to load/save sim */
+ char sim_name[31]; /* name to load/save sim */
+ char sim_spn[17]; /* name of service privider */
/* PLMN last registered */
uint8_t plmn_valid;
@@ -66,11 +72,24 @@ struct gsm_subscriber {
/* our access */
uint8_t acc_barr; /* if we may access, if cell barred */
uint16_t acc_class; /* bitmask of what we may access */
+
+ /* talk to SIM */
+ uint8_t sim_state;
+ uint8_t sim_pin_required; /* state: wait for PIN */
+ uint8_t sim_file_index;
+ uint32_t sim_handle_query;
+ uint32_t sim_handle_update;
+ uint32_t sim_handle_key;
};
int gsm_subscr_init(struct osmocom_ms *ms);
int gsm_subscr_exit(struct osmocom_ms *ms);
int gsm_subscr_testcard(struct osmocom_ms *ms, uint16_t mcc, uint16_t mnc);
+int gsm_subscr_simcard(struct osmocom_ms *ms);
+void gsm_subscr_sim_pin(struct osmocom_ms *ms, char *pin);
+int gsm_subscr_write_loci(struct osmocom_ms *ms);
+int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq,
+ uint8_t *rand);
int gsm_subscr_remove(struct osmocom_ms *ms);
void new_sim_ustate(struct gsm_subscriber *subscr, int state);
int gsm_subscr_del_forbidden_plmn(struct gsm_subscriber *subscr, uint16_t mcc,