diff --git a/netfilterqueue.c b/netfilterqueue.c index 77b8c15..4b3badf 100644 --- a/netfilterqueue.c +++ b/netfilterqueue.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.15.1 on Fri Oct 14 08:35:07 2011 */ +/* Generated by Cython 0.15.1 on Mon Dec 24 11:15:48 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -240,6 +240,7 @@ #include "libnetfilter_queue/linux_nfnetlink_queue.h" #include "libnetfilter_queue/libnetfilter_queue.h" #include "sys/socket.h" +#include "string.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -421,7 +422,7 @@ struct __pyx_obj_14netfilterqueue_Packet { int _verdict_is_set; int _mark_is_set; u_int32_t _given_mark; - unsigned char *_given_payload; + PyObject *_given_payload; u_int32_t id; u_int16_t hw_protocol; u_int8_t hook; @@ -431,7 +432,7 @@ struct __pyx_obj_14netfilterqueue_Packet { }; -/* "netfilterqueue.pxd":186 +/* "netfilterqueue.pxd":187 * cpdef drop(self) * * cdef class NetfilterQueue: # <<<<<<<<<<<<<< @@ -449,11 +450,11 @@ struct __pyx_obj_14netfilterqueue_NetfilterQueue { -/* "netfilterqueue.pyx":34 +/* "netfilterqueue.pyx":35 * return 1 * * cdef class Packet: # <<<<<<<<<<<<<< - * """A packet received from QueueHandler.""" + * """A packet received from NetfilterQueue.""" * def __cinit__(self): */ @@ -462,6 +463,7 @@ struct __pyx_vtabstruct_14netfilterqueue_Packet { void (*verdict)(struct __pyx_obj_14netfilterqueue_Packet *, u_int8_t); Py_ssize_t (*get_payload_len)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch); double (*get_timestamp)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch); + PyObject *(*set_payload)(struct __pyx_obj_14netfilterqueue_Packet *, PyObject *, int __pyx_skip_dispatch); PyObject *(*set_mark)(struct __pyx_obj_14netfilterqueue_Packet *, u_int32_t, int __pyx_skip_dispatch); PyObject *(*accept)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch); PyObject *(*drop)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch); @@ -529,6 +531,9 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { PyObject* value; #if PY_MAJOR_VERSION >= 3 @@ -620,6 +625,8 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from 'libc.string' */ + /* Module declarations from 'netfilterqueue' */ static PyTypeObject *__pyx_ptype_14netfilterqueue_Packet = 0; static PyTypeObject *__pyx_ptype_14netfilterqueue_NetfilterQueue = 0; @@ -638,7 +645,7 @@ static char __pyx_k_7[] = "Failed to open NFQueue."; 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[] = "\nBind to a Linux netfilter queue. Send packets to a user-specified callback \nfunction.\n\nCopyright: (c) 2011 Kerkhoff Technologies Inc.\nLicense: GPL\n"; +static char __pyx_k_15[] = "\nBind to a Linux netfilter queue. Send packets to a user-specified callback \nfunction.\n\nCopyright: (c) 2011, Kerkhoff Technologies Inc.\nLicense: MIT; see LICENSE.txt\n"; static char __pyx_k_17[] = "DEFAULT_MAX_QUEUELEN"; static char __pyx_k_18[] = "BBN-RCC-MON"; static char __pyx_k_19[] = "NVP-II"; @@ -799,6 +806,7 @@ static char __pyx_k__KRYPTOLAN[] = "KRYPTOLAN"; static char __pyx_k__PROTOCOLS[] = "PROTOCOLS"; static char __pyx_k__queue_num[] = "queue_num"; static char __pyx_k__COPY_PACKET[] = "COPY_PACKET"; +static char __pyx_k__set_payload[] = "set_payload"; static char __pyx_k__get_timestamp[] = "get_timestamp"; static char __pyx_k__user_callback[] = "user_callback"; static char __pyx_k__RuntimeWarning[] = "RuntimeWarning"; @@ -974,6 +982,7 @@ static PyObject *__pyx_n_s__mode; static PyObject *__pyx_n_s__queue_num; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__set_mark; +static PyObject *__pyx_n_s__set_payload; static PyObject *__pyx_n_s__user_callback; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; @@ -1126,12 +1135,12 @@ static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_16; -/* "netfilterqueue.pyx":23 +/* "netfilterqueue.pyx":24 * DEF MaxCopySize = BufferSize - MetadataSize * * cdef int global_callback(nfq_q_handle *qh, nfgenmsg *nfmsg, # <<<<<<<<<<<<<< * nfq_data *nfa, void *data) with gil: - * """Create a Packet and pass it to appropriate Python/Cython callback.""" + * """Create a Packet and pass it to appropriate callback.""" */ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v_qh, struct nfgenmsg *__pyx_v_nfmsg, struct nfq_data *__pyx_v_nfa, void *__pyx_v_data) { @@ -1150,9 +1159,9 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v #endif __Pyx_RefNannySetupContext("global_callback"); - /* "netfilterqueue.pyx":26 + /* "netfilterqueue.pyx":27 * nfq_data *nfa, void *data) with gil: - * """Create a Packet and pass it to appropriate Python/Cython callback.""" + * """Create a Packet and pass it to appropriate callback.""" * cdef NetfilterQueue nfqueue = data # <<<<<<<<<<<<<< * cdef object user_callback = nfqueue.user_callback * @@ -1160,8 +1169,8 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v __Pyx_INCREF(((PyObject *)((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_data))); __pyx_v_nfqueue = ((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_data); - /* "netfilterqueue.pyx":27 - * """Create a Packet and pass it to appropriate Python/Cython callback.""" + /* "netfilterqueue.pyx":28 + * """Create a Packet and pass it to appropriate callback.""" * cdef NetfilterQueue nfqueue = data * cdef object user_callback = nfqueue.user_callback # <<<<<<<<<<<<<< * @@ -1170,47 +1179,47 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v __Pyx_INCREF(((PyObject *)__pyx_v_nfqueue->user_callback)); __pyx_v_user_callback = __pyx_v_nfqueue->user_callback; - /* "netfilterqueue.pyx":29 + /* "netfilterqueue.pyx":30 * cdef object user_callback = nfqueue.user_callback * * packet = Packet() # <<<<<<<<<<<<<< * packet.set_nfq_data(qh, nfa) * user_callback(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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_packet = ((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_t_1); __pyx_t_1 = 0; - /* "netfilterqueue.pyx":30 + /* "netfilterqueue.pyx":31 * * packet = Packet() * packet.set_nfq_data(qh, nfa) # <<<<<<<<<<<<<< * user_callback(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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "netfilterqueue.pyx":31 + /* "netfilterqueue.pyx":32 * packet = Packet() * packet.set_nfq_data(qh, nfa) * user_callback(packet) # <<<<<<<<<<<<<< * return 1 * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_packet)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_packet)); __Pyx_GIVEREF(((PyObject *)__pyx_v_packet)); - __pyx_t_2 = PyObject_Call(__pyx_v_user_callback, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_v_user_callback, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "netfilterqueue.pyx":32 + /* "netfilterqueue.pyx":33 * packet.set_nfq_data(qh, nfa) * user_callback(packet) * return 1 # <<<<<<<<<<<<<< @@ -1238,9 +1247,9 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v return __pyx_r; } -/* "netfilterqueue.pyx":36 +/* "netfilterqueue.pyx":37 * cdef class Packet: - * """A packet received from QueueHandler.""" + * """A packet received from NetfilterQueue.""" * def __cinit__(self): # <<<<<<<<<<<<<< * self._verdict_is_set = False * self._mark_is_set = False @@ -1255,40 +1264,44 @@ static int __pyx_pf_14netfilterqueue_6Packet___cinit__(PyObject *__pyx_v_self, P __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; - /* "netfilterqueue.pyx":37 - * """A packet received from QueueHandler.""" + /* "netfilterqueue.pyx":38 + * """A packet received from NetfilterQueue.""" * def __cinit__(self): * self._verdict_is_set = False # <<<<<<<<<<<<<< * self._mark_is_set = False - * self._given_payload = NULL + * self._given_payload = None */ ((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->_verdict_is_set = 0; - /* "netfilterqueue.pyx":38 + /* "netfilterqueue.pyx":39 * def __cinit__(self): * self._verdict_is_set = False * self._mark_is_set = False # <<<<<<<<<<<<<< - * self._given_payload = NULL + * self._given_payload = None * */ ((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->_mark_is_set = 0; - /* "netfilterqueue.pyx":39 + /* "netfilterqueue.pyx":40 * self._verdict_is_set = False * self._mark_is_set = False - * self._given_payload = NULL # <<<<<<<<<<<<<< + * self._given_payload = None # <<<<<<<<<<<<<< * * def __str__(self): */ - ((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->_given_payload = NULL; + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->_given_payload); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->_given_payload)); + ((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->_given_payload = ((PyObject*)Py_None); __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "netfilterqueue.pyx":41 - * self._given_payload = NULL +/* "netfilterqueue.pyx":42 + * self._given_payload = None * * def __str__(self): # <<<<<<<<<<<<<< * cdef iphdr *hdr = self.payload @@ -1309,7 +1322,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_1__str__(PyObject *__pyx_v_se int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__"); - /* "netfilterqueue.pyx":42 + /* "netfilterqueue.pyx":43 * * def __str__(self): * cdef iphdr *hdr = self.payload # <<<<<<<<<<<<<< @@ -1318,21 +1331,21 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_1__str__(PyObject *__pyx_v_se */ __pyx_v_hdr = ((struct iphdr *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->payload); - /* "netfilterqueue.pyx":43 + /* "netfilterqueue.pyx":44 * def __str__(self): * cdef iphdr *hdr = self.payload * protocol = PROTOCOLS.get(hdr.protocol, "Unknown protocol") # <<<<<<<<<<<<<< * return "%s packet, %s bytes" % (protocol, self.payload_len) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__PROTOCOLS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__PROTOCOLS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_u_int8_t(__pyx_v_hdr->protocol); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_u_int8_t(__pyx_v_hdr->protocol); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -1340,14 +1353,14 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_1__str__(PyObject *__pyx_v_se PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_v_protocol = __pyx_t_1; __pyx_t_1 = 0; - /* "netfilterqueue.pyx":44 + /* "netfilterqueue.pyx":45 * cdef iphdr *hdr = self.payload * protocol = PROTOCOLS.get(hdr.protocol, "Unknown protocol") * return "%s packet, %s bytes" % (protocol, self.payload_len) # <<<<<<<<<<<<<< @@ -1355,9 +1368,9 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_1__str__(PyObject *__pyx_v_se * cdef set_nfq_data(self, nfq_q_handle *qh, nfq_data *nfa): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->payload_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->payload_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_protocol); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_protocol); @@ -1365,7 +1378,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_1__str__(PyObject *__pyx_v_se PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = ((PyObject *)__pyx_t_1); @@ -1387,7 +1400,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_1__str__(PyObject *__pyx_v_se return __pyx_r; } -/* "netfilterqueue.pyx":46 +/* "netfilterqueue.pyx":47 * return "%s packet, %s bytes" % (protocol, self.payload_len) * * cdef set_nfq_data(self, nfq_q_handle *qh, nfq_data *nfa): # <<<<<<<<<<<<<< @@ -1405,7 +1418,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_nfq_data"); - /* "netfilterqueue.pyx":51 + /* "netfilterqueue.pyx":52 * local values. * """ * self._qh = qh # <<<<<<<<<<<<<< @@ -1414,7 +1427,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->_qh = __pyx_v_qh; - /* "netfilterqueue.pyx":52 + /* "netfilterqueue.pyx":53 * """ * self._qh = qh * self._nfa = nfa # <<<<<<<<<<<<<< @@ -1423,7 +1436,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->_nfa = __pyx_v_nfa; - /* "netfilterqueue.pyx":53 + /* "netfilterqueue.pyx":54 * self._qh = qh * self._nfa = nfa * self._hdr = nfq_get_msg_packet_hdr(nfa) # <<<<<<<<<<<<<< @@ -1432,7 +1445,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->_hdr = nfq_get_msg_packet_hdr(__pyx_v_nfa); - /* "netfilterqueue.pyx":55 + /* "netfilterqueue.pyx":56 * self._hdr = nfq_get_msg_packet_hdr(nfa) * * self.id = ntohl(self._hdr.packet_id) # <<<<<<<<<<<<<< @@ -1441,7 +1454,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->id = ntohl(__pyx_v_self->_hdr->packet_id); - /* "netfilterqueue.pyx":56 + /* "netfilterqueue.pyx":57 * * self.id = ntohl(self._hdr.packet_id) * self.hw_protocol = ntohs(self._hdr.hw_protocol) # <<<<<<<<<<<<<< @@ -1450,7 +1463,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->hw_protocol = ntohs(__pyx_v_self->_hdr->hw_protocol); - /* "netfilterqueue.pyx":57 + /* "netfilterqueue.pyx":58 * self.id = ntohl(self._hdr.packet_id) * self.hw_protocol = ntohs(self._hdr.hw_protocol) * self.hook = self._hdr.hook # <<<<<<<<<<<<<< @@ -1459,7 +1472,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->hook = __pyx_v_self->_hdr->hook; - /* "netfilterqueue.pyx":59 + /* "netfilterqueue.pyx":60 * self.hook = self._hdr.hook * * self.payload_len = nfq_get_payload(self._nfa, &self.payload) # <<<<<<<<<<<<<< @@ -1468,7 +1481,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->payload_len = nfq_get_payload(__pyx_v_self->_nfa, (&__pyx_v_self->payload)); - /* "netfilterqueue.pyx":60 + /* "netfilterqueue.pyx":61 * * self.payload_len = nfq_get_payload(self._nfa, &self.payload) * if self.payload_len < 0: # <<<<<<<<<<<<<< @@ -1478,23 +1491,23 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ __pyx_t_1 = (__pyx_v_self->payload_len < 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":61 + /* "netfilterqueue.pyx":62 * self.payload_len = nfq_get_payload(self._nfa, &self.payload) * if self.payload_len < 0: * raise OSError("Failed to get payload of packet.") # <<<<<<<<<<<<<< * * nfq_get_timestamp(self._nfa, &self.timestamp) */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "netfilterqueue.pyx":63 + /* "netfilterqueue.pyx":64 * raise OSError("Failed to get payload of packet.") * * nfq_get_timestamp(self._nfa, &self.timestamp) # <<<<<<<<<<<<<< @@ -1515,7 +1528,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ return __pyx_r; } -/* "netfilterqueue.pyx":65 +/* "netfilterqueue.pyx":66 * nfq_get_timestamp(self._nfa, &self.timestamp) * * cdef void verdict(self, u_int8_t verdict): # <<<<<<<<<<<<<< @@ -1524,14 +1537,19 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilterqueue_Packet *__pyx_v_self, u_int8_t __pyx_v_verdict) { + u_int32_t __pyx_v_modified_payload_len; + unsigned char *__pyx_v_modified_payload; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + unsigned char *__pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("verdict"); - /* "netfilterqueue.pyx":67 + /* "netfilterqueue.pyx":68 * cdef void verdict(self, u_int8_t verdict): * """Call appropriate set_verdict... function on packet.""" * if self._verdict_is_set: # <<<<<<<<<<<<<< @@ -1540,56 +1558,113 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte */ if (__pyx_v_self->_verdict_is_set) { - /* "netfilterqueue.pyx":68 + /* "netfilterqueue.pyx":69 * """Call appropriate set_verdict... function on packet.""" * if self._verdict_is_set: * raise RuntimeWarning("Verdict already given for this packet.") # <<<<<<<<<<<<<< * - * if self._mark_is_set: + * cdef u_int32_t modified_payload_len = 0 */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeWarning, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeWarning, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "netfilterqueue.pyx":70 + /* "netfilterqueue.pyx":71 * raise RuntimeWarning("Verdict already given for this packet.") * - * if self._mark_is_set: # <<<<<<<<<<<<<< - * nfq_set_verdict_mark( # TODO: make this use nfq_set_verdict2 if available on system - * self._qh, + * cdef u_int32_t modified_payload_len = 0 # <<<<<<<<<<<<<< + * cdef unsigned char *modified_payload = NULL + * if self._given_payload: */ - if (__pyx_v_self->_mark_is_set) { + __pyx_v_modified_payload_len = 0; - /* "netfilterqueue.pyx":77 - * htonl(self._given_mark), - * 0, # TODO: adapt to use self._given_payload - * NULL # TODO: adapt to use self._given_payload # <<<<<<<<<<<<<< - * ) - * else: - */ - nfq_set_verdict_mark(__pyx_v_self->_qh, __pyx_v_self->id, __pyx_v_verdict, htonl(__pyx_v_self->_given_mark), 0, NULL); - goto __pyx_L4; - } - /*else*/ { - - /* "netfilterqueue.pyx":85 - * verdict, - * 0, # TODO: adapt to use self._given_payload - * NULL # TODO: adapt to use self._given_payload # <<<<<<<<<<<<<< - * ) + /* "netfilterqueue.pyx":72 * + * cdef u_int32_t modified_payload_len = 0 + * cdef unsigned char *modified_payload = NULL # <<<<<<<<<<<<<< + * if self._given_payload: + * modified_payload_len = len(self._given_payload) */ - nfq_set_verdict(__pyx_v_self->_qh, __pyx_v_self->id, __pyx_v_verdict, 0, NULL); + __pyx_v_modified_payload = NULL; + + /* "netfilterqueue.pyx":73 + * cdef u_int32_t modified_payload_len = 0 + * cdef unsigned char *modified_payload = NULL + * if self._given_payload: # <<<<<<<<<<<<<< + * modified_payload_len = len(self._given_payload) + * modified_payload = self._given_payload + */ + __pyx_t_2 = (((PyObject *)__pyx_v_self->_given_payload) != Py_None) && (PyBytes_GET_SIZE(((PyObject *)__pyx_v_self->_given_payload)) != 0); + if (__pyx_t_2) { + + /* "netfilterqueue.pyx":74 + * cdef unsigned char *modified_payload = NULL + * if self._given_payload: + * modified_payload_len = len(self._given_payload) # <<<<<<<<<<<<<< + * modified_payload = self._given_payload + * if self._mark_is_set: + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->_given_payload); + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyBytes_GET_SIZE(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_modified_payload_len = __pyx_t_3; + + /* "netfilterqueue.pyx":75 + * if self._given_payload: + * modified_payload_len = len(self._given_payload) + * modified_payload = self._given_payload # <<<<<<<<<<<<<< + * if self._mark_is_set: + * nfq_set_verdict_mark( # TODO: make this use nfq_set_verdict2 if + */ + __pyx_t_4 = __Pyx_PyBytes_AsUString(((PyObject *)__pyx_v_self->_given_payload)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_modified_payload = __pyx_t_4; + goto __pyx_L4; } __pyx_L4:; - /* "netfilterqueue.pyx":88 - * ) + /* "netfilterqueue.pyx":76 + * modified_payload_len = len(self._given_payload) + * modified_payload = self._given_payload + * if self._mark_is_set: # <<<<<<<<<<<<<< + * nfq_set_verdict_mark( # TODO: make this use nfq_set_verdict2 if + * # available on system + */ + if (__pyx_v_self->_mark_is_set) { + + /* "netfilterqueue.pyx":84 + * htonl(self._given_mark), + * modified_payload_len, + * modified_payload) # <<<<<<<<<<<<<< + * else: + * nfq_set_verdict( + */ + nfq_set_verdict_mark(__pyx_v_self->_qh, __pyx_v_self->id, __pyx_v_verdict, htonl(__pyx_v_self->_given_mark), __pyx_v_modified_payload_len, __pyx_v_modified_payload); + goto __pyx_L5; + } + /*else*/ { + + /* "netfilterqueue.pyx":91 + * verdict, + * modified_payload_len, + * modified_payload) # <<<<<<<<<<<<<< + * + * self._verdict_is_set = True + */ + nfq_set_verdict(__pyx_v_self->_qh, __pyx_v_self->id, __pyx_v_verdict, __pyx_v_modified_payload_len, __pyx_v_modified_payload); + } + __pyx_L5:; + + /* "netfilterqueue.pyx":93 + * modified_payload) * * self._verdict_is_set = True # <<<<<<<<<<<<<< * @@ -1605,12 +1680,12 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte __Pyx_RefNannyFinishContext(); } -/* "netfilterqueue.pyx":90 +/* "netfilterqueue.pyx":95 * self._verdict_is_set = True * * def get_payload(self): # <<<<<<<<<<<<<< * """Return payload as Python string.""" - * cdef object py_string = PyString_FromStringAndSize(self.payload, self.payload_len) + * cdef object py_string = PyString_FromStringAndSize(self.payload, */ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2get_payload(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ @@ -1625,21 +1700,21 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2get_payload(PyObject *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_payload"); - /* "netfilterqueue.pyx":92 - * def get_payload(self): + /* "netfilterqueue.pyx":98 * """Return payload as Python string.""" - * cdef object py_string = PyString_FromStringAndSize(self.payload, self.payload_len) # <<<<<<<<<<<<<< + * cdef object py_string = PyString_FromStringAndSize(self.payload, + * self.payload_len) # <<<<<<<<<<<<<< * return py_string * */ - __pyx_t_1 = PyString_FromStringAndSize(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->payload, ((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->payload_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyString_FromStringAndSize(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->payload, ((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->payload_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_string = __pyx_t_1; __pyx_t_1 = 0; - /* "netfilterqueue.pyx":93 - * """Return payload as Python string.""" - * cdef object py_string = PyString_FromStringAndSize(self.payload, self.payload_len) + /* "netfilterqueue.pyx":99 + * cdef object py_string = PyString_FromStringAndSize(self.payload, + * self.payload_len) * return py_string # <<<<<<<<<<<<<< * * cpdef Py_ssize_t get_payload_len(self): @@ -1662,7 +1737,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2get_payload(PyObject *__pyx_ return __pyx_r; } -/* "netfilterqueue.pyx":95 +/* "netfilterqueue.pyx":101 * return py_string * * cpdef Py_ssize_t get_payload_len(self): # <<<<<<<<<<<<<< @@ -1685,12 +1760,12 @@ static Py_ssize_t __pyx_f_14netfilterqueue_6Packet_get_payload_len(struct __pyx_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_payload_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_payload_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_14netfilterqueue_6Packet_3get_payload_len)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -1699,7 +1774,7 @@ static Py_ssize_t __pyx_f_14netfilterqueue_6Packet_get_payload_len(struct __pyx_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":96 + /* "netfilterqueue.pyx":102 * * cpdef Py_ssize_t get_payload_len(self): * return self.payload_len # <<<<<<<<<<<<<< @@ -1721,7 +1796,7 @@ static Py_ssize_t __pyx_f_14netfilterqueue_6Packet_get_payload_len(struct __pyx_ return __pyx_r; } -/* "netfilterqueue.pyx":95 +/* "netfilterqueue.pyx":101 * return py_string * * cpdef Py_ssize_t get_payload_len(self): # <<<<<<<<<<<<<< @@ -1739,7 +1814,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_3get_payload_len(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_payload_len"); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->get_payload_len(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->get_payload_len(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1757,7 +1832,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_3get_payload_len(PyObject *__ return __pyx_r; } -/* "netfilterqueue.pyx":98 +/* "netfilterqueue.pyx":104 * return self.payload_len * * cpdef double get_timestamp(self): # <<<<<<<<<<<<<< @@ -1780,12 +1855,12 @@ static double __pyx_f_14netfilterqueue_6Packet_get_timestamp(struct __pyx_obj_14 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_timestamp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_timestamp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_14netfilterqueue_6Packet_4get_timestamp)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -1794,12 +1869,12 @@ static double __pyx_f_14netfilterqueue_6Packet_get_timestamp(struct __pyx_obj_14 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":99 + /* "netfilterqueue.pyx":105 * * cpdef double get_timestamp(self): * return self.timestamp.tv_sec + (self.timestamp.tv_usec/1000000.0) # <<<<<<<<<<<<<< * - * # TODO: implement this + * cpdef set_payload(self, bytes payload): */ __pyx_r = (__pyx_v_self->timestamp.tv_sec + (__pyx_v_self->timestamp.tv_usec / 1000000.0)); goto __pyx_L0; @@ -1816,7 +1891,7 @@ static double __pyx_f_14netfilterqueue_6Packet_get_timestamp(struct __pyx_obj_14 return __pyx_r; } -/* "netfilterqueue.pyx":98 +/* "netfilterqueue.pyx":104 * return self.payload_len * * cpdef double get_timestamp(self): # <<<<<<<<<<<<<< @@ -1834,7 +1909,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4get_timestamp(PyObject *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_timestamp"); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->get_timestamp(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->get_timestamp(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1852,15 +1927,123 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4get_timestamp(PyObject *__py return __pyx_r; } -/* "netfilterqueue.pyx":106 - * # self._given_payload = payload +/* "netfilterqueue.pyx":107 + * return self.timestamp.tv_sec + (self.timestamp.tv_usec/1000000.0) + * + * cpdef set_payload(self, bytes payload): # <<<<<<<<<<<<<< + * """Set the new payload of this packet.""" + * self._given_payload = payload + */ + +static PyObject *__pyx_pf_14netfilterqueue_6Packet_5set_payload(PyObject *__pyx_v_self, PyObject *__pyx_v_payload); /*proto*/ +static PyObject *__pyx_f_14netfilterqueue_6Packet_set_payload(struct __pyx_obj_14netfilterqueue_Packet *__pyx_v_self, PyObject *__pyx_v_payload, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_payload"); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__set_payload); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_14netfilterqueue_6Packet_5set_payload)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_payload)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_payload)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_payload)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "netfilterqueue.pyx":109 + * cpdef set_payload(self, bytes payload): + * """Set the new payload of this packet.""" + * self._given_payload = payload # <<<<<<<<<<<<<< + * + * cpdef set_mark(self, u_int32_t mark): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_payload)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_payload)); + __Pyx_GOTREF(__pyx_v_self->_given_payload); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_given_payload)); + __pyx_v_self->_given_payload = __pyx_v_payload; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("netfilterqueue.Packet.set_payload", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "netfilterqueue.pyx":107 + * return self.timestamp.tv_sec + (self.timestamp.tv_usec/1000000.0) + * + * cpdef set_payload(self, bytes payload): # <<<<<<<<<<<<<< + * """Set the new payload of this packet.""" + * self._given_payload = payload + */ + +static PyObject *__pyx_pf_14netfilterqueue_6Packet_5set_payload(PyObject *__pyx_v_self, PyObject *__pyx_v_payload); /*proto*/ +static char __pyx_doc_14netfilterqueue_6Packet_5set_payload[] = "Set the new payload of this packet."; +static PyObject *__pyx_pf_14netfilterqueue_6Packet_5set_payload(PyObject *__pyx_v_self, PyObject *__pyx_v_payload) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_payload"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload), (&PyBytes_Type), 1, "payload", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->set_payload(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), __pyx_v_payload, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("netfilterqueue.Packet.set_payload", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "netfilterqueue.pyx":111 + * self._given_payload = payload * * cpdef set_mark(self, u_int32_t mark): # <<<<<<<<<<<<<< * self._given_mark = mark * self._mark_is_set = True */ -static PyObject *__pyx_pf_14netfilterqueue_6Packet_5set_mark(PyObject *__pyx_v_self, PyObject *__pyx_arg_mark); /*proto*/ +static PyObject *__pyx_pf_14netfilterqueue_6Packet_6set_mark(PyObject *__pyx_v_self, PyObject *__pyx_arg_mark); /*proto*/ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_mark(struct __pyx_obj_14netfilterqueue_Packet *__pyx_v_self, u_int32_t __pyx_v_mark, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -1875,18 +2058,18 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_mark(struct __pyx_obj_14ne if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__set_mark); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__set_mark); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_14netfilterqueue_6Packet_5set_mark)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_14netfilterqueue_6Packet_6set_mark)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_to_py_u_int32_t(__pyx_v_mark); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_u_int32_t(__pyx_v_mark); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -1897,7 +2080,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_mark(struct __pyx_obj_14ne __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":107 + /* "netfilterqueue.pyx":112 * * cpdef set_mark(self, u_int32_t mark): * self._given_mark = mark # <<<<<<<<<<<<<< @@ -1906,7 +2089,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_mark(struct __pyx_obj_14ne */ __pyx_v_self->_given_mark = __pyx_v_mark; - /* "netfilterqueue.pyx":108 + /* "netfilterqueue.pyx":113 * cpdef set_mark(self, u_int32_t mark): * self._given_mark = mark * self._mark_is_set = True # <<<<<<<<<<<<<< @@ -1929,16 +2112,16 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_mark(struct __pyx_obj_14ne return __pyx_r; } -/* "netfilterqueue.pyx":106 - * # self._given_payload = payload +/* "netfilterqueue.pyx":111 + * self._given_payload = payload * * cpdef set_mark(self, u_int32_t mark): # <<<<<<<<<<<<<< * self._given_mark = mark * self._mark_is_set = True */ -static PyObject *__pyx_pf_14netfilterqueue_6Packet_5set_mark(PyObject *__pyx_v_self, PyObject *__pyx_arg_mark); /*proto*/ -static PyObject *__pyx_pf_14netfilterqueue_6Packet_5set_mark(PyObject *__pyx_v_self, PyObject *__pyx_arg_mark) { +static PyObject *__pyx_pf_14netfilterqueue_6Packet_6set_mark(PyObject *__pyx_v_self, PyObject *__pyx_arg_mark); /*proto*/ +static PyObject *__pyx_pf_14netfilterqueue_6Packet_6set_mark(PyObject *__pyx_v_self, PyObject *__pyx_arg_mark) { u_int32_t __pyx_v_mark; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -1948,7 +2131,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_5set_mark(PyObject *__pyx_v_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_mark"); assert(__pyx_arg_mark); { - __pyx_v_mark = __Pyx_PyInt_from_py_u_int32_t(__pyx_arg_mark); if (unlikely((__pyx_v_mark == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mark = __Pyx_PyInt_from_py_u_int32_t(__pyx_arg_mark); if (unlikely((__pyx_v_mark == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -1957,7 +2140,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_5set_mark(PyObject *__pyx_v_s return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->set_mark(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), __pyx_v_mark, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->set_mark(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), __pyx_v_mark, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1975,7 +2158,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_5set_mark(PyObject *__pyx_v_s return __pyx_r; } -/* "netfilterqueue.pyx":110 +/* "netfilterqueue.pyx":115 * self._mark_is_set = True * * cpdef accept(self): # <<<<<<<<<<<<<< @@ -1983,7 +2166,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_5set_mark(PyObject *__pyx_v_s * self.verdict(NF_ACCEPT) */ -static PyObject *__pyx_pf_14netfilterqueue_6Packet_6accept(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_14netfilterqueue_6Packet_7accept(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_14netfilterqueue_6Packet_accept(struct __pyx_obj_14netfilterqueue_Packet *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -1997,11 +2180,11 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_accept(struct __pyx_obj_14netf if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__accept); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__accept); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_14netfilterqueue_6Packet_6accept)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_14netfilterqueue_6Packet_7accept)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -2011,7 +2194,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_accept(struct __pyx_obj_14netf __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":112 + /* "netfilterqueue.pyx":117 * cpdef accept(self): * """Accept the packet.""" * self.verdict(NF_ACCEPT) # <<<<<<<<<<<<<< @@ -2033,7 +2216,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_accept(struct __pyx_obj_14netf return __pyx_r; } -/* "netfilterqueue.pyx":110 +/* "netfilterqueue.pyx":115 * self._mark_is_set = True * * cpdef accept(self): # <<<<<<<<<<<<<< @@ -2041,9 +2224,9 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_accept(struct __pyx_obj_14netf * self.verdict(NF_ACCEPT) */ -static PyObject *__pyx_pf_14netfilterqueue_6Packet_6accept(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_14netfilterqueue_6Packet_6accept[] = "Accept the packet."; -static PyObject *__pyx_pf_14netfilterqueue_6Packet_6accept(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_14netfilterqueue_6Packet_7accept(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_14netfilterqueue_6Packet_7accept[] = "Accept the packet."; +static PyObject *__pyx_pf_14netfilterqueue_6Packet_7accept(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2052,7 +2235,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_6accept(PyObject *__pyx_v_sel int __pyx_clineno = 0; __Pyx_RefNannySetupContext("accept"); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->accept(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->accept(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2070,7 +2253,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_6accept(PyObject *__pyx_v_sel return __pyx_r; } -/* "netfilterqueue.pyx":114 +/* "netfilterqueue.pyx":119 * self.verdict(NF_ACCEPT) * * cpdef drop(self): # <<<<<<<<<<<<<< @@ -2078,7 +2261,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_6accept(PyObject *__pyx_v_sel * self.verdict(NF_DROP) */ -static PyObject *__pyx_pf_14netfilterqueue_6Packet_7drop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_14netfilterqueue_6Packet_8drop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_14netfilterqueue_6Packet_drop(struct __pyx_obj_14netfilterqueue_Packet *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2092,11 +2275,11 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_drop(struct __pyx_obj_14netfil if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__drop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__drop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_14netfilterqueue_6Packet_7drop)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_14netfilterqueue_6Packet_8drop)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -2106,7 +2289,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_drop(struct __pyx_obj_14netfil __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":116 + /* "netfilterqueue.pyx":121 * cpdef drop(self): * """Drop the packet.""" * self.verdict(NF_DROP) # <<<<<<<<<<<<<< @@ -2128,7 +2311,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_drop(struct __pyx_obj_14netfil return __pyx_r; } -/* "netfilterqueue.pyx":114 +/* "netfilterqueue.pyx":119 * self.verdict(NF_ACCEPT) * * cpdef drop(self): # <<<<<<<<<<<<<< @@ -2136,9 +2319,9 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_drop(struct __pyx_obj_14netfil * self.verdict(NF_DROP) */ -static PyObject *__pyx_pf_14netfilterqueue_6Packet_7drop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_14netfilterqueue_6Packet_7drop[] = "Drop the packet."; -static PyObject *__pyx_pf_14netfilterqueue_6Packet_7drop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_14netfilterqueue_6Packet_8drop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_14netfilterqueue_6Packet_8drop[] = "Drop the packet."; +static PyObject *__pyx_pf_14netfilterqueue_6Packet_8drop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2147,7 +2330,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_7drop(PyObject *__pyx_v_self, int __pyx_clineno = 0; __Pyx_RefNannySetupContext("drop"); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->drop(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self)->__pyx_vtab)->drop(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2309,7 +2492,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_7payload___get__(PyObject *__ return __pyx_r; } -/* "netfilterqueue.pyx":120 +/* "netfilterqueue.pyx":125 * cdef class NetfilterQueue: * """Handle a single numbered queue.""" * def __cinit__(self, *args, **kwargs): # <<<<<<<<<<<<<< @@ -2338,7 +2521,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_ __Pyx_INCREF(__pyx_args); __pyx_v_args = __pyx_args; - /* "netfilterqueue.pyx":121 + /* "netfilterqueue.pyx":126 * """Handle a single numbered queue.""" * def __cinit__(self, *args, **kwargs): * self.af = kwargs.get("af", PF_INET) # <<<<<<<<<<<<<< @@ -2346,18 +2529,18 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_ * self.h = nfq_open() */ if (unlikely(((PyObject *)__pyx_v_kwargs) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = PyInt_FromLong(__pyx_e_14netfilterqueue_PF_INET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_e_14netfilterqueue_PF_INET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__af), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__af), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __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 = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 126; __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; - /* "netfilterqueue.pyx":123 + /* "netfilterqueue.pyx":128 * self.af = kwargs.get("af", PF_INET) * * self.h = nfq_open() # <<<<<<<<<<<<<< @@ -2366,7 +2549,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_ */ ((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h = nfq_open(); - /* "netfilterqueue.pyx":124 + /* "netfilterqueue.pyx":129 * * self.h = nfq_open() * if self.h == NULL: # <<<<<<<<<<<<<< @@ -2376,23 +2559,23 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_ __pyx_t_4 = (((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h == NULL); if (__pyx_t_4) { - /* "netfilterqueue.pyx":125 + /* "netfilterqueue.pyx":130 * self.h = nfq_open() * if self.h == NULL: * raise OSError("Failed to open NFQueue.") # <<<<<<<<<<<<<< * nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous * # running queues */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "netfilterqueue.pyx":126 + /* "netfilterqueue.pyx":131 * if self.h == NULL: * raise OSError("Failed to open NFQueue.") * nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous # <<<<<<<<<<<<<< @@ -2401,7 +2584,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_ */ nfq_unbind_pf(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h, ((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->af); - /* "netfilterqueue.pyx":128 + /* "netfilterqueue.pyx":133 * nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous * # running queues * if nfq_bind_pf(self.h, self.af) < 0: # <<<<<<<<<<<<<< @@ -2411,29 +2594,29 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_ __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); if (__pyx_t_4) { - /* "netfilterqueue.pyx":129 + /* "netfilterqueue.pyx":134 * # running queues * if nfq_bind_pf(self.h, self.af) < 0: * 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 = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 134; __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 = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; @@ -2452,7 +2635,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(PyObject *__pyx_ return __pyx_r; } -/* "netfilterqueue.pyx":131 +/* "netfilterqueue.pyx":136 * raise OSError("Failed to bind family %s. Are you root?" % self.af) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2466,7 +2649,7 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_1__dealloc__(PyObject *__ int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__"); - /* "netfilterqueue.pyx":132 + /* "netfilterqueue.pyx":137 * * def __dealloc__(self): * if self.qh != NULL: # <<<<<<<<<<<<<< @@ -2476,7 +2659,7 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_1__dealloc__(PyObject *__ __pyx_t_1 = (((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh != NULL); if (__pyx_t_1) { - /* "netfilterqueue.pyx":133 + /* "netfilterqueue.pyx":138 * def __dealloc__(self): * if self.qh != NULL: * nfq_destroy_queue(self.qh) # <<<<<<<<<<<<<< @@ -2488,24 +2671,24 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_1__dealloc__(PyObject *__ } __pyx_L5:; - /* "netfilterqueue.pyx":136 + /* "netfilterqueue.pyx":141 * # Don't call nfq_unbind_pf unless you want to disconnect any other * # processes using this libnetfilter_queue on this protocol family! * nfq_close(self.h) # <<<<<<<<<<<<<< * - * def bind(self, int queue_num, object user_callback, u_int32_t max_len=DEFAULT_MAX_QUEUELEN, + * def bind(self, int queue_num, object user_callback, */ nfq_close(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h); __Pyx_RefNannyFinishContext(); } -/* "netfilterqueue.pyx":138 +/* "netfilterqueue.pyx":143 * nfq_close(self.h) * - * def bind(self, int queue_num, object user_callback, 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.""" + * def bind(self, int queue_num, object user_callback, # <<<<<<<<<<<<<< + * u_int32_t max_len=DEFAULT_MAX_QUEUELEN, + * u_int8_t mode=NFQNL_COPY_PACKET, */ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ @@ -2549,7 +2732,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__user_callback); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("bind", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("bind", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { @@ -2568,7 +2751,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "bind") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "bind") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2581,39 +2764,39 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py default: goto __pyx_L5_argtuple_error; } } - __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 = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __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 = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_user_callback = values[1]; if (values[2]) { - __pyx_v_max_len = __Pyx_PyInt_from_py_u_int32_t(values[2]); if (unlikely((__pyx_v_max_len == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_len = __Pyx_PyInt_from_py_u_int32_t(values[2]); if (unlikely((__pyx_v_max_len == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_max_len = __pyx_k_10; } if (values[3]) { - __pyx_v_mode = __Pyx_PyInt_from_py_u_int8_t(values[3]); if (unlikely((__pyx_v_mode == (u_int8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mode = __Pyx_PyInt_from_py_u_int8_t(values[3]); if (unlikely((__pyx_v_mode == (u_int8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_mode = __pyx_k_11; } if (values[4]) { - __pyx_v_range = __Pyx_PyInt_from_py_u_int32_t(values[4]); if (unlikely((__pyx_v_range == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_range = __Pyx_PyInt_from_py_u_int32_t(values[4]); if (unlikely((__pyx_v_range == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_range = ((u_int32_t)65535); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("bind", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("bind", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("netfilterqueue.NetfilterQueue.bind", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - /* "netfilterqueue.pyx":141 - * u_int8_t mode=NFQNL_COPY_PACKET, u_int32_t range=MaxPacketSize): + /* "netfilterqueue.pyx":148 + * u_int32_t range=MaxPacketSize): * """Create and bind to a new queue.""" * self.user_callback = user_callback # <<<<<<<<<<<<<< - * self.qh = nfq_create_queue(self.h, queue_num, global_callback, self) - * if self.qh == NULL: + * self.qh = nfq_create_queue(self.h, queue_num, + * global_callback, self) */ __Pyx_INCREF(__pyx_v_user_callback); __Pyx_GIVEREF(__pyx_v_user_callback); @@ -2621,18 +2804,18 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py __Pyx_DECREF(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->user_callback); ((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->user_callback = __pyx_v_user_callback; - /* "netfilterqueue.pyx":142 + /* "netfilterqueue.pyx":149 * """Create and bind to a new queue.""" * self.user_callback = user_callback - * self.qh = nfq_create_queue(self.h, queue_num, global_callback, self) # <<<<<<<<<<<<<< + * self.qh = nfq_create_queue(self.h, queue_num, # <<<<<<<<<<<<<< + * global_callback, 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)); - /* "netfilterqueue.pyx":143 - * self.user_callback = user_callback - * self.qh = nfq_create_queue(self.h, queue_num, global_callback, self) + /* "netfilterqueue.pyx":151 + * self.qh = nfq_create_queue(self.h, queue_num, + * global_callback, self) * if self.qh == NULL: # <<<<<<<<<<<<<< * raise OSError("Failed to create queue %s." % queue_num) * @@ -2640,34 +2823,34 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py __pyx_t_1 = (((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh == NULL); if (__pyx_t_1) { - /* "netfilterqueue.pyx":144 - * self.qh = nfq_create_queue(self.h, queue_num, global_callback, self) + /* "netfilterqueue.pyx":152 + * global_callback, self) * if self.qh == NULL: * raise OSError("Failed to create queue %s." % queue_num) # <<<<<<<<<<<<<< * * if range > MaxCopySize: */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_queue_num); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_queue_num); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "netfilterqueue.pyx":146 + /* "netfilterqueue.pyx":154 * raise OSError("Failed to create queue %s." % queue_num) * * if range > MaxCopySize: # <<<<<<<<<<<<<< @@ -2677,7 +2860,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py __pyx_t_1 = (__pyx_v_range > 4016); if (__pyx_t_1) { - /* "netfilterqueue.pyx":147 + /* "netfilterqueue.pyx":155 * * if range > MaxCopySize: * range = MaxCopySize # <<<<<<<<<<<<<< @@ -2689,7 +2872,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py } __pyx_L7:; - /* "netfilterqueue.pyx":148 + /* "netfilterqueue.pyx":156 * if range > MaxCopySize: * range = MaxCopySize * if nfq_set_mode(self.qh, mode, range) < 0: # <<<<<<<<<<<<<< @@ -2699,23 +2882,23 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py __pyx_t_1 = (nfq_set_mode(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh, __pyx_v_mode, __pyx_v_range) < 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":149 + /* "netfilterqueue.pyx":157 * range = MaxCopySize * if nfq_set_mode(self.qh, mode, range) < 0: * raise OSError("Failed to set packet copy mode.") # <<<<<<<<<<<<<< * * 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 = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; - /* "netfilterqueue.pyx":151 + /* "netfilterqueue.pyx":159 * raise OSError("Failed to set packet copy mode.") * * nfq_set_queue_maxlen(self.qh, max_len) # <<<<<<<<<<<<<< @@ -2737,7 +2920,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_2bind(PyObject *__py return __pyx_r; } -/* "netfilterqueue.pyx":153 +/* "netfilterqueue.pyx":161 * nfq_set_queue_maxlen(self.qh, max_len) * * def unbind(self): # <<<<<<<<<<<<<< @@ -2753,7 +2936,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_3unbind(PyObject *__ int __pyx_t_1; __Pyx_RefNannySetupContext("unbind"); - /* "netfilterqueue.pyx":155 + /* "netfilterqueue.pyx":163 * def unbind(self): * """Destroy the queue.""" * if self.qh != NULL: # <<<<<<<<<<<<<< @@ -2763,7 +2946,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_3unbind(PyObject *__ __pyx_t_1 = (((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->qh != NULL); if (__pyx_t_1) { - /* "netfilterqueue.pyx":156 + /* "netfilterqueue.pyx":164 * """Destroy the queue.""" * if self.qh != NULL: * nfq_destroy_queue(self.qh) # <<<<<<<<<<<<<< @@ -2781,7 +2964,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_3unbind(PyObject *__ return __pyx_r; } -/* "netfilterqueue.pyx":159 +/* "netfilterqueue.pyx":167 * # See warning about nfq_unbind_pf in __dealloc__ above. * * def run(self): # <<<<<<<<<<<<<< @@ -2800,7 +2983,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx int __pyx_t_1; __Pyx_RefNannySetupContext("run"); - /* "netfilterqueue.pyx":161 + /* "netfilterqueue.pyx":169 * def run(self): * """Begin accepting packets.""" * cdef int fd = nfq_fd(self.h) # <<<<<<<<<<<<<< @@ -2809,7 +2992,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx */ __pyx_v_fd = nfq_fd(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h); - /* "netfilterqueue.pyx":164 + /* "netfilterqueue.pyx":172 * cdef char buf[BufferSize] * cdef int rv * with nogil: # <<<<<<<<<<<<<< @@ -2823,7 +3006,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx Py_UNBLOCK_THREADS /*try:*/ { - /* "netfilterqueue.pyx":165 + /* "netfilterqueue.pyx":173 * cdef int rv * with nogil: * rv = recv(fd, buf, sizeof(buf), 0) # <<<<<<<<<<<<<< @@ -2833,7 +3016,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx __pyx_v_rv = recv(__pyx_v_fd, __pyx_v_buf, (sizeof(__pyx_v_buf)), 0); } - /* "netfilterqueue.pyx":164 + /* "netfilterqueue.pyx":172 * cdef char buf[BufferSize] * cdef int rv * with nogil: # <<<<<<<<<<<<<< @@ -2845,7 +3028,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx } } - /* "netfilterqueue.pyx":166 + /* "netfilterqueue.pyx":174 * with nogil: * rv = recv(fd, buf, sizeof(buf), 0) * while rv >= 0: # <<<<<<<<<<<<<< @@ -2856,7 +3039,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx __pyx_t_1 = (__pyx_v_rv >= 0); if (!__pyx_t_1) break; - /* "netfilterqueue.pyx":167 + /* "netfilterqueue.pyx":175 * rv = recv(fd, buf, sizeof(buf), 0) * while rv >= 0: * nfq_handle_packet(self.h, buf, rv) # <<<<<<<<<<<<<< @@ -2865,7 +3048,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx */ nfq_handle_packet(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self)->h, __pyx_v_buf, __pyx_v_rv); - /* "netfilterqueue.pyx":168 + /* "netfilterqueue.pyx":176 * while rv >= 0: * nfq_handle_packet(self.h, buf, rv) * with nogil: # <<<<<<<<<<<<<< @@ -2879,7 +3062,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx Py_UNBLOCK_THREADS /*try:*/ { - /* "netfilterqueue.pyx":169 + /* "netfilterqueue.pyx":177 * nfq_handle_packet(self.h, buf, rv) * with nogil: * rv = recv(fd, buf, sizeof(buf), 0) # <<<<<<<<<<<<<< @@ -2889,7 +3072,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4run(PyObject *__pyx __pyx_v_rv = recv(__pyx_v_fd, __pyx_v_buf, (sizeof(__pyx_v_buf)), 0); } - /* "netfilterqueue.pyx":168 + /* "netfilterqueue.pyx":176 * while rv >= 0: * nfq_handle_packet(self.h, buf, rv) * with nogil: # <<<<<<<<<<<<<< @@ -2915,6 +3098,7 @@ static PyObject *__pyx_tp_new_14netfilterqueue_Packet(PyTypeObject *t, PyObject if (!o) return 0; p = ((struct __pyx_obj_14netfilterqueue_Packet *)o); p->__pyx_vtab = __pyx_vtabptr_14netfilterqueue_Packet; + p->_given_payload = ((PyObject*)Py_None); Py_INCREF(Py_None); if (__pyx_pf_14netfilterqueue_6Packet___cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } @@ -2922,9 +3106,29 @@ static PyObject *__pyx_tp_new_14netfilterqueue_Packet(PyTypeObject *t, PyObject } static void __pyx_tp_dealloc_14netfilterqueue_Packet(PyObject *o) { + struct __pyx_obj_14netfilterqueue_Packet *p = (struct __pyx_obj_14netfilterqueue_Packet *)o; + Py_XDECREF(((PyObject *)p->_given_payload)); (*Py_TYPE(o)->tp_free)(o); } +static int __pyx_tp_traverse_14netfilterqueue_Packet(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14netfilterqueue_Packet *p = (struct __pyx_obj_14netfilterqueue_Packet *)o; + if (p->_given_payload) { + e = (*v)(p->_given_payload, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14netfilterqueue_Packet(PyObject *o) { + struct __pyx_obj_14netfilterqueue_Packet *p = (struct __pyx_obj_14netfilterqueue_Packet *)o; + PyObject* tmp; + tmp = ((PyObject*)p->_given_payload); + p->_given_payload = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + static PyObject *__pyx_getprop_14netfilterqueue_6Packet_id(PyObject *o, void *x) { return __pyx_pf_14netfilterqueue_6Packet_2id___get__(o); } @@ -2945,9 +3149,10 @@ static PyMethodDef __pyx_methods_14netfilterqueue_Packet[] = { {__Pyx_NAMESTR("get_payload"), (PyCFunction)__pyx_pf_14netfilterqueue_6Packet_2get_payload, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_6Packet_2get_payload)}, {__Pyx_NAMESTR("get_payload_len"), (PyCFunction)__pyx_pf_14netfilterqueue_6Packet_3get_payload_len, METH_NOARGS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("get_timestamp"), (PyCFunction)__pyx_pf_14netfilterqueue_6Packet_4get_timestamp, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("set_mark"), (PyCFunction)__pyx_pf_14netfilterqueue_6Packet_5set_mark, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("accept"), (PyCFunction)__pyx_pf_14netfilterqueue_6Packet_6accept, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_6Packet_6accept)}, - {__Pyx_NAMESTR("drop"), (PyCFunction)__pyx_pf_14netfilterqueue_6Packet_7drop, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_6Packet_7drop)}, + {__Pyx_NAMESTR("set_payload"), (PyCFunction)__pyx_pf_14netfilterqueue_6Packet_5set_payload, METH_O, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_6Packet_5set_payload)}, + {__Pyx_NAMESTR("set_mark"), (PyCFunction)__pyx_pf_14netfilterqueue_6Packet_6set_mark, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("accept"), (PyCFunction)__pyx_pf_14netfilterqueue_6Packet_7accept, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_6Packet_7accept)}, + {__Pyx_NAMESTR("drop"), (PyCFunction)__pyx_pf_14netfilterqueue_6Packet_8drop, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_14netfilterqueue_6Packet_8drop)}, {0, 0, 0, 0} }; @@ -3081,10 +3286,10 @@ static PyTypeObject __pyx_type_14netfilterqueue_Packet = { 0, /*tp_getattro*/ 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 QueueHandler."), /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("A packet received from NetfilterQueue."), /*tp_doc*/ + __pyx_tp_traverse_14netfilterqueue_Packet, /*tp_traverse*/ + __pyx_tp_clear_14netfilterqueue_Packet, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -3517,12 +3722,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__queue_num, __pyx_k__queue_num, sizeof(__pyx_k__queue_num), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__set_mark, __pyx_k__set_mark, sizeof(__pyx_k__set_mark), 0, 0, 1, 1}, + {&__pyx_n_s__set_payload, __pyx_k__set_payload, sizeof(__pyx_k__set_payload), 0, 0, 1, 1}, {&__pyx_n_s__user_callback, __pyx_k__user_callback, sizeof(__pyx_k__user_callback), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeWarning = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeWarning); if (!__pyx_builtin_RuntimeWarning) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeWarning = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeWarning); if (!__pyx_builtin_RuntimeWarning) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -3532,70 +3738,70 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); - /* "netfilterqueue.pyx":61 + /* "netfilterqueue.pyx":62 * self.payload_len = nfq_get_payload(self._nfa, &self.payload) * if self.payload_len < 0: * raise OSError("Failed to get payload of packet.") # <<<<<<<<<<<<<< * * nfq_get_timestamp(self._nfa, &self.timestamp) */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "netfilterqueue.pyx":68 + /* "netfilterqueue.pyx":69 * """Call appropriate set_verdict... function on packet.""" * if self._verdict_is_set: * raise RuntimeWarning("Verdict already given for this packet.") # <<<<<<<<<<<<<< * - * if self._mark_is_set: + * cdef u_int32_t modified_payload_len = 0 */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "netfilterqueue.pyx":125 + /* "netfilterqueue.pyx":130 * self.h = nfq_open() * if self.h == NULL: * raise OSError("Failed to open NFQueue.") # <<<<<<<<<<<<<< * nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous * # running queues */ - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - /* "netfilterqueue.pyx":149 + /* "netfilterqueue.pyx":157 * range = MaxCopySize * if nfq_set_mode(self.qh, mode, range) < 0: * raise OSError("Failed to set packet copy mode.") # <<<<<<<<<<<<<< * * 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 = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_13)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - /* "netfilterqueue.pyx":8 - * License: GPL + /* "netfilterqueue.pyx":9 * """ + * from libc.string cimport strlen * VERSION = (0, 3, 0) # <<<<<<<<<<<<<< * * # Constants for module users */ - __pyx_k_tuple_16 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_16 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, __pyx_int_0); @@ -3829,240 +4035,241 @@ PyMODINIT_FUNC PyInit_netfilterqueue(void) __pyx_vtable_14netfilterqueue_Packet.verdict = (void (*)(struct __pyx_obj_14netfilterqueue_Packet *, u_int8_t))__pyx_f_14netfilterqueue_6Packet_verdict; __pyx_vtable_14netfilterqueue_Packet.get_payload_len = (Py_ssize_t (*)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch))__pyx_f_14netfilterqueue_6Packet_get_payload_len; __pyx_vtable_14netfilterqueue_Packet.get_timestamp = (double (*)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch))__pyx_f_14netfilterqueue_6Packet_get_timestamp; + __pyx_vtable_14netfilterqueue_Packet.set_payload = (PyObject *(*)(struct __pyx_obj_14netfilterqueue_Packet *, PyObject *, int __pyx_skip_dispatch))__pyx_f_14netfilterqueue_6Packet_set_payload; __pyx_vtable_14netfilterqueue_Packet.set_mark = (PyObject *(*)(struct __pyx_obj_14netfilterqueue_Packet *, u_int32_t, int __pyx_skip_dispatch))__pyx_f_14netfilterqueue_6Packet_set_mark; __pyx_vtable_14netfilterqueue_Packet.accept = (PyObject *(*)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch))__pyx_f_14netfilterqueue_6Packet_accept; __pyx_vtable_14netfilterqueue_Packet.drop = (PyObject *(*)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch))__pyx_f_14netfilterqueue_6Packet_drop; - if (PyType_Ready(&__pyx_type_14netfilterqueue_Packet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_14netfilterqueue_Packet.tp_dict, __pyx_vtabptr_14netfilterqueue_Packet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __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 = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_14netfilterqueue_Packet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_14netfilterqueue_Packet.tp_dict, __pyx_vtabptr_14netfilterqueue_Packet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __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 = 35; __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 = 118; __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 = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_14netfilterqueue_NetfilterQueue) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_14netfilterqueue_NetfilterQueue = &__pyx_type_14netfilterqueue_NetfilterQueue; /*--- Type import code ---*/ /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "netfilterqueue.pyx":8 - * License: GPL + /* "netfilterqueue.pyx":9 * """ + * from libc.string cimport strlen * VERSION = (0, 3, 0) # <<<<<<<<<<<<<< * * # Constants for module users */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VERSION, ((PyObject *)__pyx_k_tuple_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VERSION, ((PyObject *)__pyx_k_tuple_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "netfilterqueue.pyx":11 + /* "netfilterqueue.pyx":12 * * # Constants for module users * COPY_NONE = 1 # <<<<<<<<<<<<<< * COPY_META = 2 * COPY_PACKET = 3 */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COPY_NONE, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COPY_NONE, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "netfilterqueue.pyx":12 + /* "netfilterqueue.pyx":13 * # Constants for module users * COPY_NONE = 1 * COPY_META = 2 # <<<<<<<<<<<<<< * COPY_PACKET = 3 * */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COPY_META, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COPY_META, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "netfilterqueue.pyx":13 + /* "netfilterqueue.pyx":14 * COPY_NONE = 1 * COPY_META = 2 * COPY_PACKET = 3 # <<<<<<<<<<<<<< * * DEFAULT_MAX_QUEUELEN = 1024 */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COPY_PACKET, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COPY_PACKET, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "netfilterqueue.pyx":15 + /* "netfilterqueue.pyx":16 * COPY_PACKET = 3 * * DEFAULT_MAX_QUEUELEN = 1024 # <<<<<<<<<<<<<< * * # Packet copying defaults */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_17, __pyx_int_1024) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_17, __pyx_int_1024) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "netfilterqueue.pyx":138 - * nfq_close(self.h) + /* "netfilterqueue.pyx":144 * - * def bind(self, int queue_num, object user_callback, 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.""" + * def bind(self, int queue_num, object user_callback, + * u_int32_t max_len=DEFAULT_MAX_QUEUELEN, # <<<<<<<<<<<<<< + * u_int8_t mode=NFQNL_COPY_PACKET, + * u_int32_t range=MaxPacketSize): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_u_int32_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_u_int32_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (u_int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_k_10 = __pyx_t_2; - /* "netfilterqueue.pyx":139 - * - * def bind(self, int queue_num, object user_callback, u_int32_t max_len=DEFAULT_MAX_QUEUELEN, - * u_int8_t mode=NFQNL_COPY_PACKET, u_int32_t range=MaxPacketSize): # <<<<<<<<<<<<<< + /* "netfilterqueue.pyx":145 + * def bind(self, int queue_num, object user_callback, + * 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.user_callback = user_callback */ __pyx_k_11 = NFQNL_COPY_PACKET; - /* "netfilterqueue.pyx":171 + /* "netfilterqueue.pyx":179 * rv = recv(fd, buf, sizeof(buf), 0) * * PROTOCOLS = { # <<<<<<<<<<<<<< * 0: "HOPOPT", * 1: "ICMP", */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, __pyx_int_0, ((PyObject *)__pyx_n_s__HOPOPT)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_1, ((PyObject *)__pyx_n_s__ICMP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_2, ((PyObject *)__pyx_n_s__IGMP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_3, ((PyObject *)__pyx_n_s__GGP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, ((PyObject *)__pyx_n_s__IP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_5, ((PyObject *)__pyx_n_s__ST)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_6, ((PyObject *)__pyx_n_s__TCP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_7, ((PyObject *)__pyx_n_s__CBT)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_8, ((PyObject *)__pyx_n_s__EGP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_9, ((PyObject *)__pyx_n_s__IGP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_10, ((PyObject *)__pyx_kp_s_18)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_11, ((PyObject *)__pyx_kp_s_19)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_12, ((PyObject *)__pyx_n_s__PUP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_13, ((PyObject *)__pyx_n_s__ARGUS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_14, ((PyObject *)__pyx_n_s__EMCON)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_15, ((PyObject *)__pyx_n_s__XNET)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_16, ((PyObject *)__pyx_n_s__CHAOS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_17, ((PyObject *)__pyx_n_s__UDP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_18, ((PyObject *)__pyx_n_s__MUX)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_19, ((PyObject *)__pyx_kp_s_20)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_20, ((PyObject *)__pyx_n_s__HMP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_21, ((PyObject *)__pyx_n_s__PRM)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_22, ((PyObject *)__pyx_kp_s_21)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_23, ((PyObject *)__pyx_kp_s_22)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_24, ((PyObject *)__pyx_kp_s_23)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_25, ((PyObject *)__pyx_kp_s_24)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_26, ((PyObject *)__pyx_kp_s_25)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_27, ((PyObject *)__pyx_n_s__RDP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_28, ((PyObject *)__pyx_n_s__IRTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_29, ((PyObject *)__pyx_kp_s_26)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_30, ((PyObject *)__pyx_n_s__NETBLT)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_31, ((PyObject *)__pyx_kp_s_27)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_32, ((PyObject *)__pyx_kp_s_28)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_33, ((PyObject *)__pyx_n_s__DCCP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_34, ((PyObject *)__pyx_kp_s__3PC)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_35, ((PyObject *)__pyx_n_s__IDPR)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_36, ((PyObject *)__pyx_n_s__XTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_37, ((PyObject *)__pyx_n_s__DDP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_38, ((PyObject *)__pyx_kp_s_29)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_39, ((PyObject *)__pyx_kp_s_30)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_40, ((PyObject *)__pyx_n_s__IL)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_41, ((PyObject *)__pyx_n_s__IPv6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_42, ((PyObject *)__pyx_n_s__SDRP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_43, ((PyObject *)__pyx_kp_s_31)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_44, ((PyObject *)__pyx_kp_s_32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_45, ((PyObject *)__pyx_n_s__IDRP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_46, ((PyObject *)__pyx_n_s__RSVP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_47, ((PyObject *)__pyx_n_s__GRE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_48, ((PyObject *)__pyx_n_s__DSR)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_49, ((PyObject *)__pyx_n_s__BNA)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_50, ((PyObject *)__pyx_n_s__ESP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_51, ((PyObject *)__pyx_n_s__AH)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_52, ((PyObject *)__pyx_kp_s_33)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_53, ((PyObject *)__pyx_n_s__SWIPE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_54, ((PyObject *)__pyx_n_s__NARP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_55, ((PyObject *)__pyx_n_s__MOBILE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_56, ((PyObject *)__pyx_n_s__TLSP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_57, ((PyObject *)__pyx_n_s__SKIP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_58, ((PyObject *)__pyx_kp_s_34)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_59, ((PyObject *)__pyx_kp_s_35)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_60, ((PyObject *)__pyx_kp_s_36)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_61, ((PyObject *)__pyx_kp_s_37)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_62, ((PyObject *)__pyx_n_s__CFTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_63, ((PyObject *)__pyx_kp_s_38)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_64, ((PyObject *)__pyx_kp_s_39)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_65, ((PyObject *)__pyx_n_s__KRYPTOLAN)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_66, ((PyObject *)__pyx_n_s__RVD)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_67, ((PyObject *)__pyx_n_s__IPPC)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_68, ((PyObject *)__pyx_kp_s_40)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_69, ((PyObject *)__pyx_kp_s_41)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_70, ((PyObject *)__pyx_n_s__VISA)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_71, ((PyObject *)__pyx_n_s__IPCV)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_72, ((PyObject *)__pyx_n_s__CPNX)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_73, ((PyObject *)__pyx_n_s__CPHB)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_74, ((PyObject *)__pyx_n_s__WSN)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_75, ((PyObject *)__pyx_n_s__PVP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_76, ((PyObject *)__pyx_kp_s_42)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_77, ((PyObject *)__pyx_kp_s_43)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_78, ((PyObject *)__pyx_kp_s_44)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_79, ((PyObject *)__pyx_kp_s_45)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_80, ((PyObject *)__pyx_kp_s_46)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_81, ((PyObject *)__pyx_n_s__VMTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_82, ((PyObject *)__pyx_kp_s_47)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_83, ((PyObject *)__pyx_n_s__VINES)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_84, ((PyObject *)__pyx_n_s__TTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_85, ((PyObject *)__pyx_kp_s_48)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_86, ((PyObject *)__pyx_n_s__DGP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_87, ((PyObject *)__pyx_n_s__TCF)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_88, ((PyObject *)__pyx_n_s__EIGRP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_89, ((PyObject *)__pyx_n_s__OSPFIGP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_90, ((PyObject *)__pyx_kp_s_49)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_91, ((PyObject *)__pyx_n_s__LARP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_92, ((PyObject *)__pyx_n_s__MTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_93, ((PyObject *)__pyx_kp_s_50)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_94, ((PyObject *)__pyx_n_s__IPIP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_95, ((PyObject *)__pyx_n_s__MICP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_96, ((PyObject *)__pyx_kp_s_51)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_97, ((PyObject *)__pyx_n_s__ETHERIP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_98, ((PyObject *)__pyx_n_s__ENCAP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_99, ((PyObject *)__pyx_kp_s_52)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_100, ((PyObject *)__pyx_n_s__GMTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_101, ((PyObject *)__pyx_n_s__IFMP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_102, ((PyObject *)__pyx_n_s__PNNI)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_103, ((PyObject *)__pyx_n_s__PIM)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_104, ((PyObject *)__pyx_n_s__ARIS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_105, ((PyObject *)__pyx_n_s__SCPS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_106, ((PyObject *)__pyx_n_s__QNX)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_107, ((PyObject *)__pyx_kp_s_53)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_108, ((PyObject *)__pyx_n_s__IPComp)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_109, ((PyObject *)__pyx_n_s__SNP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_110, ((PyObject *)__pyx_kp_s_54)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_111, ((PyObject *)__pyx_kp_s_55)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_112, ((PyObject *)__pyx_n_s__VRRP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_113, ((PyObject *)__pyx_n_s__PGM)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_114, ((PyObject *)__pyx_kp_s_56)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_115, ((PyObject *)__pyx_n_s__L2TP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_116, ((PyObject *)__pyx_n_s__DDX)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_117, ((PyObject *)__pyx_n_s__IATP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_118, ((PyObject *)__pyx_n_s__STP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_119, ((PyObject *)__pyx_n_s__SRP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_120, ((PyObject *)__pyx_n_s__UTI)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_121, ((PyObject *)__pyx_n_s__SMP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_122, ((PyObject *)__pyx_n_s__SM)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_123, ((PyObject *)__pyx_n_s__PTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_124, ((PyObject *)__pyx_n_s__ISIS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_125, ((PyObject *)__pyx_n_s__FIRE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_126, ((PyObject *)__pyx_n_s__CRTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_127, ((PyObject *)__pyx_n_s__CRUDP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_128, ((PyObject *)__pyx_n_s__SSCOPMCE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_129, ((PyObject *)__pyx_n_s__IPLT)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_130, ((PyObject *)__pyx_n_s__SPS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_131, ((PyObject *)__pyx_n_s__PIPE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_132, ((PyObject *)__pyx_n_s__SCTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_133, ((PyObject *)__pyx_n_s__FC)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_134, ((PyObject *)__pyx_kp_s_57)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_135, ((PyObject *)__pyx_n_s__Mobility)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_136, ((PyObject *)__pyx_n_s__UDPLite)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_137, ((PyObject *)__pyx_kp_s_58)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_138, ((PyObject *)__pyx_n_s__manet)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_139, ((PyObject *)__pyx_n_s__HIP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_140, ((PyObject *)__pyx_n_s__Shim6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_int_255, ((PyObject *)__pyx_n_s__Reserved)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PROTOCOLS, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_0, ((PyObject *)__pyx_n_s__HOPOPT)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_1, ((PyObject *)__pyx_n_s__ICMP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_2, ((PyObject *)__pyx_n_s__IGMP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_3, ((PyObject *)__pyx_n_s__GGP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, ((PyObject *)__pyx_n_s__IP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_5, ((PyObject *)__pyx_n_s__ST)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_6, ((PyObject *)__pyx_n_s__TCP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_7, ((PyObject *)__pyx_n_s__CBT)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_8, ((PyObject *)__pyx_n_s__EGP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_9, ((PyObject *)__pyx_n_s__IGP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_10, ((PyObject *)__pyx_kp_s_18)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_11, ((PyObject *)__pyx_kp_s_19)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_12, ((PyObject *)__pyx_n_s__PUP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_13, ((PyObject *)__pyx_n_s__ARGUS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_14, ((PyObject *)__pyx_n_s__EMCON)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_15, ((PyObject *)__pyx_n_s__XNET)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_16, ((PyObject *)__pyx_n_s__CHAOS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_17, ((PyObject *)__pyx_n_s__UDP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_18, ((PyObject *)__pyx_n_s__MUX)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_19, ((PyObject *)__pyx_kp_s_20)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_20, ((PyObject *)__pyx_n_s__HMP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_21, ((PyObject *)__pyx_n_s__PRM)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_22, ((PyObject *)__pyx_kp_s_21)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_23, ((PyObject *)__pyx_kp_s_22)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_24, ((PyObject *)__pyx_kp_s_23)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_25, ((PyObject *)__pyx_kp_s_24)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_26, ((PyObject *)__pyx_kp_s_25)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_27, ((PyObject *)__pyx_n_s__RDP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_28, ((PyObject *)__pyx_n_s__IRTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_29, ((PyObject *)__pyx_kp_s_26)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_30, ((PyObject *)__pyx_n_s__NETBLT)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_31, ((PyObject *)__pyx_kp_s_27)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_32, ((PyObject *)__pyx_kp_s_28)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_33, ((PyObject *)__pyx_n_s__DCCP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_34, ((PyObject *)__pyx_kp_s__3PC)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_35, ((PyObject *)__pyx_n_s__IDPR)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_36, ((PyObject *)__pyx_n_s__XTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_37, ((PyObject *)__pyx_n_s__DDP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_38, ((PyObject *)__pyx_kp_s_29)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_39, ((PyObject *)__pyx_kp_s_30)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_40, ((PyObject *)__pyx_n_s__IL)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_41, ((PyObject *)__pyx_n_s__IPv6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_42, ((PyObject *)__pyx_n_s__SDRP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_43, ((PyObject *)__pyx_kp_s_31)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_44, ((PyObject *)__pyx_kp_s_32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_45, ((PyObject *)__pyx_n_s__IDRP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_46, ((PyObject *)__pyx_n_s__RSVP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_47, ((PyObject *)__pyx_n_s__GRE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_48, ((PyObject *)__pyx_n_s__DSR)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_49, ((PyObject *)__pyx_n_s__BNA)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_50, ((PyObject *)__pyx_n_s__ESP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_51, ((PyObject *)__pyx_n_s__AH)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_52, ((PyObject *)__pyx_kp_s_33)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_53, ((PyObject *)__pyx_n_s__SWIPE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_54, ((PyObject *)__pyx_n_s__NARP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_55, ((PyObject *)__pyx_n_s__MOBILE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_56, ((PyObject *)__pyx_n_s__TLSP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_57, ((PyObject *)__pyx_n_s__SKIP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_58, ((PyObject *)__pyx_kp_s_34)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_59, ((PyObject *)__pyx_kp_s_35)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_60, ((PyObject *)__pyx_kp_s_36)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_61, ((PyObject *)__pyx_kp_s_37)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_62, ((PyObject *)__pyx_n_s__CFTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_63, ((PyObject *)__pyx_kp_s_38)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_64, ((PyObject *)__pyx_kp_s_39)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_65, ((PyObject *)__pyx_n_s__KRYPTOLAN)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_66, ((PyObject *)__pyx_n_s__RVD)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_67, ((PyObject *)__pyx_n_s__IPPC)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_68, ((PyObject *)__pyx_kp_s_40)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_69, ((PyObject *)__pyx_kp_s_41)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_70, ((PyObject *)__pyx_n_s__VISA)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_71, ((PyObject *)__pyx_n_s__IPCV)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_72, ((PyObject *)__pyx_n_s__CPNX)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_73, ((PyObject *)__pyx_n_s__CPHB)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_74, ((PyObject *)__pyx_n_s__WSN)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_75, ((PyObject *)__pyx_n_s__PVP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_76, ((PyObject *)__pyx_kp_s_42)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_77, ((PyObject *)__pyx_kp_s_43)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_78, ((PyObject *)__pyx_kp_s_44)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_79, ((PyObject *)__pyx_kp_s_45)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_80, ((PyObject *)__pyx_kp_s_46)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_81, ((PyObject *)__pyx_n_s__VMTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_82, ((PyObject *)__pyx_kp_s_47)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_83, ((PyObject *)__pyx_n_s__VINES)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_84, ((PyObject *)__pyx_n_s__TTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_85, ((PyObject *)__pyx_kp_s_48)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_86, ((PyObject *)__pyx_n_s__DGP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_87, ((PyObject *)__pyx_n_s__TCF)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_88, ((PyObject *)__pyx_n_s__EIGRP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_89, ((PyObject *)__pyx_n_s__OSPFIGP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_90, ((PyObject *)__pyx_kp_s_49)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_91, ((PyObject *)__pyx_n_s__LARP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_92, ((PyObject *)__pyx_n_s__MTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_93, ((PyObject *)__pyx_kp_s_50)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_94, ((PyObject *)__pyx_n_s__IPIP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_95, ((PyObject *)__pyx_n_s__MICP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_96, ((PyObject *)__pyx_kp_s_51)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_97, ((PyObject *)__pyx_n_s__ETHERIP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_98, ((PyObject *)__pyx_n_s__ENCAP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_99, ((PyObject *)__pyx_kp_s_52)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_100, ((PyObject *)__pyx_n_s__GMTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_101, ((PyObject *)__pyx_n_s__IFMP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_102, ((PyObject *)__pyx_n_s__PNNI)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_103, ((PyObject *)__pyx_n_s__PIM)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_104, ((PyObject *)__pyx_n_s__ARIS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_105, ((PyObject *)__pyx_n_s__SCPS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_106, ((PyObject *)__pyx_n_s__QNX)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_107, ((PyObject *)__pyx_kp_s_53)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_108, ((PyObject *)__pyx_n_s__IPComp)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_109, ((PyObject *)__pyx_n_s__SNP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_110, ((PyObject *)__pyx_kp_s_54)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_111, ((PyObject *)__pyx_kp_s_55)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_112, ((PyObject *)__pyx_n_s__VRRP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_113, ((PyObject *)__pyx_n_s__PGM)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_114, ((PyObject *)__pyx_kp_s_56)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_115, ((PyObject *)__pyx_n_s__L2TP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_116, ((PyObject *)__pyx_n_s__DDX)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_117, ((PyObject *)__pyx_n_s__IATP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_118, ((PyObject *)__pyx_n_s__STP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_119, ((PyObject *)__pyx_n_s__SRP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_120, ((PyObject *)__pyx_n_s__UTI)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_121, ((PyObject *)__pyx_n_s__SMP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_122, ((PyObject *)__pyx_n_s__SM)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_123, ((PyObject *)__pyx_n_s__PTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_124, ((PyObject *)__pyx_n_s__ISIS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_125, ((PyObject *)__pyx_n_s__FIRE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_126, ((PyObject *)__pyx_n_s__CRTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_127, ((PyObject *)__pyx_n_s__CRUDP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_128, ((PyObject *)__pyx_n_s__SSCOPMCE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_129, ((PyObject *)__pyx_n_s__IPLT)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_130, ((PyObject *)__pyx_n_s__SPS)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_131, ((PyObject *)__pyx_n_s__PIPE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_132, ((PyObject *)__pyx_n_s__SCTP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_133, ((PyObject *)__pyx_n_s__FC)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_134, ((PyObject *)__pyx_kp_s_57)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_135, ((PyObject *)__pyx_n_s__Mobility)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_136, ((PyObject *)__pyx_n_s__UDPLite)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_137, ((PyObject *)__pyx_kp_s_58)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_138, ((PyObject *)__pyx_n_s__manet)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_139, ((PyObject *)__pyx_n_s__HIP)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_140, ((PyObject *)__pyx_n_s__Shim6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_255, ((PyObject *)__pyx_n_s__Reserved)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PROTOCOLS, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "netfilterqueue.pyx":1 @@ -4346,6 +4553,26 @@ bad: } #endif +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) diff --git a/netfilterqueue.pxd b/netfilterqueue.pxd index 4916938..92262f3 100644 --- a/netfilterqueue.pxd +++ b/netfilterqueue.pxd @@ -156,7 +156,7 @@ cdef class Packet: # false otherwise cdef bint _mark_is_set # True if a mark has been given, false otherwise cdef u_int32_t _given_mark # Mark given to packet - cdef unsigned char *_given_payload # New payload of packet, or null + cdef bytes _given_payload # New payload of packet, or null # From NFQ packet header: cdef readonly u_int32_t id @@ -179,6 +179,7 @@ cdef class Packet: cdef void verdict(self, u_int8_t verdict) cpdef Py_ssize_t get_payload_len(self) cpdef double get_timestamp(self) + cpdef set_payload(self, bytes payload) cpdef set_mark(self, u_int32_t mark) cpdef accept(self) cpdef drop(self) diff --git a/netfilterqueue.pyx b/netfilterqueue.pyx index 0bb769e..5c93a9b 100644 --- a/netfilterqueue.pyx +++ b/netfilterqueue.pyx @@ -5,6 +5,7 @@ function. Copyright: (c) 2011, Kerkhoff Technologies Inc. License: MIT; see LICENSE.txt """ +from libc.string cimport strlen VERSION = (0, 3, 0) # Constants for module users @@ -36,7 +37,7 @@ cdef class Packet: def __cinit__(self): self._verdict_is_set = False self._mark_is_set = False - self._given_payload = NULL + self._given_payload = None def __str__(self): cdef iphdr *hdr = self.payload @@ -66,7 +67,12 @@ cdef class Packet: """Call appropriate set_verdict... function on packet.""" if self._verdict_is_set: raise RuntimeWarning("Verdict already given for this packet.") - + + cdef u_int32_t modified_payload_len = 0 + cdef unsigned char *modified_payload = NULL + if self._given_payload: + modified_payload_len = len(self._given_payload) + modified_payload = self._given_payload if self._mark_is_set: nfq_set_verdict_mark( # TODO: make this use nfq_set_verdict2 if # available on system @@ -74,17 +80,15 @@ cdef class Packet: self.id, verdict, htonl(self._given_mark), - 0, # TODO: adapt to use self._given_payload - NULL # TODO: adapt to use self._given_payload - ) + modified_payload_len, + modified_payload) else: nfq_set_verdict( self._qh, self.id, verdict, - 0, # TODO: adapt to use self._given_payload - NULL # TODO: adapt to use self._given_payload - ) + modified_payload_len, + modified_payload) self._verdict_is_set = True @@ -100,10 +104,9 @@ cdef class Packet: cpdef double get_timestamp(self): return self.timestamp.tv_sec + (self.timestamp.tv_usec/1000000.0) - # TODO: implement this - #cpdef set_payload(self, unsigned char *payload): - # """Set the new payload of this packet.""" - # self._given_payload = payload + cpdef set_payload(self, bytes payload): + """Set the new payload of this packet.""" + self._given_payload = payload cpdef set_mark(self, u_int32_t mark): self._given_mark = mark