mirror of https://github.com/PentHertz/srsLTE.git
Starting to add OPc option to HSS.
This commit is contained in:
parent
75c5e476f1
commit
a839817790
|
@ -154,18 +154,32 @@ hss::read_db_file(std::string db_filename)
|
|||
if(line[0] != '#')
|
||||
{
|
||||
std::vector<std::string> split = split_string(line,',');
|
||||
if(split.size()!=6)
|
||||
if(split.size()!=7)
|
||||
{
|
||||
m_hss_log->error("Error parsing UE database\n");
|
||||
m_hss_log->error("Error parsing UE database. Wrong number of columns in .csv\n");
|
||||
m_hss_log->error("Columns: %d\n",split.size());
|
||||
return false;
|
||||
}
|
||||
hss_ue_ctx_t *ue_ctx = new hss_ue_ctx_t;
|
||||
ue_ctx->name = split[0];
|
||||
ue_ctx->imsi = atoll(split[1].c_str());
|
||||
get_uint_vec_from_hex_str(split[2],ue_ctx->key,16);
|
||||
get_uint_vec_from_hex_str(split[3],ue_ctx->op,16);
|
||||
get_uint_vec_from_hex_str(split[4],ue_ctx->amf,2);
|
||||
get_uint_vec_from_hex_str(split[5],ue_ctx->sqn,6);
|
||||
if(split[3] == std::string("op"))
|
||||
{
|
||||
get_uint_vec_from_hex_str(split[4],ue_ctx->op,16);
|
||||
}
|
||||
else if (split[3] == std::string("opc"))
|
||||
{
|
||||
get_uint_vec_from_hex_str(split[4],ue_ctx->op,16);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hss_log->error("Neither OP nor OPc configured.\n");
|
||||
return false;
|
||||
}
|
||||
get_uint_vec_from_hex_str(split[4],ue_ctx->op,16);
|
||||
get_uint_vec_from_hex_str(split[5],ue_ctx->amf,2);
|
||||
get_uint_vec_from_hex_str(split[6],ue_ctx->sqn,6);
|
||||
|
||||
m_hss_log->debug("Added user from DB, IMSI: %015lu\n", ue_ctx->imsi);
|
||||
m_hss_log->debug_hex(ue_ctx->key, 16, "User Key : ");
|
||||
|
@ -202,6 +216,20 @@ bool hss::write_db_file(std::string db_filename)
|
|||
}
|
||||
m_hss_log->info("Opened DB file: %s\n", db_filename.c_str() );
|
||||
|
||||
//Write comment info
|
||||
m_db_file << "#" << std::endl
|
||||
<< "# .csv to store UE's information in HSS" << std::endl
|
||||
<< "# Kept in the following format: \"Name,IMSI,Key,OP,AMF\"" << std::endl
|
||||
<< "#" << std::endl
|
||||
<< "# Name: Human readable name to help distinguish UE's. Ignored by the HSS" << std::endl
|
||||
<< "# IMSI: UE's IMSI value" << std::endl
|
||||
<< "# Key: UE's key, where other keys are derived from. Stored in hexadecimal" << std::endl
|
||||
<< "# OP: Operator's code, sotred in hexadecimal" << std::endl
|
||||
<< "# AMF: Authentication management field, stored in hexadecimal" << std::endl
|
||||
<< "# SQN: UE's Sequence number for freshness of the authentication" << std::endl
|
||||
<< "#" << std::endl
|
||||
<< "# Note: Lines starting by '#' are ignored" << std::endl;
|
||||
|
||||
std::map<uint64_t,hss_ue_ctx_t*>::iterator it = m_imsi_to_ue_ctx.begin();
|
||||
while(it!=m_imsi_to_ue_ctx.end())
|
||||
{
|
||||
|
|
|
@ -10,5 +10,5 @@
|
|||
# SQN: UE's Sequence number for freshness of the authentication
|
||||
#
|
||||
# Note: Lines starting by '#' are ignored
|
||||
ue1,001010123456789,00112233445566778899aabbccddeeff,63BFA50EE6523365FF14C1F45F88737D,9001,000000001234
|
||||
ue2,001010123456780,00112233445566778899aabbccddeeaa,63BFA50EE6523365FF14C1F45F88737D,8000,000000001235
|
||||
ue1,001010123456789,00112233445566778899aabbccddeeff,op,63bfa50ee6523365ff14c1f45f88737d,9001,000000001234
|
||||
ue2,001010123456780,00112233445566778899aabbccddeeff,opc,63bfa50ee6523365ff14c1f45f88737d,8000,000000001234
|
||||
|
|
Loading…
Reference in New Issue