View | Details | Raw Unified | Return to bug 217372 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-2 / +9 lines)
Lines 5-20 Link Here
5
PORTVERSION=	1.1
5
PORTVERSION=	1.1
6
PORTREVISION=	5
6
PORTREVISION=	5
7
CATEGORIES=	net python
7
CATEGORIES=	net python
8
MASTER_SITES=	GOOGLE_CODE
9
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
10
9
11
MAINTAINER=	wxs@FreeBSD.org
10
MAINTAINER=	wxs@FreeBSD.org
12
COMMENT=	Simplified object-oriented Python extension module for libpcap
11
COMMENT=	Simplified object-oriented Python extension module for libpcap
13
12
14
BROKEN=		Unfetchable (google code has gone away)
13
LICENSE=	BSD3CLAUSE
14
LICENSE_FILE=	${WRKSRC}/LICENSE
15
15
16
BUILD_DEPENDS=	pyrexc:devel/pyrex
16
BUILD_DEPENDS=	pyrexc:devel/pyrex
17
17
18
USE_GITHUB=	yes
19
GH_ACCOUNT=	dugsong
20
GH_TAGNAME=	PYPCAP_${PORTVERSION:S/./_/g}
21
18
USES=		python
22
USES=		python
19
USE_PYTHON=	distutils autoplist
23
USE_PYTHON=	distutils autoplist
20
24
Lines 24-27 Link Here
24
pre-build:
28
pre-build:
25
	(cd ${WRKSRC}; pyrexc pcap.pyx)
29
	(cd ${WRKSRC}; pyrexc pcap.pyx)
26
30
31
post-install:
32
	@${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/pcap.so
33
27
.include <bsd.port.mk>
34
.include <bsd.port.mk>
(-)distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (pypcap-1.1.tar.gz) = 087677295c795f543fad2c286df1807d55876e85d04f7292335cd149f4d8d47f
1
TIMESTAMP = 1488113926
2
SIZE (pypcap-1.1.tar.gz) = 22951
2
SHA256 (dugsong-pypcap-1.1-PYPCAP_1_1_GH0.tar.gz) = a75d165f70a71e6c14c46b77c1b9b7a395fa425d0f90a2e342e641c66c14e634
3
SIZE (dugsong-pypcap-1.1-PYPCAP_1_1_GH0.tar.gz) = 22812
(-)files/patch-pcap.pyx (-25 / +16 lines)
Lines 1-15 Link Here
1
--- ./pcap.pyx.orig	2011-10-01 22:35:33.141146678 -0400
1
--- pcap.pyx.orig	2005-10-17 00:08:17 UTC
2
+++ ./pcap.pyx	2011-10-01 22:35:39.416147272 -0400
2
+++ pcap.pyx
3
@@ -1,7 +1,7 @@
3
@@ -17,9 +17,11 @@ __url__ = 'http://monkey.org/~dugsong/py
4
 #
5
 # pcap.pyx
6
 #
7
-# $Id: pcap.pyx,v 1.20 2005/10/16 23:00:11 dugsong Exp $
8
+# $Id: pcap.pyx 101 2010-07-16 08:20:16Z kosma@kosma.pl $
9
 
10
 """packet capture library
11
 
12
@@ -17,9 +17,11 @@
13
 __version__ = '1.1'
4
 __version__ = '1.1'
14
 
5
 
15
 import sys
6
 import sys
Lines 21-27 Link Here
21
     int    PyGILState_Ensure()
12
     int    PyGILState_Ensure()
22
     void   PyGILState_Release(int gil)
13
     void   PyGILState_Release(int gil)
23
     void   Py_BEGIN_ALLOW_THREADS()
14
     void   Py_BEGIN_ALLOW_THREADS()
24
@@ -42,6 +44,10 @@
15
@@ -42,6 +44,10 @@ cdef extern from "pcap.h":
25
         unsigned int caplen
16
         unsigned int caplen
26
     ctypedef struct pcap_t:
17
     ctypedef struct pcap_t:
27
         int __xxx
18
         int __xxx
Lines 32-38 Link Here
32
 
23
 
33
 ctypedef void (*pcap_handler)(void *arg, pcap_pkthdr *hdr, char *pkt)
24
 ctypedef void (*pcap_handler)(void *arg, pcap_pkthdr *hdr, char *pkt)
34
 
25
 
35
@@ -62,6 +68,13 @@
26
@@ -62,6 +68,13 @@ cdef extern from "pcap.h":
36
     char   *pcap_geterr(pcap_t *p)
27
     char   *pcap_geterr(pcap_t *p)
37
     void    pcap_close(pcap_t *p)
28
     void    pcap_close(pcap_t *p)
38
     int     bpf_filter(bpf_insn *insns, char *buf, int len, int caplen)
29
     int     bpf_filter(bpf_insn *insns, char *buf, int len, int caplen)
Lines 46-52 Link Here
46
 
37
 
47
 cdef extern from "pcap_ex.h":
38
 cdef extern from "pcap_ex.h":
48
     # XXX - hrr, sync with libdnet and libevent
39
     # XXX - hrr, sync with libdnet and libevent
49
@@ -134,16 +147,18 @@
40
@@ -134,16 +147,18 @@ cdef class bpf:
50
             raise IOError, 'bad filter'
41
             raise IOError, 'bad filter'
51
     def filter(self, buf):
42
     def filter(self, buf):
52
         """Return boolean match for buf against our filter."""
43
         """Return boolean match for buf against our filter."""
Lines 68-74 Link Here
68
     
59
     
69
     Open a handle to a packet capture descriptor.
60
     Open a handle to a packet capture descriptor.
70
     
61
     
71
@@ -152,6 +167,9 @@
62
@@ -152,6 +167,9 @@ cdef class pcap:
72
                  or None to open the first available up interface
63
                  or None to open the first available up interface
73
     snaplen   -- maximum number of bytes to capture for each packet
64
     snaplen   -- maximum number of bytes to capture for each packet
74
     promisc   -- boolean to specify promiscuous mode sniffing
65
     promisc   -- boolean to specify promiscuous mode sniffing
Lines 78-84 Link Here
78
     immediate -- disable buffering, if possible
69
     immediate -- disable buffering, if possible
79
     """
70
     """
80
     cdef pcap_t *__pcap
71
     cdef pcap_t *__pcap
81
@@ -161,7 +179,7 @@
72
@@ -161,7 +179,7 @@ cdef class pcap:
82
     cdef int __dloff
73
     cdef int __dloff
83
     
74
     
84
     def __init__(self, name=None, snaplen=65535, promisc=True,
75
     def __init__(self, name=None, snaplen=65535, promisc=True,
Lines 87-102 Link Here
87
         global dltoff
78
         global dltoff
88
         cdef char *p
79
         cdef char *p
89
         
80
         
90
@@ -171,7 +189,7 @@
81
@@ -171,7 +189,7 @@ cdef class pcap:
91
                 raise OSError, self.__ebuf
82
                 raise OSError, self.__ebuf
92
         else:
83
         else:
93
             p = name
84
             p = name
94
-        
85
-        
95
+            
86
+
96
         self.__pcap = pcap_open_offline(p, self.__ebuf)
87
         self.__pcap = pcap_open_offline(p, self.__ebuf)
97
         if not self.__pcap:
88
         if not self.__pcap:
98
             self.__pcap = pcap_open_live(pcap_ex_name(p), snaplen, promisc,
89
             self.__pcap = pcap_open_live(pcap_ex_name(p), snaplen, promisc,
99
@@ -184,7 +202,7 @@
90
@@ -184,7 +202,7 @@ cdef class pcap:
100
         try: self.__dloff = dltoff[pcap_datalink(self.__pcap)]
91
         try: self.__dloff = dltoff[pcap_datalink(self.__pcap)]
101
         except KeyError: pass
92
         except KeyError: pass
102
         if immediate and pcap_ex_immediate(self.__pcap) < 0:
93
         if immediate and pcap_ex_immediate(self.__pcap) < 0:
Lines 105-111 Link Here
105
     
96
     
106
     property name:
97
     property name:
107
         """Network interface or dumpfile name."""
98
         """Network interface or dumpfile name."""
108
@@ -243,16 +261,6 @@
99
@@ -243,16 +261,6 @@ cdef class pcap:
109
         """Return datalink type (DLT_* values)."""
100
         """Return datalink type (DLT_* values)."""
110
         return pcap_datalink(self.__pcap)
101
         return pcap_datalink(self.__pcap)
111
     
102
     
Lines 122-128 Link Here
122
     def __add_pkts(self, ts, pkt, pkts):
113
     def __add_pkts(self, ts, pkt, pkts):
123
         pkts.append((ts, pkt))
114
         pkts.append((ts, pkt))
124
     
115
     
125
@@ -288,18 +296,24 @@
116
@@ -288,18 +296,24 @@ cdef class pcap:
126
             raise exc[0], exc[1], exc[2]
117
             raise exc[0], exc[1], exc[2]
127
         return n
118
         return n
128
 
119
 
Lines 150-156 Link Here
150
         pcap_ex_setup(self.__pcap)
141
         pcap_ex_setup(self.__pcap)
151
         while 1:
142
         while 1:
152
             Py_BEGIN_ALLOW_THREADS
143
             Py_BEGIN_ALLOW_THREADS
153
@@ -308,10 +322,22 @@
144
@@ -308,10 +322,22 @@ cdef class pcap:
154
             if n == 1:
145
             if n == 1:
155
                 callback(hdr.ts.tv_sec + (hdr.ts.tv_usec / 1000000.0),
146
                 callback(hdr.ts.tv_sec + (hdr.ts.tv_usec / 1000000.0),
156
                          PyBuffer_FromMemory(pkt, hdr.caplen), *args)
147
                          PyBuffer_FromMemory(pkt, hdr.caplen), *args)
Lines 173-179 Link Here
173
     
164
     
174
     def geterr(self):
165
     def geterr(self):
175
         """Return the last error message associated with this handle."""
166
         """Return the last error message associated with this handle."""
176
@@ -340,6 +366,8 @@
167
@@ -340,6 +366,8 @@ cdef class pcap:
177
             if n == 1:
168
             if n == 1:
178
                 return (hdr.ts.tv_sec + (hdr.ts.tv_usec / 1000000.0),
169
                 return (hdr.ts.tv_sec + (hdr.ts.tv_usec / 1000000.0),
179
                         PyBuffer_FromMemory(pkt, hdr.caplen))
170
                         PyBuffer_FromMemory(pkt, hdr.caplen))
Lines 182-188 Link Here
182
             elif n == -1:
173
             elif n == -1:
183
                 raise KeyboardInterrupt
174
                 raise KeyboardInterrupt
184
             elif n == -2:
175
             elif n == -2:
185
@@ -364,3 +392,36 @@
176
@@ -364,3 +392,36 @@ def lookupdev():
186
         raise OSError, ebuf
177
         raise OSError, ebuf
187
     return p
178
     return p
188
 
179
 
(-)files/patch-setup.py (-4 / +4 lines)
Lines 1-6 Link Here
1
--- ./setup.py.orig	2005-10-16 19:07:03.000000000 -0400
1
--- setup.py.orig	2005-10-17 00:08:17 UTC
2
+++ ./setup.py	2011-12-18 14:32:02.170660843 -0500
2
+++ setup.py
3
@@ -25,7 +25,10 @@
3
@@ -25,7 +25,10 @@ class config_pcap(config.config):
4
         d = {}
4
         d = {}
5
         if os.path.exists(os.path.join(cfg['include_dirs'][0], 'pcap-int.h')):
5
         if os.path.exists(os.path.join(cfg['include_dirs'][0], 'pcap-int.h')):
6
             d['HAVE_PCAP_INT_H'] = 1
6
             d['HAVE_PCAP_INT_H'] = 1
Lines 12-18 Link Here
12
         if buf.find('pcap_file(') != -1:
12
         if buf.find('pcap_file(') != -1:
13
             d['HAVE_PCAP_FILE'] = 1
13
             d['HAVE_PCAP_FILE'] = 1
14
         if buf.find('pcap_compile_nopcap(') != -1:
14
         if buf.find('pcap_compile_nopcap(') != -1:
15
@@ -46,6 +49,7 @@
15
@@ -46,6 +49,7 @@ class config_pcap(config.config):
16
                 incdirs = [ os.path.join(d, sd) ]
16
                 incdirs = [ os.path.join(d, sd) ]
17
                 if os.path.exists(os.path.join(d, sd, 'pcap.h')):
17
                 if os.path.exists(os.path.join(d, sd, 'pcap.h')):
18
                     cfg['include_dirs'] = [ os.path.join(d, sd) ]
18
                     cfg['include_dirs'] = [ os.path.join(d, sd) ]
(-)pkg-descr (-1 / +1 lines)
Lines 1-3 Link Here
1
A simplified object-oriented Python extension module for libpcap
1
A simplified object-oriented Python extension module for libpcap
2
2
3
WWW: http://code.google.com/p/pypcap/
3
WWW: https://github.com/dugsong/pypcap

Return to bug 217372