2020-11-26 01:25:22 -08:00
|
|
|
/**
|
2019-04-23 01:53:11 -07:00
|
|
|
*
|
2020-11-26 01:25:22 -08:00
|
|
|
* \section COPYRIGHT
|
2019-04-23 01:53:11 -07:00
|
|
|
*
|
2021-03-19 03:45:56 -07:00
|
|
|
* Copyright 2013-2021 Software Radio Systems Limited
|
2019-04-23 01:53:11 -07:00
|
|
|
*
|
2020-11-26 01:25:22 -08:00
|
|
|
* By using this file, you agree to the terms and conditions set
|
|
|
|
* forth in the LICENSE file which can be found at the top level of
|
|
|
|
* the distribution.
|
2019-04-23 01:53:11 -07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#ifndef SRSRAN_NAS_PCAP_H
|
|
|
|
#define SRSRAN_NAS_PCAP_H
|
2017-11-30 09:09:12 -08:00
|
|
|
|
2021-06-08 00:54:57 -07:00
|
|
|
#include "srsran/common/common.h"
|
2021-03-19 03:45:56 -07:00
|
|
|
#include "srsran/common/pcap.h"
|
2021-02-25 02:17:24 -08:00
|
|
|
#include <string>
|
2017-11-30 09:09:12 -08:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
namespace srsran {
|
2017-11-30 09:09:12 -08:00
|
|
|
|
|
|
|
class nas_pcap
|
|
|
|
{
|
|
|
|
public:
|
2019-12-16 07:04:22 -08:00
|
|
|
nas_pcap()
|
|
|
|
{
|
|
|
|
enable_write = false;
|
|
|
|
ue_id = 0;
|
|
|
|
pcap_file = NULL;
|
|
|
|
}
|
|
|
|
void enable();
|
2021-06-08 00:54:57 -07:00
|
|
|
uint32_t open(std::string filename_, uint32_t ue_id = 0, srsran_rat_t rat_type = srsran_rat_t::lte);
|
2019-12-16 07:04:22 -08:00
|
|
|
void close();
|
|
|
|
void write_nas(uint8_t* pdu, uint32_t pdu_len_bytes);
|
|
|
|
|
2017-11-30 09:09:12 -08:00
|
|
|
private:
|
2021-02-25 02:17:24 -08:00
|
|
|
bool enable_write;
|
|
|
|
std::string filename;
|
|
|
|
FILE* pcap_file;
|
|
|
|
uint32_t ue_id;
|
|
|
|
void pack_and_write(uint8_t* pdu, uint32_t pdu_len_bytes);
|
2017-11-30 09:09:12 -08:00
|
|
|
};
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
} // namespace srsran
|
2017-11-30 09:09:12 -08:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#endif // SRSRAN_NAS_PCAP_H
|