}
}
+#ifdef FUTURE
// Regardless of the message cursor, extract the key and
// return the key length. Position the cursor just after the key.
static uint8_t read_flow_key(FlowKey* key, HAMessage* msg)
else
return 0;
}
+#endif
static inline uint8_t key_size(Flow* flow)
{
DebugMessage(DEBUG_HA,"HighAvailability::process_update()\n");
// Only looking for side channel processing - FIXIT-H
+ UNUSED(pkthdr); // until we add DAQ communications channel
if ( !sc || !flow )
return;
#ifndef HA_H
#define HA_H
-#include <values.h>
-
#include "main/snort_types.h"
#include "packet_io/sfdaq.h"
#include "side_channel/side_channel.h"
private:
void receive_handler(SCMessage*);
SideChannel* sc = nullptr;
- bool enabled = false;
};
// Top level management of HighAvailability components.
DebugFormat(DEBUG_HA,"HighAvailabilityModule::end(): %s %d\n", fqn, idx);
#else
UNUSED(fqn);
+ UNUSED(idx);
#endif
if ( config.enabled && !HighAvailabilityManager::instantiate(config.ports,config.daq_channel) )
struct SideChannelConfig
{
PortBitSet* ports = nullptr;
- Connector::Direction direction = Connector::CONN_UNDEFINED;
SCConnectors connectors;
};
Direction get_connector_direction() { return CONN_UNDEFINED; }
};
+class ReceiveConnector : public Connector
+{
+ ConnectorMsgHandle* alloc_message(const uint32_t, const uint8_t**) { return nullptr; }
+ void discard_message(ConnectorMsgHandle*) { }
+ bool transmit_message(ConnectorMsgHandle*) { return true; }
+ ConnectorMsgHandle* receive_message(bool) { return nullptr; }
+ ConnectorMsg* get_connector_msg(ConnectorMsgHandle*) { return nullptr; }
+ Direction get_connector_direction() { return CONN_RECEIVE; }
+};
+
+class TransmitConnector : public Connector
+{
+ ConnectorMsgHandle* alloc_message(const uint32_t, const uint8_t**) { return nullptr; }
+ void discard_message(ConnectorMsgHandle*) { }
+ bool transmit_message(ConnectorMsgHandle*) { return true; }
+ ConnectorMsgHandle* receive_message(bool) { return nullptr; }
+ ConnectorMsg* get_connector_msg(ConnectorMsgHandle*) { return nullptr; }
+ Direction get_connector_direction() { return CONN_TRANSMIT; }
+};
+
void ConnectorManager::thread_init() { }
void ConnectorManager::thread_term() { }
Connector* ConnectorManager::get_connector(const std::string connector_name)
-{ UNUSED(connector_name); return new TestConnector(); }
+{
+ if ( connector_name == "U" )
+ return new TestConnector();
+ else if ( connector_name == "R" )
+ return new ReceiveConnector();
+ else if ( connector_name == "T" )
+ return new TransmitConnector();
+ else
+ return nullptr;
+}
void show_stats(PegCount*, const PegInfo*, unsigned, const char*) { }
TEST_GROUP(side_channel)
{
+ void setup()
+ {
+ }
+
+ void teardown()
+ {
+ }
};
TEST(side_channel, test)
flow_con->purge_flows(PktType::UDP);
flow_con->purge_flows(PktType::PDU);
flow_con->purge_flows(PktType::FILE);
+
+ StreamHAManager::tterm();
}
void StreamBase::show(SnortConfig*)
ha_client = new StreamHAClient();
}
+void StreamHAManager::tterm()
+{
+ delete ha_client;
+}
+
void StreamHAManager::process_deletion(Flow*)
{
}
{
public:
ProtocolHA();
+ virtual ~ProtocolHA() { }
virtual void delete_session(Flow*) { }
virtual void create_session(Flow*) { }
virtual void deactivate_session(Flow*) { }
{
public:
static void tinit();
+ static void tterm();
static void process_deletion(Flow*);
static StreamHAClient* ha_client;
UdpHAManager::tinit();
}
+static void udp_tterm()
+{
+ UdpHAManager::tterm();
+}
+
static Inspector* udp_ctor(Module* m)
{
StreamUdpModule* mod = (StreamUdpModule*)m;
nullptr, // init
nullptr, // term
udp_tinit, // tinit
- nullptr, // tterm
+ udp_tterm, // tterm
udp_ctor,
udp_dtor,
udp_ssn,
udp_ha = new UdpHA();
}
+void UdpHAManager::tterm()
+{
+ delete udp_ha;
+}
+
static void process_deletion(Flow* flow)
{ udp_ha->process_deletion(flow); }
static void tinit();
+ static void tterm();
static UdpHA* udp_ha;
};
#endif