Changeset 4815

Show
Ignore:
Timestamp:
05/24/09 02:38:22 (4 years ago)
Author:
getxsick
Message:

add findalldevs() support and suitable tests.

NOTE: it works only with modified pypcap.
I will try to commit it to pypcap's trunk soon.

Location:
branch/UMPA
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branch/UMPA/tests/unit/test_sniffing/test_libpcap/test_pypcap.py

    r4810 r4815  
    6363                        "propably not sufficent priviliges.") 
    6464 
     65    def test_findalldevs(self): 
     66        try: 
     67            assert pypcap.findalldevs() == pcap.findalldevs() 
     68        except UMPASniffingException: 
     69            py.test.skip("no suitable devices for sniffing found. " 
     70                        "propably not sufficent priviliges.") 
     71 
    6572    def test_loop_and_filter(self): 
    6673        # XXX it would rather looped than failing 
  • branch/UMPA/umpa/sniffing/libpcap/pypcap.py

    r4810 r4815  
    3939    return result 
    4040 
     41def findalldevs(): 
     42    try: 
     43        result = pcap.findalldevs() 
     44    except OSError, msg: 
     45        raise UMPASniffingException(msg) 
     46    return result 
     47 
    4148class open_live(open_live): 
    4249    def __init__(self, device=None, snaplen=1024, promisc=True, to_ms=0):