Inherits objects::logic::common::subjectInterface::subjectInterface.
Public Member Functions | |
| def | __init__ |
| def | getDeviceList |
| returns a list of all devices | |
| def | getDeviceProperties |
| returns a dictionary of name/properties | |
| def | startListening |
| starts listening to a device | |
| def | stopListening |
| Stops listening to a device. | |
| def | newPacketNotification |
| This function is called whenever the captureInterface derived class receives a new packet. | |
Public Attributes | |
| networkIface | |
This class is not a singleton. It is just a global variable to the main application object. The networkMonitor is both a subject and an observer. It's an observer of the pcapyImplementation class which feeds it raw network data, and it is a subject in that there several other observers that consume the same raw network data that this class receives.
I debated having the captureInterface also act as a subjectInterface, and thus removing the need for a networkMontior class, but I wanted to separate the two interfaces in the interest of re-usability.
PcapyImplementation--data-->networkMonitor--data-->all_other_observers (storageManager, entityManager)
Definition at line 32 of file networkMonitor.py.
| def objects.logic.network.networkMonitor.networkMonitor.__init__ | ( | self | ) |
Reimplemented from objects.logic.common.subjectInterface.subjectInterface.
Definition at line 33 of file networkMonitor.py.
00033 : 00034 subjectInterface.__init__(self); 00035 self.networkIface = pcapyImplementation() 00036 self.networkIface.registerNotifyCallBack(self) 00037 00038 00039 ## returns a list of all devices
| def objects.logic.network.networkMonitor.networkMonitor.getDeviceList | ( | self | ) |
returns a list of all devices
Definition at line 41 of file networkMonitor.py.
00041 : 00042 return self.networkIface.getDeviceList() 00043 00044 00045 ## returns a dictionary of name/properties
| def objects.logic.network.networkMonitor.networkMonitor.getDeviceProperties | ( | self | ) |
returns a dictionary of name/properties
Definition at line 48 of file networkMonitor.py.
00048 : 00049 devList = self.getDeviceList() 00050 00051 retDict = dict() 00052 00053 # combine device name with its information 00054 for dev in devList: 00055 retDict[dev] = self.networkIface.queryDevice(dev) 00056 00057 return retDict 00058 00059 00060 ## starts listening to a device
| def objects.logic.network.networkMonitor.networkMonitor.newPacketNotification | ( | self, | ||
| header, | ||||
| data, | ||||
| deviceName | ||||
| ) |
This function is called whenever the captureInterface derived class receives a new packet.
| header | Raw DataLink header | |
| data | Raw DataLink frame | |
| deviceName | String representing NPF formatted Device Name |
Definition at line 78 of file networkMonitor.py.
00078 : 00079 self.notifyAll(header, data) 00080 #print header #print header
| def objects.logic.network.networkMonitor.networkMonitor.startListening | ( | self, | ||
| device | ||||
| ) |
starts listening to a device
| device | String representing the device NPF name |
Definition at line 63 of file networkMonitor.py.
00063 : 00064 self.networkIface.startListening(device) 00065 00066 00067 ## Stops listening to a device
| def objects.logic.network.networkMonitor.networkMonitor.stopListening | ( | self | ) |
Stops listening to a device.
Definition at line 69 of file networkMonitor.py.
00069 : 00070 self.networkIface.stopListening() 00071 00072 ## This function is called whenever the captureInterface derived class
Definition at line 35 of file networkMonitor.py.
1.5.8