|
|
@ -50,6 +50,15 @@ uint8_t auth_request_pdu[] = { 0x07, 0x52, 0x01, 0x0c, 0x63, 0xa8, 0x54, 0x13, 0
|
|
|
|
uint8_t sec_mode_command_pdu[] = { 0x37, 0x37, 0xc7, 0x67, 0xae, 0x00, 0x07, 0x5d, 0x02, 0x01,
|
|
|
|
uint8_t sec_mode_command_pdu[] = { 0x37, 0x37, 0xc7, 0x67, 0xae, 0x00, 0x07, 0x5d, 0x02, 0x01,
|
|
|
|
0x02, 0xe0, 0x60, 0xc1 };
|
|
|
|
0x02, 0xe0, 0x60, 0xc1 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t attach_accept_pdu[] = { 0x27, 0x0f, 0x4f, 0xb3, 0xef, 0x01, 0x07, 0x42, 0x01, 0x3e,
|
|
|
|
|
|
|
|
0x06, 0x00, 0x00, 0xf1, 0x10, 0x00, 0x01, 0x00, 0x2a, 0x52,
|
|
|
|
|
|
|
|
0x01, 0xc1, 0x01, 0x04, 0x1b, 0x07, 0x74, 0x65, 0x73, 0x74,
|
|
|
|
|
|
|
|
0x31, 0x32, 0x33, 0x06, 0x6d, 0x6e, 0x63, 0x30, 0x30, 0x31,
|
|
|
|
|
|
|
|
0x06, 0x6d, 0x63, 0x63, 0x30, 0x30, 0x31, 0x04, 0x67, 0x70,
|
|
|
|
|
|
|
|
0x72, 0x73, 0x05, 0x01, 0xc0, 0xa8, 0x05, 0x02, 0x27, 0x01,
|
|
|
|
|
|
|
|
0x80, 0x50, 0x0b, 0xf6, 0x00, 0xf1, 0x10, 0x80, 0x01, 0x01,
|
|
|
|
|
|
|
|
0x35, 0x16, 0x6d, 0xbc, 0x64, 0x01, 0x00 };
|
|
|
|
|
|
|
|
|
|
|
|
uint16 mcc = 61441;
|
|
|
|
uint16 mcc = 61441;
|
|
|
|
uint16 mnc = 65281;
|
|
|
|
uint16 mnc = 65281;
|
|
|
|
|
|
|
|
|
|
|
@ -71,22 +80,35 @@ public:
|
|
|
|
class rrc_dummy : public rrc_interface_nas
|
|
|
|
class rrc_dummy : public rrc_interface_nas
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
|
|
|
|
rrc_dummy() : last_sdu_len(0) {
|
|
|
|
|
|
|
|
plmns.plmn_id.mcc = mcc;
|
|
|
|
|
|
|
|
plmns.plmn_id.mnc = mnc;
|
|
|
|
|
|
|
|
plmns.tac = 0xffff;
|
|
|
|
|
|
|
|
}
|
|
|
|
void write_sdu(uint32_t lcid, byte_buffer_t *sdu)
|
|
|
|
void write_sdu(uint32_t lcid, byte_buffer_t *sdu)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("NAS generated SDU (len=%d):\n", sdu->N_bytes);
|
|
|
|
|
|
|
|
last_sdu_len = sdu->N_bytes;
|
|
|
|
last_sdu_len = sdu->N_bytes;
|
|
|
|
srslte_vec_fprint_byte(stdout, sdu->msg, sdu->N_bytes);
|
|
|
|
//printf("NAS generated SDU (len=%d):\n", sdu->N_bytes);
|
|
|
|
|
|
|
|
//srslte_vec_fprint_byte(stdout, sdu->msg, sdu->N_bytes);
|
|
|
|
byte_buffer_pool::get_instance()->deallocate(sdu);
|
|
|
|
byte_buffer_pool::get_instance()->deallocate(sdu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::string get_rb_name(uint32_t lcid) { return std::string("lcid"); }
|
|
|
|
std::string get_rb_name(uint32_t lcid) { return std::string("lcid"); }
|
|
|
|
uint32_t get_last_sdu_len() { return last_sdu_len; }
|
|
|
|
uint32_t get_last_sdu_len() { return last_sdu_len; }
|
|
|
|
|
|
|
|
|
|
|
|
int plmn_search(srsue::rrc_interface_nas::found_plmn_t*) { return 0; };
|
|
|
|
int plmn_search(srsue::rrc_interface_nas::found_plmn_t* found) {
|
|
|
|
|
|
|
|
memcpy(found, &plmns, sizeof(found_plmn_t));
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
};
|
|
|
|
void plmn_select(LIBLTE_RRC_PLMN_IDENTITY_STRUCT plmn_id) {};
|
|
|
|
void plmn_select(LIBLTE_RRC_PLMN_IDENTITY_STRUCT plmn_id) {};
|
|
|
|
void set_ue_idenity(LIBLTE_RRC_S_TMSI_STRUCT s_tmsi) {}
|
|
|
|
void set_ue_idenity(LIBLTE_RRC_S_TMSI_STRUCT s_tmsi) {}
|
|
|
|
bool connection_request(LIBLTE_RRC_CON_REQ_EST_CAUSE_ENUM cause,
|
|
|
|
bool connection_request(LIBLTE_RRC_CON_REQ_EST_CAUSE_ENUM cause, srslte::byte_buffer_t *sdu) {
|
|
|
|
srslte::byte_buffer_t *dedicatedInfoNAS) {return true;}
|
|
|
|
printf("NAS generated SDU (len=%d):\n", sdu->N_bytes);
|
|
|
|
bool is_connected() {return true;}
|
|
|
|
last_sdu_len = sdu->N_bytes;
|
|
|
|
|
|
|
|
srslte_vec_fprint_byte(stdout, sdu->msg, sdu->N_bytes);
|
|
|
|
|
|
|
|
byte_buffer_pool::get_instance()->deallocate(sdu);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_connected() {return false;}
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t get_mcc() { return mcc; }
|
|
|
|
uint16_t get_mcc() { return mcc; }
|
|
|
|
uint16_t get_mnc() { return mnc; }
|
|
|
|
uint16_t get_mnc() { return mnc; }
|
|
|
@ -94,6 +116,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
uint32_t last_sdu_len;
|
|
|
|
uint32_t last_sdu_len;
|
|
|
|
|
|
|
|
found_plmn_t plmns;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class gw_dummy : public gw_interface_nas, public gw_interface_pdcp
|
|
|
|
class gw_dummy : public gw_interface_nas, public gw_interface_pdcp
|
|
|
@ -134,15 +157,12 @@ int security_command_test()
|
|
|
|
uint8_t res[16];
|
|
|
|
uint8_t res[16];
|
|
|
|
usim.init(&args, &usim_log);
|
|
|
|
usim.init(&args, &usim_log);
|
|
|
|
|
|
|
|
|
|
|
|
srslte::byte_buffer_pool *pool;
|
|
|
|
|
|
|
|
pool = byte_buffer_pool::get_instance();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
srsue::nas nas;
|
|
|
|
srsue::nas nas;
|
|
|
|
srslte_nas_config_t cfg;
|
|
|
|
srslte_nas_config_t cfg;
|
|
|
|
nas.init(&usim, &rrc_dummy, &gw, &nas_log, cfg);
|
|
|
|
nas.init(&usim, &rrc_dummy, &gw, &nas_log, cfg);
|
|
|
|
|
|
|
|
|
|
|
|
// push auth request PDU to NAS to generate security context
|
|
|
|
// push auth request PDU to NAS to generate security context
|
|
|
|
byte_buffer_t* tmp = pool->allocate();
|
|
|
|
byte_buffer_t* tmp = byte_buffer_pool::get_instance()->allocate();
|
|
|
|
memcpy(tmp->msg, auth_request_pdu, sizeof(auth_request_pdu));
|
|
|
|
memcpy(tmp->msg, auth_request_pdu, sizeof(auth_request_pdu));
|
|
|
|
tmp->N_bytes = sizeof(auth_request_pdu);
|
|
|
|
tmp->N_bytes = sizeof(auth_request_pdu);
|
|
|
|
nas.write_pdu(LCID, tmp);
|
|
|
|
nas.write_pdu(LCID, tmp);
|
|
|
@ -159,7 +179,7 @@ int security_command_test()
|
|
|
|
ret = SRSLTE_SUCCESS;
|
|
|
|
ret = SRSLTE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pool->cleanup();
|
|
|
|
byte_buffer_pool::get_instance()->cleanup();
|
|
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -195,11 +215,21 @@ int mme_attach_request_test()
|
|
|
|
|
|
|
|
|
|
|
|
nas.attach_request();
|
|
|
|
nas.attach_request();
|
|
|
|
|
|
|
|
|
|
|
|
// check length of generated NAS SDU
|
|
|
|
// this will time out in the first place
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// finally push attach accept
|
|
|
|
|
|
|
|
byte_buffer_t* tmp = byte_buffer_pool::get_instance()->allocate();
|
|
|
|
|
|
|
|
memcpy(tmp->msg, attach_accept_pdu, sizeof(attach_accept_pdu));
|
|
|
|
|
|
|
|
tmp->N_bytes = sizeof(attach_accept_pdu);
|
|
|
|
|
|
|
|
nas.write_pdu(LCID, tmp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check length of generated NAS SDU (attach complete)
|
|
|
|
if (rrc_dummy.get_last_sdu_len() > 3) {
|
|
|
|
if (rrc_dummy.get_last_sdu_len() > 3) {
|
|
|
|
ret = SRSLTE_SUCCESS;
|
|
|
|
ret = SRSLTE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte_buffer_pool::get_instance()->cleanup();
|
|
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|