Changeset 5721

Show
Ignore:
Timestamp:
07/07/10 18:23:55 (3 years ago)
Author:
kosma
Message:

UMPAPcapException: modify utils.libpcap to use UMPAPcapException

Location:
umpa/branches/link-layer-integration/umit/umpa/utils/libpcap
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • umpa/branches/link-layer-integration/umit/umpa/utils/libpcap/__init__.py

    r5696 r5721  
    2323 
    2424from umit.umpa import config 
    25 from umit.umpa.utils.exceptions import UMPASniffingException 
     25from umit.umpa.utils.exceptions import UMPAPcapException 
    2626 
    2727# detect the installed pypcap bindings if not specified by the user 
     
    4848        lpcap = __import__(modulepath, fromlist=[None]) 
    4949    except ImportError, err: 
    50         raise UMPASniffingException("missing/broken libpcap's wrapper '%s': %s" \ 
     50        raise UMPAPcapException("missing/broken libpcap's wrapper '%s': %s" \ 
    5151                % (config['libpcap'], str(err)) ) 
    5252    lpcap._backend = config['libpcap'] 
    5353    del modulepath 
    5454else: 
    55     raise UMPASniffingException("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  
    2323 
    2424from umit.umpa.utils.libpcap.wrappers._abstract import * 
    25 from umit.umpa.utils.exceptions import UMPASniffingException 
     25from umit.umpa.utils.exceptions import UMPAPcapException 
    2626 
    2727# see umit.umpa.utils.libpcap.wrappers._abstract for docstrings 
    2828 
    2929if not hasattr(pcap, 'pcap'): 
    30     raise UMPASniffingException("the installed libpcap library doesn't look like pypcap") 
     30    raise UMPAPcapException("the installed libpcap library doesn't look like pypcap") 
    3131 
    3232def lookupdev(): 
     
    3434        result = pcap.lookupdev() 
    3535    except OSError, msg: 
    36         raise UMPASniffingException(msg) 
     36        raise UMPAPcapException(msg) 
    3737    return result 
    3838 
     
    4141        result = pcap.findalldevs() 
    4242    except OSError, msg: 
    43         raise UMPASniffingException(msg) 
     43        raise UMPAPcapException(msg) 
    4444    return result 
    4545 
     
    5959                                                self.to_ms, immediate=immediate) 
    6060        except OSError, msg: 
    61             raise UMPASniffingException(msg) 
     61            raise UMPAPcapException(msg) 
    6262 
    6363    def __iter__(self): 
     
    8383            self._pcap.sendpacket(buf) == 0 
    8484        except OSError, msg: 
    85             raise UMPASniffingException(msg) 
     85            raise UMPAPcapException(msg) 
    8686 
    8787        return len(buf) 
     
    116116            self._dump.open(self._pcap, self.fname) 
    117117        except OSError, msg: 
    118             raise UMPASniffingException(msg) 
     118            raise UMPAPcapException(msg) 
    119119 
    120120    def dump(self): 
    121121        if not self._dump: 
    122             raise UMPASniffingException("not dump file is opened." 
     122            raise UMPAPcapException("not dump file is opened. " 
    123123                                        "use open() first.") 
    124124        self._dump.dump() 
     
    126126    def flush(self): 
    127127        if not self._dump: 
    128             raise UMPASniffingException("not dump file is opened." 
     128            raise UMPAPcapException("not dump file is opened. " 
    129129                                        "use open() first.") 
    130130        self._dump.flush() 
     
    132132    def close(self): 
    133133        if not self._dump: 
    134             raise UMPASniffingException("not dump file is opened." 
     134            raise UMPAPcapException("not dump file is opened. " 
    135135                                        "use open() first.") 
    136136        self._dump.close()