Regenerated by Cython.
This commit is contained in:
parent
19ccf5cbf1
commit
778ad58890
244
netfilterqueue.c
244
netfilterqueue.c
|
@ -1,4 +1,4 @@
|
|||
/* Generated by Cython 0.14.1 on Thu May 12 15:46:34 2011 */
|
||||
/* Generated by Cython 0.14.1 on Fri May 13 09:28:25 2011 */
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
|
@ -390,6 +390,22 @@ enum {
|
|||
__pyx_e_14netfilterqueue_NF_MAX_VERDICT = __pyx_e_14netfilterqueue_NF_STOP
|
||||
};
|
||||
|
||||
/* "netfilterqueue.pxd":186
|
||||
* cpdef drop(self)
|
||||
*
|
||||
* cdef class QueueHandler: # <<<<<<<<<<<<<<
|
||||
* cdef nfq_handle *h # Handle to NFQueue library
|
||||
* cdef nfq_q_handle *qh # A handle to the queue
|
||||
*/
|
||||
|
||||
struct __pyx_obj_14netfilterqueue_QueueHandler {
|
||||
PyObject_HEAD
|
||||
struct nfq_handle *h;
|
||||
struct nfq_q_handle *qh;
|
||||
u_int16_t af;
|
||||
PyObject *packet_copy_size;
|
||||
};
|
||||
|
||||
/* "netfilterqueue.pxd":151
|
||||
* NF_MAX_VERDICT = NF_STOP
|
||||
*
|
||||
|
@ -416,28 +432,12 @@ struct __pyx_obj_14netfilterqueue_Packet {
|
|||
struct timeval timestamp;
|
||||
};
|
||||
|
||||
/* "netfilterqueue.pxd":186
|
||||
* cpdef drop(self)
|
||||
*
|
||||
* cdef class NetfilterQueue: # <<<<<<<<<<<<<<
|
||||
* cdef nfq_handle *h # Handle to NFQueue library
|
||||
* cdef nfq_q_handle *qh # A handle to the queue
|
||||
*/
|
||||
|
||||
struct __pyx_obj_14netfilterqueue_NetfilterQueue {
|
||||
PyObject_HEAD
|
||||
struct nfq_handle *h;
|
||||
struct nfq_q_handle *qh;
|
||||
u_int16_t af;
|
||||
PyObject *packet_copy_size;
|
||||
};
|
||||
|
||||
|
||||
/* "netfilterqueue.pyx":23
|
||||
* return 1
|
||||
*
|
||||
* cdef class Packet: # <<<<<<<<<<<<<<
|
||||
* """A packet received from NetfilterQueue."""
|
||||
* """A packet received from QueueHandler."""
|
||||
* def __cinit__(self):
|
||||
*/
|
||||
|
||||
|
@ -611,7 +611,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
|
|||
/* Module declarations from netfilterqueue */
|
||||
|
||||
static PyTypeObject *__pyx_ptype_14netfilterqueue_Packet = 0;
|
||||
static PyTypeObject *__pyx_ptype_14netfilterqueue_NetfilterQueue = 0;
|
||||
static PyTypeObject *__pyx_ptype_14netfilterqueue_QueueHandler = 0;
|
||||
static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *, struct nfgenmsg *, struct nfq_data *, void *); /*proto*/
|
||||
#define __Pyx_MODULE_NAME "netfilterqueue"
|
||||
static int __pyx_module_is_main_netfilterqueue = 0;
|
||||
|
@ -624,7 +624,7 @@ static char __pyx_k_2[] = "%s packet, %s bytes";
|
|||
static char __pyx_k_3[] = "Failed to get payload of packet.";
|
||||
static char __pyx_k_5[] = "Verdict already given for this packet.";
|
||||
static char __pyx_k_7[] = "Failed to open NFQueue.";
|
||||
static char __pyx_k_9[] = "Failed to bind family %s.";
|
||||
static char __pyx_k_9[] = "Failed to bind family %s. Are you root?";
|
||||
static char __pyx_k_12[] = "Failed to create queue %s.";
|
||||
static char __pyx_k_13[] = "Failed to set packet copy mode.";
|
||||
static char __pyx_k_15[] = "DEFAULT_MAX_QUEUELEN";
|
||||
|
@ -777,12 +777,12 @@ static char __pyx_k__MOBILE[] = "MOBILE";
|
|||
static char __pyx_k__NETBLT[] = "NETBLT";
|
||||
static char __pyx_k__accept[] = "accept";
|
||||
static char __pyx_k__handle[] = "handle";
|
||||
static char __pyx_k__maxlen[] = "maxlen";
|
||||
static char __pyx_k__tv_sec[] = "tv_sec";
|
||||
static char __pyx_k__ETHERIP[] = "ETHERIP";
|
||||
static char __pyx_k__OSError[] = "OSError";
|
||||
static char __pyx_k__OSPFIGP[] = "OSPFIGP";
|
||||
static char __pyx_k__UDPLite[] = "UDPLite";
|
||||
static char __pyx_k__max_len[] = "max_len";
|
||||
static char __pyx_k__payload[] = "payload";
|
||||
static char __pyx_k__tv_usec[] = "tv_usec";
|
||||
static char __pyx_k__verdict[] = "verdict";
|
||||
|
@ -988,7 +988,7 @@ static PyObject *__pyx_n_s__hook;
|
|||
static PyObject *__pyx_n_s__hw_protocol;
|
||||
static PyObject *__pyx_n_s__id;
|
||||
static PyObject *__pyx_n_s__manet;
|
||||
static PyObject *__pyx_n_s__maxlen;
|
||||
static PyObject *__pyx_n_s__max_len;
|
||||
static PyObject *__pyx_n_s__mode;
|
||||
static PyObject *__pyx_n_s__packet_id;
|
||||
static PyObject *__pyx_n_s__payload;
|
||||
|
@ -1178,7 +1178,7 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_
|
|||
* """Create an Packet and pass it to appropriate Python/Cython callback."""
|
||||
* packet = Packet() # <<<<<<<<<<<<<<
|
||||
* packet.set_nfq_data(qh, nfa)
|
||||
* (<NetfilterQueue>data).handle(packet)
|
||||
* (<QueueHandler>data).handle(packet)
|
||||
*/
|
||||
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_14netfilterqueue_Packet)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_1);
|
||||
|
@ -1190,7 +1190,7 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_
|
|||
* """Create an Packet and pass it to appropriate Python/Cython callback."""
|
||||
* packet = Packet()
|
||||
* packet.set_nfq_data(qh, nfa) # <<<<<<<<<<<<<<
|
||||
* (<NetfilterQueue>data).handle(packet)
|
||||
* (<QueueHandler>data).handle(packet)
|
||||
* return 1
|
||||
*/
|
||||
__pyx_t_1 = ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)__pyx_v_packet->__pyx_vtab)->set_nfq_data(__pyx_v_packet, __pyx_v_qh, __pyx_v_nfa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
|
@ -1200,7 +1200,7 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_
|
|||
/* "netfilterqueue.pyx":20
|
||||
* packet = Packet()
|
||||
* packet.set_nfq_data(qh, nfa)
|
||||
* (<NetfilterQueue>data).handle(packet) # <<<<<<<<<<<<<<
|
||||
* (<QueueHandler>data).handle(packet) # <<<<<<<<<<<<<<
|
||||
* return 1
|
||||
*
|
||||
*/
|
||||
|
@ -1219,7 +1219,7 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_
|
|||
|
||||
/* "netfilterqueue.pyx":21
|
||||
* packet.set_nfq_data(qh, nfa)
|
||||
* (<NetfilterQueue>data).handle(packet)
|
||||
* (<QueueHandler>data).handle(packet)
|
||||
* return 1 # <<<<<<<<<<<<<<
|
||||
*
|
||||
* cdef class Packet:
|
||||
|
@ -1246,7 +1246,7 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_
|
|||
|
||||
/* "netfilterqueue.pyx":25
|
||||
* cdef class Packet:
|
||||
* """A packet received from NetfilterQueue."""
|
||||
* """A packet received from QueueHandler."""
|
||||
* def __cinit__(self): # <<<<<<<<<<<<<<
|
||||
* self._verdict_is_set = False
|
||||
* self._mark_is_set = False
|
||||
|
@ -1261,7 +1261,7 @@ static int __pyx_pf_14netfilterqueue_6Packet___cinit__(PyObject *__pyx_v_self, P
|
|||
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
|
||||
|
||||
/* "netfilterqueue.pyx":26
|
||||
* """A packet received from NetfilterQueue."""
|
||||
* """A packet received from QueueHandler."""
|
||||
* def __cinit__(self):
|
||||
* self._verdict_is_set = False # <<<<<<<<<<<<<<
|
||||
* self._mark_is_set = False
|
||||
|
@ -2066,7 +2066,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_drop(struct __pyx_obj_14netfi
|
|||
* """Drop the packet."""
|
||||
* self.verdict(NF_DROP) # <<<<<<<<<<<<<<
|
||||
*
|
||||
* cdef class NetfilterQueue:
|
||||
* cdef class QueueHandler:
|
||||
*/
|
||||
((struct __pyx_vtabstruct_14netfilterqueue_Packet *)__pyx_v_self->__pyx_vtab)->verdict(__pyx_v_self, __pyx_e_14netfilterqueue_NF_DROP);
|
||||
|
||||
|
@ -2245,15 +2245,15 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_7payload___get__(PyObject *__
|
|||
}
|
||||
|
||||
/* "netfilterqueue.pyx":109
|
||||
* cdef class NetfilterQueue:
|
||||
* cdef class QueueHandler:
|
||||
* """Handle a single numbered queue."""
|
||||
* def __cinit__(self, *args, **kwargs): # <<<<<<<<<<<<<<
|
||||
* self.af = kwargs.get("af", PF_INET)
|
||||
*
|
||||
*/
|
||||
|
||||
static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
||||
static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
||||
static int __pyx_pf_14netfilterqueue_12QueueHandler___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
||||
static int __pyx_pf_14netfilterqueue_12QueueHandler___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
||||
PyObject *__pyx_v_args = 0;
|
||||
PyObject *__pyx_v_kwargs = 0;
|
||||
int __pyx_r;
|
||||
|
@ -2286,7 +2286,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_
|
|||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||
__pyx_t_3 = __Pyx_PyInt_from_py_u_int16_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (u_int16_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||
((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->af = __pyx_t_3;
|
||||
((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->af = __pyx_t_3;
|
||||
|
||||
/* "netfilterqueue.pyx":112
|
||||
* self.af = kwargs.get("af", PF_INET)
|
||||
|
@ -2295,7 +2295,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_
|
|||
* if self.h == NULL:
|
||||
* raise OSError("Failed to open NFQueue.")
|
||||
*/
|
||||
((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h = nfq_open();
|
||||
((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->h = nfq_open();
|
||||
|
||||
/* "netfilterqueue.pyx":113
|
||||
*
|
||||
|
@ -2304,7 +2304,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_
|
|||
* raise OSError("Failed to open NFQueue.")
|
||||
* nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous
|
||||
*/
|
||||
__pyx_t_4 = (((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h == NULL);
|
||||
__pyx_t_4 = (((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->h == NULL);
|
||||
if (__pyx_t_4) {
|
||||
|
||||
/* "netfilterqueue.pyx":114
|
||||
|
@ -2330,26 +2330,26 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_
|
|||
* # running queues
|
||||
* if nfq_bind_pf(self.h, self.af) < 0:
|
||||
*/
|
||||
nfq_unbind_pf(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h, ((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->af);
|
||||
nfq_unbind_pf(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->h, ((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->af);
|
||||
|
||||
/* "netfilterqueue.pyx":117
|
||||
* nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous
|
||||
* # running queues
|
||||
* if nfq_bind_pf(self.h, self.af) < 0: # <<<<<<<<<<<<<<
|
||||
* raise OSError("Failed to bind family %s." % self.af)
|
||||
* raise OSError("Failed to bind family %s. Are you root?" % self.af)
|
||||
*
|
||||
*/
|
||||
__pyx_t_4 = (nfq_bind_pf(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h, ((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->af) < 0);
|
||||
__pyx_t_4 = (nfq_bind_pf(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->h, ((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->af) < 0);
|
||||
if (__pyx_t_4) {
|
||||
|
||||
/* "netfilterqueue.pyx":118
|
||||
* # running queues
|
||||
* if nfq_bind_pf(self.h, self.af) < 0:
|
||||
* raise OSError("Failed to bind family %s." % self.af) # <<<<<<<<<<<<<<
|
||||
* raise OSError("Failed to bind family %s. Are you root?" % self.af) # <<<<<<<<<<<<<<
|
||||
*
|
||||
* def __dealloc__(self):
|
||||
*/
|
||||
__pyx_t_2 = __Pyx_PyInt_to_py_u_int16_t(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->af); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__pyx_t_2 = __Pyx_PyInt_to_py_u_int16_t(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->af); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
|
||||
|
@ -2374,7 +2374,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_
|
|||
__pyx_L1_error:;
|
||||
__Pyx_XDECREF(__pyx_t_1);
|
||||
__Pyx_XDECREF(__pyx_t_2);
|
||||
__Pyx_AddTraceback("netfilterqueue.NetfilterQueue.__cinit__");
|
||||
__Pyx_AddTraceback("netfilterqueue.QueueHandler.__cinit__");
|
||||
__pyx_r = -1;
|
||||
__pyx_L0:;
|
||||
__Pyx_DECREF(__pyx_v_args);
|
||||
|
@ -2384,15 +2384,15 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_
|
|||
}
|
||||
|
||||
/* "netfilterqueue.pyx":120
|
||||
* raise OSError("Failed to bind family %s." % self.af)
|
||||
* raise OSError("Failed to bind family %s. Are you root?" % self.af)
|
||||
*
|
||||
* def __dealloc__(self): # <<<<<<<<<<<<<<
|
||||
* if self.qh != NULL:
|
||||
* nfq_destroy_queue(self.qh)
|
||||
*/
|
||||
|
||||
static void __pyx_pf_14netfilterqueue_14NetfilterQueue_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
|
||||
static void __pyx_pf_14netfilterqueue_14NetfilterQueue_1__dealloc__(PyObject *__pyx_v_self) {
|
||||
static void __pyx_pf_14netfilterqueue_12QueueHandler_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
|
||||
static void __pyx_pf_14netfilterqueue_12QueueHandler_1__dealloc__(PyObject *__pyx_v_self) {
|
||||
int __pyx_t_1;
|
||||
__Pyx_RefNannySetupContext("__dealloc__");
|
||||
|
||||
|
@ -2403,7 +2403,7 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_1__dealloc__(PyObject *__
|
|||
* nfq_destroy_queue(self.qh)
|
||||
* # Don't call nfq_unbind_pf unless you want to disconnect any other
|
||||
*/
|
||||
__pyx_t_1 = (((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh != NULL);
|
||||
__pyx_t_1 = (((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->qh != NULL);
|
||||
if (__pyx_t_1) {
|
||||
|
||||
/* "netfilterqueue.pyx":122
|
||||
|
@ -2413,7 +2413,7 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_1__dealloc__(PyObject *__
|
|||
* # Don't call nfq_unbind_pf unless you want to disconnect any other
|
||||
* # processes using this libnetfilter_queue on this protocol family!
|
||||
*/
|
||||
nfq_destroy_queue(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh);
|
||||
nfq_destroy_queue(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->qh);
|
||||
goto __pyx_L5;
|
||||
}
|
||||
__pyx_L5:;
|
||||
|
@ -2423,9 +2423,9 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_1__dealloc__(PyObject *__
|
|||
* # processes using this libnetfilter_queue on this protocol family!
|
||||
* nfq_close(self.h) # <<<<<<<<<<<<<<
|
||||
*
|
||||
* def bind(self, int queue_num, u_int32_t maxlen=DEFAULT_MAX_QUEUELEN, u_int8_t mode=NFQNL_COPY_PACKET, u_int32_t range=MaxPacketSize):
|
||||
* def bind(self, int queue_num, u_int32_t max_len=DEFAULT_MAX_QUEUELEN, u_int8_t mode=NFQNL_COPY_PACKET, u_int32_t range=MaxPacketSize):
|
||||
*/
|
||||
nfq_close(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h);
|
||||
nfq_close(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->h);
|
||||
|
||||
__Pyx_RefNannyFinishContext();
|
||||
}
|
||||
|
@ -2433,23 +2433,23 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_1__dealloc__(PyObject *__
|
|||
/* "netfilterqueue.pyx":127
|
||||
* nfq_close(self.h)
|
||||
*
|
||||
* def bind(self, int queue_num, u_int32_t maxlen=DEFAULT_MAX_QUEUELEN, u_int8_t mode=NFQNL_COPY_PACKET, u_int32_t range=MaxPacketSize): # <<<<<<<<<<<<<<
|
||||
* def bind(self, int queue_num, u_int32_t max_len=DEFAULT_MAX_QUEUELEN, u_int8_t mode=NFQNL_COPY_PACKET, u_int32_t range=MaxPacketSize): # <<<<<<<<<<<<<<
|
||||
* """Create and bind to a new queue."""
|
||||
* self.qh = nfq_create_queue(self.h, queue_num, <nfq_callback*>global_callback, <void*>self)
|
||||
*/
|
||||
|
||||
static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
||||
static char __pyx_doc_14netfilterqueue_14NetfilterQueue_2bind[] = "Create and bind to a new queue.";
|
||||
static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
||||
static PyObject *__pyx_pf_14netfilterqueue_12QueueHandler_2bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
||||
static char __pyx_doc_14netfilterqueue_12QueueHandler_2bind[] = "Create and bind to a new queue.";
|
||||
static PyObject *__pyx_pf_14netfilterqueue_12QueueHandler_2bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
||||
int __pyx_v_queue_num;
|
||||
u_int32_t __pyx_v_maxlen;
|
||||
u_int32_t __pyx_v_max_len;
|
||||
u_int8_t __pyx_v_mode;
|
||||
u_int32_t __pyx_v_range;
|
||||
PyObject *__pyx_r = NULL;
|
||||
int __pyx_t_1;
|
||||
PyObject *__pyx_t_2 = NULL;
|
||||
PyObject *__pyx_t_3 = NULL;
|
||||
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__queue_num,&__pyx_n_s__maxlen,&__pyx_n_s__mode,&__pyx_n_s__range,0};
|
||||
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__queue_num,&__pyx_n_s__max_len,&__pyx_n_s__mode,&__pyx_n_s__range,0};
|
||||
__Pyx_RefNannySetupContext("bind");
|
||||
if (unlikely(__pyx_kwds)) {
|
||||
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
|
||||
|
@ -2469,7 +2469,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py
|
|||
else goto __pyx_L5_argtuple_error;
|
||||
case 1:
|
||||
if (kw_args > 0) {
|
||||
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__maxlen);
|
||||
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_len);
|
||||
if (value) { values[1] = value; kw_args--; }
|
||||
}
|
||||
case 2:
|
||||
|
@ -2488,9 +2488,9 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py
|
|||
}
|
||||
__pyx_v_queue_num = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_queue_num == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
|
||||
if (values[1]) {
|
||||
__pyx_v_maxlen = __Pyx_PyInt_from_py_u_int32_t(values[1]); if (unlikely((__pyx_v_maxlen == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
|
||||
__pyx_v_max_len = __Pyx_PyInt_from_py_u_int32_t(values[1]); if (unlikely((__pyx_v_max_len == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
|
||||
} else {
|
||||
__pyx_v_maxlen = __pyx_k_10;
|
||||
__pyx_v_max_len = __pyx_k_10;
|
||||
}
|
||||
if (values[2]) {
|
||||
__pyx_v_mode = __Pyx_PyInt_from_py_u_int8_t(values[2]); if (unlikely((__pyx_v_mode == (u_int8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
|
||||
|
@ -2503,13 +2503,13 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py
|
|||
__pyx_v_range = ((u_int32_t)65535);
|
||||
}
|
||||
} else {
|
||||
__pyx_v_maxlen = __pyx_k_10;
|
||||
__pyx_v_max_len = __pyx_k_10;
|
||||
__pyx_v_mode = __pyx_k_11;
|
||||
__pyx_v_range = ((u_int32_t)65535);
|
||||
switch (PyTuple_GET_SIZE(__pyx_args)) {
|
||||
case 4: __pyx_v_range = __Pyx_PyInt_from_py_u_int32_t(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_range == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
|
||||
case 3: __pyx_v_mode = __Pyx_PyInt_from_py_u_int8_t(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_mode == (u_int8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
|
||||
case 2: __pyx_v_maxlen = __Pyx_PyInt_from_py_u_int32_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_maxlen == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
|
||||
case 2: __pyx_v_max_len = __Pyx_PyInt_from_py_u_int32_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_max_len == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
|
||||
case 1: __pyx_v_queue_num = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_queue_num == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
|
||||
break;
|
||||
default: goto __pyx_L5_argtuple_error;
|
||||
|
@ -2519,19 +2519,19 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py
|
|||
__pyx_L5_argtuple_error:;
|
||||
__Pyx_RaiseArgtupleInvalid("bind", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
|
||||
__pyx_L3_error:;
|
||||
__Pyx_AddTraceback("netfilterqueue.NetfilterQueue.bind");
|
||||
__Pyx_AddTraceback("netfilterqueue.QueueHandler.bind");
|
||||
__Pyx_RefNannyFinishContext();
|
||||
return NULL;
|
||||
__pyx_L4_argument_unpacking_done:;
|
||||
|
||||
/* "netfilterqueue.pyx":129
|
||||
* def bind(self, int queue_num, u_int32_t maxlen=DEFAULT_MAX_QUEUELEN, u_int8_t mode=NFQNL_COPY_PACKET, u_int32_t range=MaxPacketSize):
|
||||
* def bind(self, int queue_num, u_int32_t max_len=DEFAULT_MAX_QUEUELEN, u_int8_t mode=NFQNL_COPY_PACKET, u_int32_t range=MaxPacketSize):
|
||||
* """Create and bind to a new queue."""
|
||||
* self.qh = nfq_create_queue(self.h, queue_num, <nfq_callback*>global_callback, <void*>self) # <<<<<<<<<<<<<<
|
||||
* if self.qh == NULL:
|
||||
* raise OSError("Failed to create queue %s." % queue_num)
|
||||
*/
|
||||
((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh = nfq_create_queue(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h, __pyx_v_queue_num, ((nfq_callback *)__pyx_f_14netfilterqueue_global_callback), ((void *)__pyx_v_self));
|
||||
((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->qh = nfq_create_queue(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->h, __pyx_v_queue_num, ((nfq_callback *)__pyx_f_14netfilterqueue_global_callback), ((void *)__pyx_v_self));
|
||||
|
||||
/* "netfilterqueue.pyx":130
|
||||
* """Create and bind to a new queue."""
|
||||
|
@ -2540,7 +2540,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py
|
|||
* raise OSError("Failed to create queue %s." % queue_num)
|
||||
*
|
||||
*/
|
||||
__pyx_t_1 = (((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh == NULL);
|
||||
__pyx_t_1 = (((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->qh == NULL);
|
||||
if (__pyx_t_1) {
|
||||
|
||||
/* "netfilterqueue.pyx":131
|
||||
|
@ -2599,7 +2599,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py
|
|||
* raise OSError("Failed to set packet copy mode.")
|
||||
*
|
||||
*/
|
||||
__pyx_t_1 = (nfq_set_mode(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh, __pyx_v_mode, __pyx_v_range) < 0);
|
||||
__pyx_t_1 = (nfq_set_mode(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->qh, __pyx_v_mode, __pyx_v_range) < 0);
|
||||
if (__pyx_t_1) {
|
||||
|
||||
/* "netfilterqueue.pyx":136
|
||||
|
@ -2607,7 +2607,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py
|
|||
* if nfq_set_mode(self.qh, mode, range) < 0:
|
||||
* raise OSError("Failed to set packet copy mode.") # <<<<<<<<<<<<<<
|
||||
*
|
||||
* nfq_set_queue_maxlen(self.qh, maxlen)
|
||||
* nfq_set_queue_maxlen(self.qh, max_len)
|
||||
*/
|
||||
__pyx_t_3 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_3);
|
||||
|
@ -2621,18 +2621,18 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py
|
|||
/* "netfilterqueue.pyx":138
|
||||
* raise OSError("Failed to set packet copy mode.")
|
||||
*
|
||||
* nfq_set_queue_maxlen(self.qh, maxlen) # <<<<<<<<<<<<<<
|
||||
* nfq_set_queue_maxlen(self.qh, max_len) # <<<<<<<<<<<<<<
|
||||
*
|
||||
* def unbind(self):
|
||||
*/
|
||||
nfq_set_queue_maxlen(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh, __pyx_v_maxlen);
|
||||
nfq_set_queue_maxlen(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->qh, __pyx_v_max_len);
|
||||
|
||||
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
|
||||
goto __pyx_L0;
|
||||
__pyx_L1_error:;
|
||||
__Pyx_XDECREF(__pyx_t_2);
|
||||
__Pyx_XDECREF(__pyx_t_3);
|
||||
__Pyx_AddTraceback("netfilterqueue.NetfilterQueue.bind");
|
||||
__Pyx_AddTraceback("netfilterqueue.QueueHandler.bind");
|
||||
__pyx_r = NULL;
|
||||
__pyx_L0:;
|
||||
__Pyx_XGIVEREF(__pyx_r);
|
||||
|
@ -2641,16 +2641,16 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py
|
|||
}
|
||||
|
||||
/* "netfilterqueue.pyx":140
|
||||
* nfq_set_queue_maxlen(self.qh, maxlen)
|
||||
* nfq_set_queue_maxlen(self.qh, max_len)
|
||||
*
|
||||
* def unbind(self): # <<<<<<<<<<<<<<
|
||||
* """Destroy the queue."""
|
||||
* if self.qh != NULL:
|
||||
*/
|
||||
|
||||
static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_3unbind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
|
||||
static char __pyx_doc_14netfilterqueue_14NetfilterQueue_3unbind[] = "Destroy the queue.";
|
||||
static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_3unbind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
|
||||
static PyObject *__pyx_pf_14netfilterqueue_12QueueHandler_3unbind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
|
||||
static char __pyx_doc_14netfilterqueue_12QueueHandler_3unbind[] = "Destroy the queue.";
|
||||
static PyObject *__pyx_pf_14netfilterqueue_12QueueHandler_3unbind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
|
||||
PyObject *__pyx_r = NULL;
|
||||
int __pyx_t_1;
|
||||
__Pyx_RefNannySetupContext("unbind");
|
||||
|
@ -2662,7 +2662,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_3unbind(PyObject *__
|
|||
* nfq_destroy_queue(self.qh)
|
||||
* # See warning about nfq_unbind_pf in __dealloc__ above.
|
||||
*/
|
||||
__pyx_t_1 = (((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh != NULL);
|
||||
__pyx_t_1 = (((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->qh != NULL);
|
||||
if (__pyx_t_1) {
|
||||
|
||||
/* "netfilterqueue.pyx":143
|
||||
|
@ -2672,7 +2672,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_3unbind(PyObject *__
|
|||
* # See warning about nfq_unbind_pf in __dealloc__ above.
|
||||
*
|
||||
*/
|
||||
nfq_destroy_queue(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh);
|
||||
nfq_destroy_queue(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->qh);
|
||||
goto __pyx_L5;
|
||||
}
|
||||
__pyx_L5:;
|
||||
|
@ -2691,9 +2691,9 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_3unbind(PyObject *__
|
|||
* cdef int fd = nfq_fd(self.h)
|
||||
*/
|
||||
|
||||
static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
|
||||
static char __pyx_doc_14netfilterqueue_14NetfilterQueue_4run[] = "Begin accepting packets.";
|
||||
static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
|
||||
static PyObject *__pyx_pf_14netfilterqueue_12QueueHandler_4run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
|
||||
static char __pyx_doc_14netfilterqueue_12QueueHandler_4run[] = "Begin accepting packets.";
|
||||
static PyObject *__pyx_pf_14netfilterqueue_12QueueHandler_4run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
|
||||
int __pyx_v_fd;
|
||||
char __pyx_v_buf[4096];
|
||||
int __pyx_v_rv;
|
||||
|
@ -2708,7 +2708,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx
|
|||
* cdef char buf[BufferSize]
|
||||
* cdef int rv
|
||||
*/
|
||||
__pyx_v_fd = nfq_fd(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h);
|
||||
__pyx_v_fd = nfq_fd(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->h);
|
||||
|
||||
/* "netfilterqueue.pyx":151
|
||||
* cdef char buf[BufferSize]
|
||||
|
@ -2764,7 +2764,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx
|
|||
* with nogil:
|
||||
* rv = recv(fd, buf, sizeof(buf), 0)
|
||||
*/
|
||||
nfq_handle_packet(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h, __pyx_v_buf, __pyx_v_rv);
|
||||
nfq_handle_packet(((struct __pyx_obj_14netfilterqueue_QueueHandler *)__pyx_v_self)->h, __pyx_v_buf, __pyx_v_rv);
|
||||
|
||||
/* "netfilterqueue.pyx":155
|
||||
* while rv >= 0:
|
||||
|
@ -2817,9 +2817,9 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx
|
|||
* packet.accept()
|
||||
*/
|
||||
|
||||
static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_5handle(PyObject *__pyx_v_self, PyObject *__pyx_v_packet); /*proto*/
|
||||
static char __pyx_doc_14netfilterqueue_14NetfilterQueue_5handle[] = "Handle a single packet. User-defined classes should override this.";
|
||||
static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_5handle(PyObject *__pyx_v_self, PyObject *__pyx_v_packet) {
|
||||
static PyObject *__pyx_pf_14netfilterqueue_12QueueHandler_5handle(PyObject *__pyx_v_self, PyObject *__pyx_v_packet); /*proto*/
|
||||
static char __pyx_doc_14netfilterqueue_12QueueHandler_5handle[] = "Handle a single packet. User-defined classes should override this.";
|
||||
static PyObject *__pyx_pf_14netfilterqueue_12QueueHandler_5handle(PyObject *__pyx_v_self, PyObject *__pyx_v_packet) {
|
||||
PyObject *__pyx_r = NULL;
|
||||
PyObject *__pyx_t_1 = NULL;
|
||||
__Pyx_RefNannySetupContext("handle");
|
||||
|
@ -2840,7 +2840,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_5handle(PyObject *__
|
|||
goto __pyx_L0;
|
||||
__pyx_L1_error:;
|
||||
__Pyx_XDECREF(__pyx_t_1);
|
||||
__Pyx_AddTraceback("netfilterqueue.NetfilterQueue.handle");
|
||||
__Pyx_AddTraceback("netfilterqueue.QueueHandler.handle");
|
||||
__pyx_r = NULL;
|
||||
__pyx_L0:;
|
||||
__Pyx_XGIVEREF(__pyx_r);
|
||||
|
@ -3022,7 +3022,7 @@ static PyTypeObject __pyx_type_14netfilterqueue_Packet = {
|
|||
0, /*tp_setattro*/
|
||||
&__pyx_tp_as_buffer_Packet, /*tp_as_buffer*/
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
|
||||
__Pyx_DOCSTR("A packet received from NetfilterQueue."), /*tp_doc*/
|
||||
__Pyx_DOCSTR("A packet received from QueueHandler."), /*tp_doc*/
|
||||
0, /*tp_traverse*/
|
||||
0, /*tp_clear*/
|
||||
0, /*tp_richcompare*/
|
||||
|
@ -3053,25 +3053,25 @@ static PyTypeObject __pyx_type_14netfilterqueue_Packet = {
|
|||
#endif
|
||||
};
|
||||
|
||||
static PyObject *__pyx_tp_new_14netfilterqueue_NetfilterQueue(PyTypeObject *t, PyObject *a, PyObject *k) {
|
||||
struct __pyx_obj_14netfilterqueue_NetfilterQueue *p;
|
||||
static PyObject *__pyx_tp_new_14netfilterqueue_QueueHandler(PyTypeObject *t, PyObject *a, PyObject *k) {
|
||||
struct __pyx_obj_14netfilterqueue_QueueHandler *p;
|
||||
PyObject *o = (*t->tp_alloc)(t, 0);
|
||||
if (!o) return 0;
|
||||
p = ((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)o);
|
||||
p = ((struct __pyx_obj_14netfilterqueue_QueueHandler *)o);
|
||||
p->packet_copy_size = Py_None; Py_INCREF(Py_None);
|
||||
if (__pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(o, a, k) < 0) {
|
||||
if (__pyx_pf_14netfilterqueue_12QueueHandler___cinit__(o, a, k) < 0) {
|
||||
Py_DECREF(o); o = 0;
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
static void __pyx_tp_dealloc_14netfilterqueue_NetfilterQueue(PyObject *o) {
|
||||
struct __pyx_obj_14netfilterqueue_NetfilterQueue *p = (struct __pyx_obj_14netfilterqueue_NetfilterQueue *)o;
|
||||
static void __pyx_tp_dealloc_14netfilterqueue_QueueHandler(PyObject *o) {
|
||||
struct __pyx_obj_14netfilterqueue_QueueHandler *p = (struct __pyx_obj_14netfilterqueue_QueueHandler *)o;
|
||||
{
|
||||
PyObject *etype, *eval, *etb;
|
||||
PyErr_Fetch(&etype, &eval, &etb);
|
||||
++Py_REFCNT(o);
|
||||
__pyx_pf_14netfilterqueue_14NetfilterQueue_1__dealloc__(o);
|
||||
__pyx_pf_14netfilterqueue_12QueueHandler_1__dealloc__(o);
|
||||
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
|
||||
--Py_REFCNT(o);
|
||||
PyErr_Restore(etype, eval, etb);
|
||||
|
@ -3080,17 +3080,17 @@ static void __pyx_tp_dealloc_14netfilterqueue_NetfilterQueue(PyObject *o) {
|
|||
(*Py_TYPE(o)->tp_free)(o);
|
||||
}
|
||||
|
||||
static int __pyx_tp_traverse_14netfilterqueue_NetfilterQueue(PyObject *o, visitproc v, void *a) {
|
||||
static int __pyx_tp_traverse_14netfilterqueue_QueueHandler(PyObject *o, visitproc v, void *a) {
|
||||
int e;
|
||||
struct __pyx_obj_14netfilterqueue_NetfilterQueue *p = (struct __pyx_obj_14netfilterqueue_NetfilterQueue *)o;
|
||||
struct __pyx_obj_14netfilterqueue_QueueHandler *p = (struct __pyx_obj_14netfilterqueue_QueueHandler *)o;
|
||||
if (p->packet_copy_size) {
|
||||
e = (*v)(p->packet_copy_size, a); if (e) return e;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __pyx_tp_clear_14netfilterqueue_NetfilterQueue(PyObject *o) {
|
||||
struct __pyx_obj_14netfilterqueue_NetfilterQueue *p = (struct __pyx_obj_14netfilterqueue_NetfilterQueue *)o;
|
||||
static int __pyx_tp_clear_14netfilterqueue_QueueHandler(PyObject *o) {
|
||||
struct __pyx_obj_14netfilterqueue_QueueHandler *p = (struct __pyx_obj_14netfilterqueue_QueueHandler *)o;
|
||||
PyObject* tmp;
|
||||
tmp = ((PyObject*)p->packet_copy_size);
|
||||
p->packet_copy_size = Py_None; Py_INCREF(Py_None);
|
||||
|
@ -3098,15 +3098,15 @@ static int __pyx_tp_clear_14netfilterqueue_NetfilterQueue(PyObject *o) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static PyMethodDef __pyx_methods_14netfilterqueue_NetfilterQueue[] = {
|
||||
{__Pyx_NAMESTR("bind"), (PyCFunction)__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_14NetfilterQueue_2bind)},
|
||||
{__Pyx_NAMESTR("unbind"), (PyCFunction)__pyx_pf_14netfilterqueue_14NetfilterQueue_3unbind, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_14NetfilterQueue_3unbind)},
|
||||
{__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pf_14netfilterqueue_14NetfilterQueue_4run, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_14NetfilterQueue_4run)},
|
||||
{__Pyx_NAMESTR("handle"), (PyCFunction)__pyx_pf_14netfilterqueue_14NetfilterQueue_5handle, METH_O, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_14NetfilterQueue_5handle)},
|
||||
static PyMethodDef __pyx_methods_14netfilterqueue_QueueHandler[] = {
|
||||
{__Pyx_NAMESTR("bind"), (PyCFunction)__pyx_pf_14netfilterqueue_12QueueHandler_2bind, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_12QueueHandler_2bind)},
|
||||
{__Pyx_NAMESTR("unbind"), (PyCFunction)__pyx_pf_14netfilterqueue_12QueueHandler_3unbind, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_12QueueHandler_3unbind)},
|
||||
{__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pf_14netfilterqueue_12QueueHandler_4run, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_12QueueHandler_4run)},
|
||||
{__Pyx_NAMESTR("handle"), (PyCFunction)__pyx_pf_14netfilterqueue_12QueueHandler_5handle, METH_O, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_12QueueHandler_5handle)},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static PyNumberMethods __pyx_tp_as_number_NetfilterQueue = {
|
||||
static PyNumberMethods __pyx_tp_as_number_QueueHandler = {
|
||||
0, /*nb_add*/
|
||||
0, /*nb_subtract*/
|
||||
0, /*nb_multiply*/
|
||||
|
@ -3164,7 +3164,7 @@ static PyNumberMethods __pyx_tp_as_number_NetfilterQueue = {
|
|||
#endif
|
||||
};
|
||||
|
||||
static PySequenceMethods __pyx_tp_as_sequence_NetfilterQueue = {
|
||||
static PySequenceMethods __pyx_tp_as_sequence_QueueHandler = {
|
||||
0, /*sq_length*/
|
||||
0, /*sq_concat*/
|
||||
0, /*sq_repeat*/
|
||||
|
@ -3177,13 +3177,13 @@ static PySequenceMethods __pyx_tp_as_sequence_NetfilterQueue = {
|
|||
0, /*sq_inplace_repeat*/
|
||||
};
|
||||
|
||||
static PyMappingMethods __pyx_tp_as_mapping_NetfilterQueue = {
|
||||
static PyMappingMethods __pyx_tp_as_mapping_QueueHandler = {
|
||||
0, /*mp_length*/
|
||||
0, /*mp_subscript*/
|
||||
0, /*mp_ass_subscript*/
|
||||
};
|
||||
|
||||
static PyBufferProcs __pyx_tp_as_buffer_NetfilterQueue = {
|
||||
static PyBufferProcs __pyx_tp_as_buffer_QueueHandler = {
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
0, /*bf_getreadbuffer*/
|
||||
#endif
|
||||
|
@ -3204,12 +3204,12 @@ static PyBufferProcs __pyx_tp_as_buffer_NetfilterQueue = {
|
|||
#endif
|
||||
};
|
||||
|
||||
static PyTypeObject __pyx_type_14netfilterqueue_NetfilterQueue = {
|
||||
static PyTypeObject __pyx_type_14netfilterqueue_QueueHandler = {
|
||||
PyVarObject_HEAD_INIT(0, 0)
|
||||
__Pyx_NAMESTR("netfilterqueue.NetfilterQueue"), /*tp_name*/
|
||||
sizeof(struct __pyx_obj_14netfilterqueue_NetfilterQueue), /*tp_basicsize*/
|
||||
__Pyx_NAMESTR("netfilterqueue.QueueHandler"), /*tp_name*/
|
||||
sizeof(struct __pyx_obj_14netfilterqueue_QueueHandler), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
__pyx_tp_dealloc_14netfilterqueue_NetfilterQueue, /*tp_dealloc*/
|
||||
__pyx_tp_dealloc_14netfilterqueue_QueueHandler, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
0, /*tp_getattr*/
|
||||
0, /*tp_setattr*/
|
||||
|
@ -3219,24 +3219,24 @@ static PyTypeObject __pyx_type_14netfilterqueue_NetfilterQueue = {
|
|||
0, /*reserved*/
|
||||
#endif
|
||||
0, /*tp_repr*/
|
||||
&__pyx_tp_as_number_NetfilterQueue, /*tp_as_number*/
|
||||
&__pyx_tp_as_sequence_NetfilterQueue, /*tp_as_sequence*/
|
||||
&__pyx_tp_as_mapping_NetfilterQueue, /*tp_as_mapping*/
|
||||
&__pyx_tp_as_number_QueueHandler, /*tp_as_number*/
|
||||
&__pyx_tp_as_sequence_QueueHandler, /*tp_as_sequence*/
|
||||
&__pyx_tp_as_mapping_QueueHandler, /*tp_as_mapping*/
|
||||
0, /*tp_hash*/
|
||||
0, /*tp_call*/
|
||||
0, /*tp_str*/
|
||||
0, /*tp_getattro*/
|
||||
0, /*tp_setattro*/
|
||||
&__pyx_tp_as_buffer_NetfilterQueue, /*tp_as_buffer*/
|
||||
&__pyx_tp_as_buffer_QueueHandler, /*tp_as_buffer*/
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
|
||||
__Pyx_DOCSTR("Handle a single numbered queue."), /*tp_doc*/
|
||||
__pyx_tp_traverse_14netfilterqueue_NetfilterQueue, /*tp_traverse*/
|
||||
__pyx_tp_clear_14netfilterqueue_NetfilterQueue, /*tp_clear*/
|
||||
__pyx_tp_traverse_14netfilterqueue_QueueHandler, /*tp_traverse*/
|
||||
__pyx_tp_clear_14netfilterqueue_QueueHandler, /*tp_clear*/
|
||||
0, /*tp_richcompare*/
|
||||
0, /*tp_weaklistoffset*/
|
||||
0, /*tp_iter*/
|
||||
0, /*tp_iternext*/
|
||||
__pyx_methods_14netfilterqueue_NetfilterQueue, /*tp_methods*/
|
||||
__pyx_methods_14netfilterqueue_QueueHandler, /*tp_methods*/
|
||||
0, /*tp_members*/
|
||||
0, /*tp_getset*/
|
||||
0, /*tp_base*/
|
||||
|
@ -3246,7 +3246,7 @@ static PyTypeObject __pyx_type_14netfilterqueue_NetfilterQueue = {
|
|||
0, /*tp_dictoffset*/
|
||||
0, /*tp_init*/
|
||||
0, /*tp_alloc*/
|
||||
__pyx_tp_new_14netfilterqueue_NetfilterQueue, /*tp_new*/
|
||||
__pyx_tp_new_14netfilterqueue_QueueHandler, /*tp_new*/
|
||||
0, /*tp_free*/
|
||||
0, /*tp_is_gc*/
|
||||
0, /*tp_bases*/
|
||||
|
@ -3456,7 +3456,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
|
|||
{&__pyx_n_s__hw_protocol, __pyx_k__hw_protocol, sizeof(__pyx_k__hw_protocol), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__manet, __pyx_k__manet, sizeof(__pyx_k__manet), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__maxlen, __pyx_k__maxlen, sizeof(__pyx_k__maxlen), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__max_len, __pyx_k__max_len, sizeof(__pyx_k__max_len), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__packet_id, __pyx_k__packet_id, sizeof(__pyx_k__packet_id), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__payload, __pyx_k__payload, sizeof(__pyx_k__payload), 0, 0, 1, 1},
|
||||
|
@ -3531,7 +3531,7 @@ static int __Pyx_InitCachedConstants(void) {
|
|||
* if nfq_set_mode(self.qh, mode, range) < 0:
|
||||
* raise OSError("Failed to set packet copy mode.") # <<<<<<<<<<<<<<
|
||||
*
|
||||
* nfq_set_queue_maxlen(self.qh, maxlen)
|
||||
* nfq_set_queue_maxlen(self.qh, max_len)
|
||||
*/
|
||||
__pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14));
|
||||
|
@ -3766,9 +3766,9 @@ PyMODINIT_FUNC PyInit_netfilterqueue(void)
|
|||
if (__Pyx_SetVtable(__pyx_type_14netfilterqueue_Packet.tp_dict, __pyx_vtabptr_14netfilterqueue_Packet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
if (__Pyx_SetAttrString(__pyx_m, "Packet", (PyObject *)&__pyx_type_14netfilterqueue_Packet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__pyx_ptype_14netfilterqueue_Packet = &__pyx_type_14netfilterqueue_Packet;
|
||||
if (PyType_Ready(&__pyx_type_14netfilterqueue_NetfilterQueue) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
if (__Pyx_SetAttrString(__pyx_m, "NetfilterQueue", (PyObject *)&__pyx_type_14netfilterqueue_NetfilterQueue) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__pyx_ptype_14netfilterqueue_NetfilterQueue = &__pyx_type_14netfilterqueue_NetfilterQueue;
|
||||
if (PyType_Ready(&__pyx_type_14netfilterqueue_QueueHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
if (__Pyx_SetAttrString(__pyx_m, "QueueHandler", (PyObject *)&__pyx_type_14netfilterqueue_QueueHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__pyx_ptype_14netfilterqueue_QueueHandler = &__pyx_type_14netfilterqueue_QueueHandler;
|
||||
/*--- Type import code ---*/
|
||||
/*--- Function import code ---*/
|
||||
/*--- Execution code ---*/
|
||||
|
@ -3812,7 +3812,7 @@ PyMODINIT_FUNC PyInit_netfilterqueue(void)
|
|||
/* "netfilterqueue.pyx":127
|
||||
* nfq_close(self.h)
|
||||
*
|
||||
* def bind(self, int queue_num, u_int32_t maxlen=DEFAULT_MAX_QUEUELEN, u_int8_t mode=NFQNL_COPY_PACKET, u_int32_t range=MaxPacketSize): # <<<<<<<<<<<<<<
|
||||
* def bind(self, int queue_num, u_int32_t max_len=DEFAULT_MAX_QUEUELEN, u_int8_t mode=NFQNL_COPY_PACKET, u_int32_t range=MaxPacketSize): # <<<<<<<<<<<<<<
|
||||
* """Create and bind to a new queue."""
|
||||
* self.qh = nfq_create_queue(self.h, queue_num, <nfq_callback*>global_callback, <void*>self)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue