add get_mark
This commit is contained in:
parent
26ff0e7844
commit
6b8be8a5ec
|
@ -1,3 +1,6 @@
|
|||
v0.6, 15 Apr 2013
|
||||
Add get_mark.
|
||||
|
||||
v0.5, 3 Apr 2013
|
||||
Add repeat.
|
||||
|
||||
|
|
880
netfilterqueue.c
880
netfilterqueue.c
File diff suppressed because it is too large
Load Diff
|
@ -129,6 +129,7 @@ cdef extern from "libnetfilter_queue/libnetfilter_queue.h":
|
|||
int nfq_get_payload(nfq_data *nfad, char **data)
|
||||
int nfq_get_timestamp(nfq_data *nfad, timeval *tv)
|
||||
nfqnl_msg_packet_hw *nfq_get_packet_hw(nfq_data *nfad)
|
||||
int nfq_get_nfmark (nfq_data *nfad)
|
||||
|
||||
# Dummy defines from linux/socket.h:
|
||||
cdef enum: # Protocol families, same as address families.
|
||||
|
@ -162,6 +163,7 @@ cdef class Packet:
|
|||
cdef readonly u_int32_t id
|
||||
cdef readonly u_int16_t hw_protocol
|
||||
cdef readonly u_int8_t hook
|
||||
cdef readonly u_int32_t mark
|
||||
|
||||
# Packet details:
|
||||
cdef Py_ssize_t payload_len
|
||||
|
@ -181,6 +183,7 @@ cdef class Packet:
|
|||
cpdef double get_timestamp(self)
|
||||
cpdef set_payload(self, bytes payload)
|
||||
cpdef set_mark(self, u_int32_t mark)
|
||||
cpdef get_mark(self)
|
||||
cpdef accept(self)
|
||||
cpdef drop(self)
|
||||
cpdef repeat(self)
|
||||
|
|
|
@ -5,7 +5,7 @@ function.
|
|||
Copyright: (c) 2011, Kerkhoff Technologies Inc.
|
||||
License: MIT; see LICENSE.txt
|
||||
"""
|
||||
VERSION = (0, 5, 0)
|
||||
VERSION = (0, 6, 0)
|
||||
|
||||
# Constants for module users
|
||||
COPY_NONE = 1
|
||||
|
@ -61,6 +61,7 @@ cdef class Packet:
|
|||
raise OSError("Failed to get payload of packet.")
|
||||
|
||||
nfq_get_timestamp(self._nfa, &self.timestamp)
|
||||
self.mark = nfq_get_nfmark(nfa)
|
||||
|
||||
cdef void verdict(self, u_int8_t verdict):
|
||||
"""Call appropriate set_verdict... function on packet."""
|
||||
|
@ -109,6 +110,11 @@ cdef class Packet:
|
|||
cpdef set_mark(self, u_int32_t mark):
|
||||
self._given_mark = mark
|
||||
self._mark_is_set = True
|
||||
|
||||
cpdef get_mark(self):
|
||||
if self._mark_is_set:
|
||||
return self._given_mark
|
||||
return self.mark
|
||||
|
||||
cpdef accept(self):
|
||||
"""Accept the packet."""
|
||||
|
|
Loading…
Reference in New Issue