3#include <vanetza/geonet/data_indication.hpp>
16 switch (gn_ind.upper_protocol) {
17 case geonet::UpperProtocol::BTP_A: {
18 HeaderA hdr = parse_btp_a(packet);
22 case geonet::UpperProtocol::BTP_B: {
23 HeaderB hdr = parse_btp_b(packet);
37 if (hook !=
nullptr) {
38 auto it = std::find(m_promiscuous_hooks.begin(), m_promiscuous_hooks.end(), hook);
39 if (it == m_promiscuous_hooks.end()) {
40 m_promiscuous_hooks.push_back(hook);
47 m_promiscuous_hooks.remove(hook);
54 m_interactive_handlers[port] = handler;
61 m_non_interactive_handlers[port] = handler;
66 std::unique_ptr<UpPacket> packet)
69 boost::optional<
DataIndication> btp_ind = parse_btp_header(gn_ind, *packet);
73 if (btp_ind->source_port) {
74 handler = m_interactive_handlers[btp_ind->destination_port];
76 handler = m_non_interactive_handlers[btp_ind->destination_port];
79 for (PromiscuousHook* hook : m_promiscuous_hooks) {
80 hook->tap_packet(*btp_ind, *packet);
84 handler->indicate(*btp_ind, std::move(packet));
86 hook_undispatched(gn_ind, &btp_ind.get());
89 hook_undispatched(gn_ind,
nullptr);
void add_promiscuous_hook(PromiscuousHook *hook)
void remove_promiscuous_hook(PromiscuousHook *)
void set_interactive_handler(port_type, IndicationInterface *)
void set_non_interactive_handler(port_type, IndicationInterface *)