Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added statustostr method #55

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

added statustostr method #55

wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 26, 2018

For translating integers to the corresponding warning or error status.

This addition was prompted when I noticed that the Reader.activate function in particular returns an integer and I was unable to find an easy way to use that integer to debug without digging into the libpcap source. This function should allow users to easily translate Error and Warning integers into debug messages.

@ghost
Copy link
Author

ghost commented Aug 4, 2018

See issue #54
This code compiles with ubuntu 16.04, Python 3.7.0, and gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609 and I have run the statustostr and activate functions successfully.

Here are the results of the tests run locally with this compiled code.

pcapy/tests$ python3 pcapytests.py 
testBPFFilter (__main__.TestPcapy) ... ok
testClose (__main__.TestPcapy) ... ok
testContextManager (__main__.TestPcapy) ... ok
testEOFValue (__main__.TestPcapy) ... FAIL
testPacketDumper (__main__.TestPcapy) ... ok
testPacketHeaderRefCount (__main__.TestPcapy) ... ok
test_get_bpf (__main__.TestPcapy) ... ok

======================================================================
FAIL: testEOFValue (__main__.TestPcapy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pcapytests.py", line 52, in testEOFValue
    self.assertEqual(refNone, sys.getrefcount(None))
AssertionError: 5926 != 5923

----------------------------------------------------------------------
Ran 7 tests in 0.002s

FAILED (failures=1)

Here are details on libpcap source (from apt) used to compile this package

Package: libpcap0.8-dev
Version: 1.7.4-2
Priority: optional
Section: libdevel
Source: libpcap
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Romain Francoise <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 715 kB
Depends: libpcap0.8 (= 1.7.4-2), libc6-dev
Conflicts: libpcap-dev (<< 0.9), libpcap0.7-dev
Homepage: http://www.tcpdump.org/
Supported: 9m
Download-Size: 212 kB
APT-Manual-Installed: yes
APT-Sources: http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Description: development library and header files for libpcap0.8
 Headers, static libraries, and documentation for the libpcap library.
 .
 libpcap (Packet CAPture) provides a portable framework for low-level
 network monitoring.  Applications include network statistics
 collection, security monitoring, network debugging, etc.
 .
 Since almost every system vendor provides a different interface for
 packet capture, and since there are several tools that require this
 functionality, the libpcap authors created this system-independent API
 to ease in porting and to alleviate the need for several
 system-dependent packet capture modules in each application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant