Skip to content

Commit 673060e

Browse files
committed
Update README docs with new functions and arguments.
1 parent 4d5c866 commit 673060e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

README.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ it. ::
2525
try:
2626
nfqueue.run()
2727
except KeyboardInterrupt:
28-
print
28+
print('')
2929
3030
nfqueue.unbind()
3131

@@ -85,7 +85,7 @@ NetfilterQueue objects
8585
A NetfilterQueue object represents a single queue. Configure your queue with
8686
a call to ``bind``, then start receiving packets with a call to ``run``.
8787

88-
``QueueHandler.bind(queue_num, callback[, max_len[, mode[, range]]])``
88+
``QueueHandler.bind(queue_num, callback[, max_len[, mode[, range, [sock_len]]]])``
8989
Create and bind to the queue. ``queue_num`` must match the number in your
9090
iptables rule. ``callback`` is a function or method that takes one
9191
argument, a Packet object (see below). ``max_len`` sets the largest number
@@ -94,23 +94,28 @@ a call to ``bind``, then start receiving packets with a call to ``run``.
9494
data is provided to your script. Use the constants above. ``range`` defines
9595
how many bytes of the packet you want to get. For example, if you only want
9696
the source and destination IPs of a IPv4 packet, ``range`` could be 20.
97+
``sock_len`` sets the receive socket buffer size.
9798

9899
``QueueHandler.unbind()``
99100
Remove the queue. Packets matched by your iptables rule will be dropped.
100101

101-
``QueueHandler.run()``
102-
Send packets to your callback. This method blocks.
102+
``QueueHandler.get_fd()``
103+
Get the file descriptor of the queue handler.
104+
105+
``QueueHandler.run([block])``
106+
Send packets to your callback. By default, this method blocks. Set
107+
block=False to let your thread continue. You can get the
103108

104109
Packet objects
105110
--------------
106111

107112
Objects of this type are passed to your callback.
108113

109114
``Packet.get_payload()``
110-
Return the packet's payload as a string.
115+
Return the packet's payload as a string (Python 2) or bytes (Python 3).
111116

112117
``Packet.set_payload(payload)``
113-
Set the packet payload. ``payload`` is bytes.
118+
Set the packet payload. ``payload`` is a bytes.
114119

115120
``Packet.get_payload_len()``
116121
Return the size of the payload.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy