|
The Pedigree Project
0.1
|
#include <Filter.h>
Collaboration diagram for NetworkFilter:Public Member Functions | |
| NetworkFilter () | |
| Default constructor, boring. | |
| virtual | ~NetworkFilter () |
| Destructor, also boring. | |
| bool | filter (size_t level, uintptr_t packet, size_t sz) |
| size_t | installCallback (size_t level, bool(*callback)(uintptr_t, size_t)) |
| void | removeCallback (size_t level, size_t id) |
Static Public Member Functions | |
| static NetworkFilter & | instance () |
Private Attributes | |
| Tree< size_t, List< void * > * > | m_Callbacks |
| Level -> Callback list mapping. | |
Static Private Attributes | |
| static NetworkFilter | m_Instance |
Provides an interface for filtering network packets as they come in to the system.
| bool NetworkFilter::filter | ( | size_t | level, |
| uintptr_t | packet, | ||
| size_t | sz | ||
| ) |
Passes a Level n packet to filter callbacks. Level 1 is the lowest level, handling for example Ethernet frames. Level 2 handles the Level 1 payload. ARP, IP, and other low-level protocols are handled here. Level 3 handles the Level 2 payload. TCP, UDP, ICMP, etc... Level 4 handles the Level 3 payload. Specific application protocols such as FTP, DNS.
| level | Level of callback to call |
| packet | Packet buffer, can be modified by callbacks |
| size | Size of the packet. Can NOT be modified by callbacks |
Definition at line 35 of file Filter.cc.
References List< T, nodePoolSize >::begin(), List< T, nodePoolSize >::end(), Tree< K, E >::lookup(), and m_Callbacks.
| size_t NetworkFilter::installCallback | ( | size_t | level, |
| bool(*)(uintptr_t, size_t) | callback | ||
| ) |
Installs a callback for a specific level.
Definition at line 63 of file Filter.cc.
References List< T, nodePoolSize >::count(), Dec, ERROR, Hex, Tree< K, E >::insert(), Tree< K, E >::lookup(), m_Callbacks, and List< T, nodePoolSize >::pushBack().
|
inlinestatic |
The design pattern everyone loves to hate!
Definition at line 40 of file Filter.h.
Referenced by NetworkStack::receive().
Here is the caller graph for this function:| void NetworkFilter::removeCallback | ( | size_t | level, |
| size_t | id | ||
| ) |
1.8.11