aboutsummaryrefslogtreecommitdiffstats
path: root/doc/extcap_example.py
diff options
context:
space:
mode:
authorHåkon Øye Amundsen <haakon.amundsen@nordicsemi.no>2017-08-25 11:28:34 +0200
committerAnders Broman <a.broman58@gmail.com>2017-08-28 05:48:01 +0000
commit018f6bff18785a1c3971a1ccfe3b1b5243d4d154 (patch)
treeaa4d61e478e39f628000dd6cf7bbbccc2e745a7d /doc/extcap_example.py
parent7aeff4fb904e67ce8f81053f595b8a8b0340cb52 (diff)
extcap: Interface Toolbar support on Windows
Add support for extcap control pipes on Windows. Improved read loop in InterfaceToolbarReader. Delay opening control pipes until extcap has opened the fifo pipe. Make extcap_example.py work on Windows. Bug: 13833 Change-Id: I4b47d25452637759b8a3be53be48eee5365bc0e4 Reviewed-on: https://code.wireshark.org/review/23211 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'doc/extcap_example.py')
-rwxr-xr-xdoc/extcap_example.py32
1 files changed, 11 insertions, 21 deletions
diff --git a/doc/extcap_example.py b/doc/extcap_example.py
index e984b37..9c14dde 100755
--- a/doc/extcap_example.py
+++ b/doc/extcap_example.py
@@ -340,28 +340,22 @@ def extcap_capture(interface, fifo, control_in, control_out, in_delay, in_verify
message = in_message
verify = in_verify
counter = 1
-
- if not os.path.exists(fifo):
- print ( "Fifo does not exist, exiting!", file=sys.stderr )
- sys.exit(1)
-
fn_out = None
- if control_out != None:
- fn_out = open(control_out, 'wb', 0)
- control_write(fn_out, CTRL_ARG_LOGGER, CTRL_CMD_SET, "Log started at " + time.strftime("%c") + "\n")
+ with open(fifo, 'wb', 0 ) as fh:
+ fh.write (pcap_fake_header())
- if control_in != None:
- # Start reading thread
- thread = Thread(target = control_read_thread, args = (control_in, fn_out))
- thread.start()
+ if control_out != None:
+ fn_out = open(control_out, 'wb', 0)
+ control_write(fn_out, CTRL_ARG_LOGGER, CTRL_CMD_SET, "Log started at " + time.strftime("%c") + "\n")
+ if control_in != None:
+ # Start reading thread
+ thread = Thread(target = control_read_thread, args = (control_in, fn_out))
+ thread.start()
- if fn_out != None:
- control_write_defaults(fn_out)
-
- with open(fifo, 'wb', 0 ) as fh:
- fh.write (pcap_fake_header())
+ if fn_out != None:
+ control_write_defaults(fn_out)
while True:
if fn_out != None:
@@ -383,10 +377,6 @@ def extcap_capture(interface, fifo, control_in, control_out, in_delay, in_verify
fn_out.close()
def extcap_close_fifo(fifo):
- if not os.path.exists(fifo):
- print ( "Fifo does not exist!", file=sys.stderr )
- return
-
# This is apparently needed to workaround an issue on Windows/macOS
# where the message cannot be read. (really?)
fh = open(fifo, 'wb', 0 )