build: travis: Add libnl-genl-3-dev to install command
[netsniff-ng.git] / netsniff-ng.zsh
bloba0050f20876822d5ab5223db415fda43242f6e95
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 "(-C --fanout-group)"{-C,--fanout-group}"[Join packet fanout group]" \
39 "(-K --fanout-type)"{-K,--fanout-type}"[Apply fanout discipline: hash|lb|cpu|rnd|roll|qm]" \
40 "(-L --fanout-opts)"{-L,--fanout-opts}"[Additional fanout options: defrag|roll]" \
41 "(-f --filter)"{-f,--filter}"[Use BPF filter file from bpfc or tcpdump-like expression]" \
42 "(-t --type)"{-t,--type}"[Filter type]:filter:(host broadcast multicast others outgoing)" \
43 "(-F --interval)"{-F,--interval}"[Dump interval if -o is a dir: <num>KiB/MiB/GiB/s/sec/min/hrs]:interval:_gnu_generic" \
44 "(-J --jumbo-support)"{-J,--jumbo-support}"[Support for 64KB Super Jumbo Frames (def: 2048B)]" \
45 "(-R --rfraw)"{-R,--rfraw}"[Capture or inject raw 802.11 frames]" \
46 "(-n --num)"{-n,--num}"[Number of packets until exit (def: 0)]" \
47 "(-P --prefix)"{-P,--prefix}"[Prefix for pcaps stored in directory]" \
48 "(-T --magic)"{-T,--magic}"[Pcap magic number/pcap format to store, see -D]" \
49 "(-D --dump-pcap-types)"{-D,--dump-pcap-types}"[Dump pcap types and magic numbers and quit]" \
50 "(-B --dump-bpf)"{-B,--dump-bpf}"[Dump generated BPF assembly]" \
51 "(-r --rand)"{-r,--rand}"[Randomize packet forwarding order (dev->dev)]" \
52 "(-M --no-promisc)"{-M,--no-promisc}"[No promiscuous mode for netdev]" \
53 "(-N --no-hwtimestamp)"{-N,--no-hwtimestamp}"[Disable hardware timestamping]" \
54 "(-A --no-sock-mem)"{-A,--no-sock-mem}"[Don\'t tune core socket memory]" \
55 "(-m --mmap)"{-m,--mmap}"[Mmap(2) pcap file i.e., for replaying pcaps]" \
56 "(-G --sg)"{-G,--sg}"[Scatter/gather pcap file I/O]" \
57 "(-c --clrw)"{-c,--clrw}"[Use slower read(2)/write(2) I/O]" \
58 "(-S --ring-size)"{-S,--ring-size}"[Specify ring size to: <num>KiB/MiB/GiB]:ringsize:" \
59 "(-k --kernel-pull)"{-k,--kernel-pull}"[Kernel pull from user interval in us (def: 10us)]:kernelpull:_gnu_generic" \
60 "(-b --bind-cpu)"{-b,--bind-cpu}"[Bind to specific CPU]:cpunum:_cpu" \
61 "(-u --user)"{-u,--user}"[Drop privileges and change to userid]:user:_user_info" \
62 "(-g --group)"{-g,--group}"[Drop privileges and change to groupid]:group:_group_info" \
63 "(-H --prio-high)"{-H,--prio-high}"[Make this high priority process]" \
64 "(-Q --notouch-irq)"{-Q,--notouch-irq}"[Do not touch IRQ CPU affinity of NIC]" \
65 "(-s --silent)"{-s,--silent}"[Do not print captured packets]" \
66 "(-q --less)"{-q,--less}"[Print less-verbose packet information]" \
67 "(-X --hex)"{-X,--hex}"[Print packet data in hex format]" \
68 "(-l --ascii)"{-l,--ascii}"[Print human-readable packet data]" \
69 "(-U --update)"{-U,--update}"[Update GeoIP databases]" \
70 "(-V --verbose)"{-V,--verbose}"[Be more verbose]" \
71 {-v,--version}"[Show version and exit]:" \
72 {-h,--help}"[Guess what?!]:" \
73 "*::args:_gnu_generic"