Issue #11, Extension Hooks for a simple 6bed4node
[6bed4] / src / 6bed4exthook.skeleton
1 #!/bin/sh
2 #
3 # Skeleton handler script for events from 6bed4node
4 # See https://github.com/vanrein/6bed4/issues/11
5 #
6 # From: Rick van Rein <rick@openfortress.nl>
7
8
9 # Normally, this script is called from the 6bed4peer -x 6bed4node-script.sh
10 # commandline option.  When taken down properly, the 6bed4peer will remove
11 # its tracks at exit.  If at any point you know that no 6bed4 setup should
12 # be active, your system may call del-offers with "*" in the <pid> position
13 # so any old things are removed.
14
15
16 PID="$1"
17
18
19 case "$2/$#" in
20
21 help/*)
22         CMD=$(basename "$0")
23         echo "Usage details (where <pid> is just a handle):"
24         echo "$CMD <pid> help"
25         echo "$CMD <pid> add-range-offer <start-IPv6addr> <end-IPv6addr>"
26         echo "$CMD <pid> add-route-offer <IPv6prefix> <prefix-len> <router-IPv6addr>"
27         echo "$CMD <pid> del-offers"
28         echo "$CMD  \"*\"  del-offers"
29         ;;
30
31 add-range-offer/4)
32         # Offer a new IPv6 address range on your network
33         echo >&2 "Not yet implemented: $*"
34         exit 1
35         ;;
36
37 add-route-offer/5)
38         # Offer a new IPv6 route on your network
39         echo >&2 "Not yet implemented: $*"
40         exit 1
41         ;;
42
43 del-offers/2)
44         # Retract previous offers for IPv6 ranges and routes
45         #  - Specific to <pid> or unspecific when it is "*"
46         #  - Silently approve when no work needs to be done
47         #  - Note that <pid> is just a text string
48         echo >&2 "Not yet implemented: $*"
49         exit 1
50         ;;
51
52 *)
53         echo >&2 "Usage: $0 <pid> <subcommand> <args...>"
54         echo >&2 "Try:   $0 \$\$ help"
55         exit 1
56 esac
57
58 exit 0