Permalink
Browse files

continued work on portevent, can't access size of the buffer list

without making it public, so I need to add a method to do that.
  • Loading branch information...
1 parent eb9eb16 commit bbebcaecde953ed1a2db7b096321e543b4afabcc @dakrone committed Sep 8, 2008
Showing with 15 additions and 2 deletions.
  1. +14 −2 portevent.cxx
  2. +1 −0 portevent.h
View
@@ -5,6 +5,8 @@
PortEvent::PortEvent()
{
+ /* if a port occurs in less than X percent of all these packets... */
+ low_port_threshold = 5; /* 5% */
}
PortEvent::~PortEvent()
@@ -14,8 +16,18 @@ PortEvent::~PortEvent()
bool PortEvent::process_packet(LIDSBuffer* buff)
{
IN();
- OUTd(false);
- return false;
+ bool threw_alarm = false;
+
+ for (u_int i = 0; i < buff->get_packet_count(); i++) {
+ /*
+ * grab port, add to a list, tell if the list has x% or less of
+ * those ports in the packets
+ */
+ /* do something with the packet */
+ }
+
+ OUTd(threw_alarm);
+ return threw_alarm;
}
char* PortEvent::get_event_name()
View
@@ -14,6 +14,7 @@ class PortEvent: public LIDSEvent {
char* get_event_name();
private:
+ int low_port_threshold;
};

0 comments on commit bbebcae

Please sign in to comment.