enb,s1ap: print filename when writing S1AP PCAP

master
Andre Puschmann 3 years ago
parent e8a464228d
commit b127327684

@ -14,25 +14,23 @@
#define SRSRAN_S1AP_PCAP_H #define SRSRAN_S1AP_PCAP_H
#include "srsran/common/pcap.h" #include "srsran/common/pcap.h"
#include <string>
namespace srsran { namespace srsran {
class s1ap_pcap class s1ap_pcap
{ {
public: public:
s1ap_pcap() s1ap_pcap() = default;
{
enable_write = false;
pcap_file = NULL;
}
void enable(); void enable();
void open(const char* filename); void open(const char* filename_);
void close(); void close();
void write_s1ap(uint8_t* pdu, uint32_t pdu_len_bytes); void write_s1ap(uint8_t* pdu, uint32_t pdu_len_bytes);
private: private:
bool enable_write; bool enable_write = false;
FILE* pcap_file; std::string filename;
FILE* pcap_file = nullptr;
}; };
} // namespace srsran } // namespace srsran

@ -21,14 +21,15 @@ void s1ap_pcap::enable()
{ {
enable_write = true; enable_write = true;
} }
void s1ap_pcap::open(const char* filename) void s1ap_pcap::open(const char* filename_)
{ {
pcap_file = DLT_PCAP_Open(S1AP_LTE_DLT, filename); filename = filename_;
pcap_file = DLT_PCAP_Open(S1AP_LTE_DLT, filename.c_str());
enable_write = true; enable_write = true;
} }
void s1ap_pcap::close() void s1ap_pcap::close()
{ {
fprintf(stdout, "Saving S1AP PCAP file\n"); fprintf(stdout, "Saving S1AP PCAP file (DLT=%d) to %s\n", S1AP_LTE_DLT, filename.c_str());
DLT_PCAP_Close(pcap_file); DLT_PCAP_Close(pcap_file);
} }

Loading…
Cancel
Save