enb,s1ap: print filename when writing S1AP PCAP

This commit is contained in:
Andre Puschmann 2021-09-16 11:53:47 +02:00
parent e8a464228d
commit b127327684
2 changed files with 10 additions and 11 deletions

View File

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

View File

@ -21,14 +21,15 @@ void s1ap_pcap::enable()
{
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;
}
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);
}