Starting to add functions to the HSS to get K, AMF and OP.

master
Pedro Alvarez 7 years ago
parent 8c28335098
commit ae18da83b2

@ -54,10 +54,8 @@ public:
static hss* get_instance(void); static hss* get_instance(void);
static void cleanup(void); static void cleanup(void);
int init(hss_args_t *hss_args, srslte::logger* logger); int init(hss_args_t *hss_args, srslte::logger* logger);
//bool gen_auth_info_answer(uint64_t imsi); bool get_k_amf_op(uint64_t imsi, uint8_t *k, uint8_t *amf, uint8_t *op);
//bool get_k_amf_op(uint64_t imsi, *k, *amf, *op);
private: private:

@ -40,6 +40,7 @@
#include <map> #include <map>
#include "mme/s1ap_common.h" #include "mme/s1ap_common.h"
#include "mme/s1ap_mngmt_proc.h" #include "mme/s1ap_mngmt_proc.h"
#include "hss/hss.h"
namespace srsepc{ namespace srsepc{
@ -76,6 +77,7 @@ private:
uint32_t m_plmn; uint32_t m_plmn;
srslte::log *m_s1ap_log; srslte::log *m_s1ap_log;
hss *m_hss;
int m_s1mme; int m_s1mme;
std::map<uint16_t,enb_ctx_t*> m_active_enbs; std::map<uint16_t,enb_ctx_t*> m_active_enbs;

@ -0,0 +1,46 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2017 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of srsLTE.
*
* srsLTE 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.
*
* srsLTE 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.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef S1AP_MNGMT_PROC_H
#define S1AP_MNGMT_PROC_H
#include "srslte/asn1/liblte_s1ap.h"
#include "srslte/common/common.h"
#include "mme/s1ap_common.h"
namespace srsepc{
class s1ap_nas_transport
{
public:
s1ap_mngmt_proc(srslte::logger s1ap_logger);
virtual ~s1ap_nas_transport();
bool unpack_initial_ue_message(LIBLTE_S1AP_MESSAGE_S1SETUPREQUEST_STRUCT *msg, uint64_t *imsi);
};
} //namespace srsepc
#endif //S1AP_MNGMT_PROC

@ -77,6 +77,23 @@ hss::init(hss_args_t *hss_args, srslte::logger *logger)
return 0; return 0;
} }
bool
hss::get_k_amf_op(uint64_t imsi, uint8_t *k, uint8_t *amf, uint8_t *op )
{
if(imsi != 1010123456789)
{
return false;
}
else
{
}
//uint8_t k[16];
//uint8_t amf[2]; // 3GPP 33.102 v10.0.0 Annex H
//uint8_t op[16];
return false;
}
} //namespace srsepc } //namespace srsepc

@ -49,7 +49,9 @@ s1ap::init(s1ap_args_t s1ap_args, srslte::log *s1ap_log)
m_s1ap_log = s1ap_log; m_s1ap_log = s1ap_log;
m_s1mme = enb_listen(); m_s1mme = enb_listen();
m_hss = hss::get_instance();
return 0; return 0;
} }
@ -234,11 +236,14 @@ s1ap::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *msg
m_s1ap_log->console("Received Initial UE Message\n"); m_s1ap_log->console("Received Initial UE Message\n");
m_s1ap_log->info("Received Initial UE Message\n"); m_s1ap_log->info("Received Initial UE Message\n");
uint8_t amf[2]; // 3GPP 33.102 v10.0.0 Annex H
uint8_t op[16];
uint8_t k[16];
uint64_t imsi;
LIBLTE_MME_ATTACH_REQUEST_MSG_STRUCT attach_req; LIBLTE_MME_ATTACH_REQUEST_MSG_STRUCT attach_req;
LIBLTE_MME_PDN_CONNECTIVITY_REQUEST_MSG_STRUCT pdn_con_req; LIBLTE_MME_PDN_CONNECTIVITY_REQUEST_MSG_STRUCT pdn_con_req;
/*Get */
/*Get NAS Attach Request Message*/ /*Get NAS Attach Request Message*/
if(!liblte_mme_unpack_attach_request_msg((LIBLTE_BYTE_MSG_STRUCT *) msg->NAS_PDU.buffer, &attach_req)){ if(!liblte_mme_unpack_attach_request_msg((LIBLTE_BYTE_MSG_STRUCT *) msg->NAS_PDU.buffer, &attach_req)){
m_s1ap_log->console("Error unpacking NAS attach request."); m_s1ap_log->console("Error unpacking NAS attach request.");
@ -251,13 +256,13 @@ s1ap::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *msg
m_s1ap_log->warning("NAS Attach Request: Unhandle UE Id Type"); m_s1ap_log->warning("NAS Attach Request: Unhandle UE Id Type");
} }
else{ else{
uint64_t temp = 0; imsi = 0;
for(int i=14;i>=0;i--) for(int i=14;i>=0;i--)
{ {
temp *=10; imsi *=10;
temp += attach_req.eps_mobile_id.imsi[i]; imsi += attach_req.eps_mobile_id.imsi[i];
} }
m_s1ap_log->console("IMSI: %d", temp); m_s1ap_log->console("IMSI: %d", imsi);
} }
if(attach_req.old_p_tmsi_signature_present){} if(attach_req.old_p_tmsi_signature_present){}
@ -326,6 +331,13 @@ s1ap::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *msg
if(msg->LHN_ID_present){ if(msg->LHN_ID_present){
m_s1ap_log->warning("LHN Id present, but not handled."); m_s1ap_log->warning("LHN Id present, but not handled.");
} }
if(!m_hss->get_k_amf_op(imsi, k, amf, op))
{
m_s1ap_log->info("User %d not found",imsi);
}
/* /*
typedef struct{ typedef struct{

@ -0,0 +1,48 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2017 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of srsLTE.
*
* srsLTE 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.
*
* srsLTE 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.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include "mme/s1ap.h"
#include "mme/s1ap_nas_transport.h"
namespace srsepc{
s1ap_nas_transport::s1ap_nas_transport(srslte::logger *s1ap_logger)
{
m_s1ap_logger=s1ap_logger;
}
s1ap_nas_transport::~s1ap_nas_transport()
{
}
bool
s1ap_nas_transport::initial_ue_message(LIBLTE_S1AP_MESSAGE_S1SETUPREQUEST_STRUCT *msg, uint64_t *imsi)
{
return true;
}
} //namespace srsepc
Loading…
Cancel
Save