File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -97,13 +97,29 @@ void NdpPacketReader::init(const char *params)
9797 m_ctt_metadata = true ;
9898 }
9999 init_ifc (parser.m_dev );
100+ m_device = parser.m_dev ;
100101}
101102
102103void NdpPacketReader::close ()
103104{
104105 ndpReader.close ();
105106}
106107
108+ #ifdef WITH_CTT
109+ std::pair<std::string, unsigned > NdpPacketReader::get_ctt_config () const
110+ {
111+ std::string dev = m_device;
112+ int channel_id = 0 ;
113+ std::size_t delimiter_found = m_device.find_last_of (" :" );
114+ if (delimiter_found != std::string::npos) {
115+ std::string channel_str = m_device.substr (delimiter_found + 1 );
116+ dev = m_device.substr (0 , delimiter_found);
117+ channel_id = std::stoi (channel_str);
118+ }
119+ return std::make_pair (dev, channel_id);
120+ }
121+ #endif /* WITH_CTT */
122+
107123void NdpPacketReader::init_ifc (const std::string &dev)
108124{
109125 if (ndpReader.init_interface (dev) != 0 ) {
Original file line number Diff line number Diff line change @@ -73,6 +73,10 @@ class NdpPacketReader : public InputPlugin
7373 std::shared_ptr<telemetry::Directory> plugin_dir,
7474 std::shared_ptr<telemetry::Directory> queues_dir) override ;
7575
76+ #ifdef WITH_CTT
77+ virtual std::pair<std::string, unsigned > get_ctt_config () const override ;
78+ #endif /* WITH_CTT */
79+
7680private:
7781 struct RxStats {
7882 uint64_t receivedPackets;
@@ -87,6 +91,8 @@ class NdpPacketReader : public InputPlugin
8791
8892 bool m_ctt_metadata = false ;
8993
94+ std::string m_device;
95+
9096 void init_ifc (const std::string &dev);
9197 int parse_ctt_metadata (const ndp_packet *ndp_packet, Metadata_CTT &ctt);
9298};
You can’t perform that action at this time.
0 commit comments