netsniff-ng: Don't set IO prio when reading pcap file
[netsniff-ng.git] / netsniff-ng.zsh
blobf60f867e47018d822840695e55ad93d0822b432b
1 #compdef netsniff-ng
3 # netsniff-ng.zsh -- zsh completion function for netsniff-ng
5 # Copyright (C) 2013 Hideo Hattori <hhatto.jp@gmail.com>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 2 as
9 # published by the Free Software Foundation.
11 typeset -A opt_args
12 local context state line
14 _cpu () {
15 _cpus=(${${(f)"$(grep processor /proc/cpuinfo | awk '{print $3}')"}})
16 compadd -a _cpus
19 _user_info () {
20 user_info=(${${(f)"$(awk -F':' '{print $3":"$1}' /etc/passwd)"}})
21 _describe -t usr "user info" user_info && ret=0
24 _group_info () {
25 group_info=(${${(f)"$(awk -F':' '{print $4":"$1}' /etc/passwd)"}})
26 _describe -t usr "group info" group_info && ret=0
29 _interfaces () {
30 _wanted interfaces expl 'network interface' \
31 _net_interfaces
32 _values "Pseudo-device that captures on all interfaces" "any"
35 _arguments -s -S \
36 "(-i -d --dev --in)"{-i,-d,--dev,--in}"[Input source as netdev, pcap or pcap stdin]:input:_interfaces" \
37 "(-o --out)"{-o,--out}"[Output sink as netdev, pcap, directory, trafgen, or stdout]::_gnu_generic" \
38 "(-f --filter)"{-f,--filter}"[Use BPF filter file from bpfc or tcpdump-like expression]" \
39 "(-t --type)"{-t,--type}"[Filter type]:filter:(host broadcast multicast others outgoing)" \
40 "(-F --interval)"{-F,--interval}"[Dump interval if -o is a dir: <num>KiB/MiB/GiB/s/sec/min/hrs]:interval:_gnu_generic" \
41 "(-J --jumbo-support)"{-J,--jumbo-support}"[Support for 64KB Super Jumbo Frames (def: 2048B)]" \
42 "(-R --rfraw)"{-R,--rfraw}"[Capture or inject raw 802.11 frames]" \
43 "(-n --num)"{-n,--num}"[Number of packets until exit (def: 0)]" \
44 "(-P --prefix)"{-P,--prefix}"[Prefix for pcaps stored in directory]" \
45 "(-T --magic)"{-T,--magic}"[Pcap magic number/pcap format to store, see -D]" \
46 "(-D --dump-pcap-types)"{-D,--dump-pcap-types}"[Dump pcap types and magic numbers and quit]" \
47 "(-B --dump-bpf)"{-B,--dump-bpf}"[Dump generated BPF assembly]" \
48 "(-r --rand)"{-r,--rand}"[Randomize packet forwarding order (dev->dev)]" \
49 "(-M --no-promisc)"{-M,--no-promisc}"[No promiscuous mode for netdev]" \
50 "(-N --no-hwtimestamp)"{-N,--no-hwtimestamp}"[Disable hardware timestamping]" \
51 "(-A --no-sock-mem)"{-A,--no-sock-mem}"[Don\'t tune core socket memory]" \
52 "(-m --mmap)"{-m,--mmap}"[Mmap(2) pcap file i.e., for replaying pcaps]" \
53 "(-G --sg)"{-G,--sg}"[Scatter/gather pcap file I/O]" \
54 "(-c --clrw)"{-c,--clrw}"[Use slower read(2)/write(2) I/O]" \
55 "(-S --ring-size)"{-S,--ring-size}"[Specify ring size to: <num>KiB/MiB/GiB]:ringsize:" \
56 "(-k --kernel-pull)"{-k,--kernel-pull}"[Kernel pull from user interval in us (def: 10us)]:kernelpull:_gnu_generic" \
57 "(-b --bind-cpu)"{-b,--bind-cpu}"[Bind to specific CPU]:cpunum:_cpu" \
58 "(-u --user)"{-u,--user}"[Drop privileges and change to userid]:user:_user_info" \
59 "(-g --group)"{-g,--group}"[Drop privileges and change to groupid]:group:_group_info" \
60 "(-H --prio-high)"{-H,--prio-high}"[Make this high priority process]" \
61 "(-Q --notouch-irq)"{-Q,--notouch-irq}"[Do not touch IRQ CPU affinity of NIC]" \
62 "(-s --silent)"{-s,--silent}"[Do not print captured packets]" \
63 "(-q --less)"{-q,--less}"[Print less-verbose packet information]" \
64 "(-X --hex)"{-X,--hex}"[Print packet data in hex format]" \
65 "(-l --ascii)"{-l,--ascii}"[Print human-readable packet data]" \
66 "(-U --update)"{-U,--update}"[Update GeoIP databases]" \
67 "(-V --verbose)"{-V,--verbose}"[Be more verbose]" \
68 {-v,--version}"[Show version and exit]:" \
69 {-h,--help}"[Guess what?!]:" \
70 "*::args:_gnu_generic"