add getter for IPv4 and IPv6 addresses

master
Andre Puschmann 6 years ago
parent 9681ead26f
commit 1ed225a10b

@ -140,6 +140,8 @@ public:
virtual void write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu) = 0;
virtual uint32_t get_ul_count() = 0;
virtual bool get_k_asme(uint8_t *k_asme_, uint32_t n) = 0;
virtual uint32_t get_ipv4_addr() = 0;
virtual bool get_ipv6_addr(uint8_t *ipv6_addr) = 0;
};
// NAS interface for UE

@ -88,6 +88,8 @@ public:
uint32_t get_ul_count();
bool is_attached();
bool get_k_asme(uint8_t *k_asme_, uint32_t n);
uint32_t get_ipv4_addr();
bool get_ipv6_addr(uint8_t *ipv6_addr);
// UE interface
bool attach_request();

@ -54,6 +54,7 @@ nas::nas()
ctxt.integ_algo = INTEGRITY_ALGORITHM_ID_EIA0;
plmn_is_selected = false;
chap_id = 0;
memset(ipv6_if_id, 0, sizeof(ipv6_if_id));
}
void nas::init(usim_interface_nas *usim_,
@ -411,6 +412,21 @@ bool nas::get_k_asme(uint8_t *k_asme_, uint32_t n) {
return true;
}
uint32_t nas::get_ipv4_addr()
{
return ip_addr;
}
bool nas::get_ipv6_addr(uint8_t *ipv6_addr)
{
uint8_t null_addr[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
if (memcmp(ipv6_addr, null_addr, 8) != 0) {
memcpy(ipv6_addr, ipv6_if_id, 8);
return true;
}
return false;
}
/*******************************************************************************
PCAP
*******************************************************************************/

Loading…
Cancel
Save