00001 #ifndef _SRCFILTER_H__
00002 #define _SRCFILTER_H__
00003
00004 #include <awds/Firewall.h>
00005 #include <awds/Topology.h>
00006
00007 #include <awds/ext/Shell.h>
00008
00009 #include <map>
00010
00011
00012 namespace awds {
00013
00016 class SrcFilter : public Firewall {
00017
00018 awds::Topology * const topology;
00019
00021 typedef std::map<awds::NodeId, bool> Rules;
00022
00023 Rules rules;
00024
00025 bool default_policy;
00026
00027 public:
00028
00037 int addRules(int argc, const char *const *argv, std::ostream& os);
00038
00044 void dumpRules(std::ostream& os) const;
00045
00048 static int cmd_filter(awds::ShellClient &sc, void *data, int argc, char **argv);
00049
00051 SrcFilter(awds::Topology *topology);
00052
00058 virtual bool check_packet( awds::BasePacket *p);
00059
00061 virtual ~SrcFilter();
00062 };
00063
00064 }
00065
00066
00067 #endif //SRCFILTER_H__
00068
00069
00070
00071
00072
00073