nas: add helper to pack attach request and send to RRC

This commit is contained in:
Andre Puschmann 2020-03-29 12:26:32 +02:00
parent cf28276a3a
commit d8680cc9a8
2 changed files with 22 additions and 1 deletions

View File

@ -210,6 +210,7 @@ private:
void send_authentication_failure(const uint8_t cause, const uint8_t* auth_fail_param);
void gen_pdn_connectivity_request(LIBLTE_BYTE_MSG_STRUCT* msg);
void send_security_mode_reject(uint8_t cause);
void send_attach_request();
void send_detach_request(bool switch_off);
void send_detach_accept();
void send_activate_dedicated_eps_bearer_context_accept(const uint8_t& proc_transaction_id,

View File

@ -356,7 +356,13 @@ void nas::timer_expired(uint32_t timeout_id)
}
} else if (timeout_id == t3411.id()) {
nas_log->info("Timer T3411 expired: trying to attach again\n");
start_attach_proc(nullptr, srslte::establishment_cause_t::mo_sig);
if (rrc->is_connected()) {
// send attach request through established RRC connection
send_attach_request();
} else {
// start attach procedure
start_attach_proc(nullptr, srslte::establishment_cause_t::mo_sig);
}
} else if (timeout_id == t3421.id()) {
nas_log->info("Timer T3421 expired: entering EMM_STATE_DEREGISTERED\n");
// TODO: TS 24.301 says to resend detach request but doesn't say how often before entering EMM_STATE_DEREGISTERED
@ -1826,6 +1832,20 @@ void nas::send_security_mode_reject(uint8_t cause)
rrc->write_sdu(std::move(msg));
}
/**
* Pack attach request message and send to RRC for transmission.
*/
void nas::send_attach_request()
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
if (!pdu) {
nas_log->error("Fatal Error: Couldn't allocate PDU in %s().\n", __FUNCTION__);
return;
}
gen_attach_request(pdu);
rrc->write_sdu(std::move(pdu));
}
void nas::send_detach_request(bool switch_off)
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);