Changing user_db.csv to allow users to choose OP/OPc.

master
Pedro Alvarez 6 years ago
parent a839817790
commit 0d61011d13

@ -54,11 +54,13 @@ typedef struct{
typedef struct{ typedef struct{
std::string name; std::string name;
uint64_t imsi; uint64_t imsi;
uint8_t key[16]; uint8_t key[16];
uint8_t op[16]; bool op_configured;
uint8_t amf[2]; uint8_t op[16];
uint8_t sqn[6]; uint8_t opc[16];
uint8_t last_rand[16]; uint8_t amf[2];
uint8_t sqn[6];
uint8_t last_rand[16];
}hss_ue_ctx_t; }hss_ue_ctx_t;
enum hss_auth_algo { enum hss_auth_algo {

@ -166,10 +166,12 @@ hss::read_db_file(std::string db_filename)
get_uint_vec_from_hex_str(split[2],ue_ctx->key,16); get_uint_vec_from_hex_str(split[2],ue_ctx->key,16);
if(split[3] == std::string("op")) if(split[3] == std::string("op"))
{ {
ue_ctx->op_configured = true;
get_uint_vec_from_hex_str(split[4],ue_ctx->op,16); get_uint_vec_from_hex_str(split[4],ue_ctx->op,16);
} }
else if (split[3] == std::string("opc")) else if (split[3] == std::string("opc"))
{ {
ue_ctx->op_configured =false;
get_uint_vec_from_hex_str(split[4],ue_ctx->op,16); get_uint_vec_from_hex_str(split[4],ue_ctx->op,16);
} }
else else
@ -239,6 +241,12 @@ bool hss::write_db_file(std::string db_filename)
m_db_file << ","; m_db_file << ",";
m_db_file << hex_string(it->second->key, 16); m_db_file << hex_string(it->second->key, 16);
m_db_file << ","; m_db_file << ",";
if(it->second->op_configured){
m_db_file << "op,";
}
else{
m_db_file << "opc,";
}
m_db_file << hex_string(it->second->op, 16); m_db_file << hex_string(it->second->op, 16);
m_db_file << ","; m_db_file << ",";
m_db_file << hex_string(it->second->amf, 2); m_db_file << hex_string(it->second->amf, 2);

Loading…
Cancel
Save