Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

3
net/py-pcap/DESCR Normal file
View File

@@ -0,0 +1,3 @@
Simplified object-oriented Python extension module for libpcap -
the current tcpdump.org version, the legacy version shipping with some of
the BSD operating systems, and the WinPcap port for Windows.

42
net/py-pcap/Makefile Normal file
View File

@@ -0,0 +1,42 @@
# $NetBSD: Makefile,v 1.3 2013/02/06 19:31:00 jperkin Exp $
#
DISTNAME= pypcap-1.1
PKGNAME= ${PYPKGPREFIX}-pcap-1.1
PKGREVISION= 1
CATEGORIES= net python
MASTER_SITES= http://pypcap.googlecode.com/files/
MAINTAINER= pettai@NetBSD.org
HOMEPAGE= http://code.google.com/p/pypcap/
COMMENT= Simplified object-oriented python module for libpcap
LICENSE= modified-bsd
BUILD_DEPENDS+= ${PYPKGPREFIX}-pyrex-[0-9]*:../../lang/py-pyrex
SUBST_CLASSES+= python
SUBST_FILES.python= Makefile
SUBST_SED.python+= -e 's,@PYTHON@,${PYTHONBIN},g'
SUBST_STAGE.python= post-patch
SUBST_CLASSES+= prefix
SUBST_FILES.prefix= Makefile
SUBST_SED.prefix= -e "s|@PREFIX@|${PREFIX}|g"
SUBST_STAGE.prefix= post-patch
PYDISTUTILSPKG= yes
FILES_SUBST+= PYTHONBIN=${PYTHONBIN:Q}
pre-configure:
cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} \
pyrexc pcap.pyx
do-configure:
cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} \
${PYTHONBIN} setup.py config
# --with-pcap=${PREFIX}
.include "../../net/libpcap/buildlink3.mk"
.include "../../lang/python/extension.mk"
.include "../../lang/python/application.mk"
.include "../../mk/bsd.pkg.mk"

2
net/py-pcap/PLIST Normal file
View File

@@ -0,0 +1,2 @@
@comment $NetBSD: PLIST,v 1.1.1.1 2010/03/13 10:20:53 pettai Exp $
${PYSITELIB}/pcap.so

8
net/py-pcap/distinfo Normal file
View File

@@ -0,0 +1,8 @@
$NetBSD: distinfo,v 1.3 2011/05/09 11:17:22 alnsn Exp $
SHA1 (pypcap-1.1.tar.gz) = 966f62deca16d5086e2ef6694b0c795f273da15c
RMD160 (pypcap-1.1.tar.gz) = 119dcc393d42678e6fa8f0b0f8b82536ab1efb13
Size (pypcap-1.1.tar.gz) = 22951 bytes
SHA1 (patch-aa) = 6fb58b55262a9b28bdc9e681b3b3ea07523bd8e3
SHA1 (patch-ab) = 3be8dad4d70e56fc07a7acfea2d1fc5d0dd2e413
SHA1 (patch-ac) = 4a4f28578b27b4605787ea566217397bf60fdea8

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-aa,v 1.1.1.1 2010/03/13 10:20:53 pettai Exp $
--- setup.py.orig 2010-02-13 22:48:07.000000000 +0100
+++ setup.py 2010-02-13 22:48:31.000000000 +0100
@@ -42,7 +42,7 @@
dirs = [ '/usr', sys.prefix ] + glob.glob('/opt/libpcap*') + \
glob.glob('../libpcap*') + glob.glob('../wpdpack*')
for d in dirs:
- for sd in ('include', 'include/pcap', ''):
+ for sd in ('include/pcap', 'include', ''):
incdirs = [ os.path.join(d, sd) ]
if os.path.exists(os.path.join(d, sd, 'pcap.h')):
cfg['include_dirs'] = [ os.path.join(d, sd) ]

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-ab,v 1.3 2011/05/09 11:17:22 alnsn Exp $
--- Makefile.orig 2005-10-17 02:08:17.000000000 +0200
+++ Makefile 2010-02-14 17:31:22.000000000 +0100
@@ -2,4 +2,4 @@
-PYTHON = python
-#CONFIG_ARGS = --with-pcap=$(HOME)/build/libpcap-0.8.3
+PYTHON = @PYTHON@
+#CONFIG_ARGS = --with-pcap=@PREFIX@
# PYTHON = C:\\Python23\\python.exe
# CONFIG_ARGS = --with-pcap=..\\wpdpack

View File

@@ -0,0 +1,80 @@
$NetBSD: patch-ac,v 1.1.1.1 2010/03/13 10:20:53 pettai Exp $
# Apply in SVN repo fixes
#
--- pcap.pyx.orig 2005-10-17 01:00:11.000000000 +0200
+++ pcap.pyx 2010-02-14 17:49:27.000000000 +0100
@@ -20,6 +20,7 @@
cdef extern from "Python.h":
object PyBuffer_FromMemory(char *s, int len)
+ int PyObject_AsCharBuffer(object obj, char **buffer, int *buffer_len)
int PyGILState_Ensure()
void PyGILState_Release(int gil)
void Py_BEGIN_ALLOW_THREADS()
@@ -134,16 +135,18 @@
raise IOError, 'bad filter'
def filter(self, buf):
"""Return boolean match for buf against our filter."""
+ cdef char *p
cdef int n
- n = len(buf)
- if bpf_filter(self.fcode.bf_insns, buf, n, n) == 0:
+ if PyObject_AsCharBuffer(buf, &p, &n) < 0:
+ raise TypeError
+ if bpf_filter(self.fcode.bf_insns, p, n, n) == 0:
return False
return True
def __dealloc__(self):
pcap_freecode(&self.fcode)
cdef class pcap:
- """pcap(name=None, snaplen=65535, promisc=True, immediate=False) -> packet capture object
+ """pcap(name=None, snaplen=65535, promisc=True, immediate=False, timeout_ms=None) -> packet capture object
Open a handle to a packet capture descriptor.
@@ -153,15 +156,19 @@
snaplen -- maximum number of bytes to capture for each packet
promisc -- boolean to specify promiscuous mode sniffing
immediate -- disable buffering, if possible
+ timeout_ms -- requests for the next packet will return None if the timeout
+ (in milliseconds) is reached and no packets were received
+ (Default: no timeout)
"""
cdef pcap_t *__pcap
cdef char *__name
cdef char *__filter
cdef char __ebuf[256]
cdef int __dloff
+ cdef int __timeout_returns_none
def __init__(self, name=None, snaplen=65535, promisc=True,
- timeout_ms=500, immediate=False):
+ timeout_ms=None, immediate=False):
global dltoff
cdef char *p
@@ -172,6 +179,12 @@
else:
p = name
+ if timeout_ms is None:
+ timeout_ms = 500
+ self.__timeout_returns_none = 0
+ else:
+ self.__timeout_returns_none = 1
+
self.__pcap = pcap_open_offline(p, self.__ebuf)
if not self.__pcap:
self.__pcap = pcap_open_live(pcap_ex_name(p), snaplen, promisc,
@@ -340,6 +353,8 @@
if n == 1:
return (hdr.ts.tv_sec + (hdr.ts.tv_usec / 1000000.0),
PyBuffer_FromMemory(pkt, hdr.caplen))
+ elif n == 0 and self.__timeout_returns_none == 1:
+ return (hdr.ts.tv_sec + (hdr.ts.tv_usec / 1000000.0), None)
elif n == -1:
raise KeyboardInterrupt
elif n == -2: