|
|
@ -13,10 +13,22 @@
|
|
|
|
#include "srsran/common/nas_pcap.h"
|
|
|
|
#include "srsran/common/nas_pcap.h"
|
|
|
|
#include "srsran/common/pcap.h"
|
|
|
|
#include "srsran/common/pcap.h"
|
|
|
|
#include "srsran/srsran.h"
|
|
|
|
#include "srsran/srsran.h"
|
|
|
|
|
|
|
|
#include "srsran/support/emergency_handlers.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace srsran {
|
|
|
|
namespace srsran {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Try to flush the contents of the pcap class before the application is killed.
|
|
|
|
|
|
|
|
static void emergency_cleanup_handler(void* data)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
reinterpret_cast<nas_pcap*>(data)->close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nas_pcap::nas_pcap()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
add_emergency_cleanup_handler(emergency_cleanup_handler, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nas_pcap::enable()
|
|
|
|
void nas_pcap::enable()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
enable_write = true;
|
|
|
|
enable_write = true;
|
|
|
@ -42,6 +54,7 @@ void nas_pcap::close()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fprintf(stdout, "Saving NAS PCAP file (DLT=%d) to %s \n", NAS_LTE_DLT, filename.c_str());
|
|
|
|
fprintf(stdout, "Saving NAS PCAP file (DLT=%d) to %s \n", NAS_LTE_DLT, filename.c_str());
|
|
|
|
DLT_PCAP_Close(pcap_file);
|
|
|
|
DLT_PCAP_Close(pcap_file);
|
|
|
|
|
|
|
|
pcap_file = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nas_pcap::write_nas(uint8_t* pdu, uint32_t pdu_len_bytes)
|
|
|
|
void nas_pcap::write_nas(uint8_t* pdu, uint32_t pdu_len_bytes)
|
|
|
|