Changeset 5721
- Timestamp:
- 07/07/10 18:23:55 (3 years ago)
- Location:
- umpa/branches/link-layer-integration/umit/umpa/utils/libpcap
- Files:
-
- 2 modified
-
__init__.py (modified) (2 diffs)
-
wrappers/pypcap.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
umpa/branches/link-layer-integration/umit/umpa/utils/libpcap/__init__.py
r5696 r5721 23 23 24 24 from umit.umpa import config 25 from umit.umpa.utils.exceptions import UMPA SniffingException25 from umit.umpa.utils.exceptions import UMPAPcapException 26 26 27 27 # detect the installed pypcap bindings if not specified by the user … … 48 48 lpcap = __import__(modulepath, fromlist=[None]) 49 49 except ImportError, err: 50 raise UMPA SniffingException("missing/broken libpcap's wrapper '%s': %s" \50 raise UMPAPcapException("missing/broken libpcap's wrapper '%s': %s" \ 51 51 % (config['libpcap'], str(err)) ) 52 52 lpcap._backend = config['libpcap'] 53 53 del modulepath 54 54 else: 55 raise UMPA SniffingException("unsupported/unknown libpcap's wrapper")55 raise UMPAPcapException("unsupported/unknown libpcap's wrapper") -
umpa/branches/link-layer-integration/umit/umpa/utils/libpcap/wrappers/pypcap.py
r5697 r5721 23 23 24 24 from umit.umpa.utils.libpcap.wrappers._abstract import * 25 from umit.umpa.utils.exceptions import UMPA SniffingException25 from umit.umpa.utils.exceptions import UMPAPcapException 26 26 27 27 # see umit.umpa.utils.libpcap.wrappers._abstract for docstrings 28 28 29 29 if not hasattr(pcap, 'pcap'): 30 raise UMPA SniffingException("the installed libpcap library doesn't look like pypcap")30 raise UMPAPcapException("the installed libpcap library doesn't look like pypcap") 31 31 32 32 def lookupdev(): … … 34 34 result = pcap.lookupdev() 35 35 except OSError, msg: 36 raise UMPA SniffingException(msg)36 raise UMPAPcapException(msg) 37 37 return result 38 38 … … 41 41 result = pcap.findalldevs() 42 42 except OSError, msg: 43 raise UMPA SniffingException(msg)43 raise UMPAPcapException(msg) 44 44 return result 45 45 … … 59 59 self.to_ms, immediate=immediate) 60 60 except OSError, msg: 61 raise UMPA SniffingException(msg)61 raise UMPAPcapException(msg) 62 62 63 63 def __iter__(self): … … 83 83 self._pcap.sendpacket(buf) == 0 84 84 except OSError, msg: 85 raise UMPA SniffingException(msg)85 raise UMPAPcapException(msg) 86 86 87 87 return len(buf) … … 116 116 self._dump.open(self._pcap, self.fname) 117 117 except OSError, msg: 118 raise UMPA SniffingException(msg)118 raise UMPAPcapException(msg) 119 119 120 120 def dump(self): 121 121 if not self._dump: 122 raise UMPA SniffingException("not dump file is opened."122 raise UMPAPcapException("not dump file is opened. " 123 123 "use open() first.") 124 124 self._dump.dump() … … 126 126 def flush(self): 127 127 if not self._dump: 128 raise UMPA SniffingException("not dump file is opened."128 raise UMPAPcapException("not dump file is opened. " 129 129 "use open() first.") 130 130 self._dump.flush() … … 132 132 def close(self): 133 133 if not self._dump: 134 raise UMPA SniffingException("not dump file is opened."134 raise UMPAPcapException("not dump file is opened. " 135 135 "use open() first.") 136 136 self._dump.close()
