dissector: ip_auth_hdr: Fix compiler warning
[netsniff-ng.git] / netsniff-ng.zsh
blob122d6616c77e92af3f86e8ceaf224767d3a89f81
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 "(-A --no-sock-mem)"{-A,--no-sock-mem}"[Don\'t tune core socket memory]" \
51 "(-m --mmap)"{-m,--mmap}"[Mmap(2) pcap file i.e., for replaying pcaps]" \
52 "(-G --sg)"{-G,--sg}"[Scatter/gather pcap file I/O]" \
53 "(-c --clrw)"{-c,--clrw}"[Use slower read(2)/write(2) I/O]" \
54 "(-S --ring-size)"{-S,--ring-size}"[Specify ring size to: <num>KiB/MiB/GiB]:ringsize:" \
55 "(-k --kernel-pull)"{-k,--kernel-pull}"[Kernel pull from user interval in us (def: 10us)]:kernelpull:_gnu_generic" \
56 "(-b --bind-cpu)"{-b,--bind-cpu}"[Bind to specific CPU]:cpunum:_cpu" \
57 "(-u --user)"{-u,--user}"[Drop privileges and change to userid]:user:_user_info" \
58 "(-g --group)"{-g,--group}"[Drop privileges and change to groupid]:group:_group_info" \
59 "(-H --prio-high)"{-H,--prio-high}"[Make this high priority process]" \
60 "(-Q --notouch-irq)"{-Q,--notouch-irq}"[Do not touch IRQ CPU affinity of NIC]" \
61 "(-s --silent)"{-s,--silent}"[Do not print captured packets]" \
62 "(-q --less)"{-q,--less}"[Print less-verbose packet information]" \
63 "(-X --hex)"{-X,--hex}"[Print packet data in hex format]" \
64 "(-l --ascii)"{-l,--ascii}"[Print human-readable packet data]" \
65 "(-U --update)"{-U,--update}"[Update GeoIP databases]" \
66 "(-V --verbose)"{-V,--verbose}"[Be more verbose]" \
67 {-v,--version}"[Show version]:" \
68 {-h,--help}"[Guess what?!]:" \
69 "*::args:_gnu_generic"