Commit | Line | Data |
---|---|---|
2e082dfe | 1 | m4_dnl udptunnel-vpn-config.m4: macros for udptunnel-reconf et al |
2 | ||
c07be359 | 3 | m4_dnl This file is part of ipif, part of userv-utils |
9028e234 IJ |
4 | m4_dnl |
5 | m4_dnl Copyright 1996-2013 Ian Jackson <ijackson@chiark.greenend.org.uk> | |
6 | m4_dnl Copyright 1998 David Damerell <damerell@chiark.greenend.org.uk> | |
7 | m4_dnl Copyright 1999,2003 | |
8 | m4_dnl Chancellor Masters and Scholars of the University of Cambridge | |
9 | m4_dnl Copyright 2010 Tony Finch <fanf@dotat.at> | |
10 | m4_dnl | |
2e082dfe | 11 | m4_dnl This is free software; you can redistribute it and/or modify it |
12 | m4_dnl under the terms of the GNU General Public License as published by | |
9028e234 | 13 | m4_dnl the Free Software Foundation; either version 3 of the License, or |
2e082dfe | 14 | m4_dnl (at your option) any later version. |
15 | m4_dnl | |
16 | m4_dnl This program is distributed in the hope that it will be useful, but | |
17 | m4_dnl WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | m4_dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | m4_dnl General Public License for more details. | |
20 | m4_dnl | |
21 | m4_dnl You should have received a copy of the GNU General Public License | |
9028e234 | 22 | m4_dnl along with userv-utils; if not, see http://www.gnu.org/licenses/. |
2e082dfe | 23 | |
24 | m4_define(V_JUNK,1)m4_divert(V_JUNK) | |
25 | m4_define(V_VARIABLE,2) | |
26 | m4_define(V_ACTIVES,3) | |
27 | m4_define(V_PASSIVES,4) | |
28 | m4_changequote([,]) | |
29 | ||
30 | m4_define(V_WARGS, [ | |
31 | m4_define([$1], [m4_ifelse($][#,$2,[$3], | |
32 | [# ]m4___file__:m4___line__[: wrong number of args to $1])])]) | |
33 | ||
34 | V_WARGS([SET], 2, [V_SET([V_$1], [$2])]) | |
35 | m4_define(V_YES, [m4_define([V_SET],[m4_define($][@)])]) | |
36 | m4_define(V_NO, [m4_define([V_SET], [])]) | |
37 | ||
38 | m4_define(V_ACTPA, [ | |
39 | V_WARGS($1, 1, [m4_divert(V_$1S)$][1 m4_dnl | |
40 | m4_divert(V_JUNK)m4_ifelse($][1,V_site, | |
41 | [V_YES], | |
42 | [V_NO] | |
43 | )])]) | |
44 | ||
45 | m4_dnl V_WARGS(, 2, [m4_divert(V_PASSIVES)$1 m4_dnl | |
46 | m4_dnl m4_divert(V_JUNK)m4_ifelse([$1],V_site, [$2])]) | |
47 | ||
48 | m4_divert(V_JUNK) | |
49 | ||
50 | V_YES | |
51 | m4_include(V_defaults) | |
2e082dfe | 52 | |
53 | V_WARGS(SITE, 1, [m4_ifelse([$1],V_site, [V_YES], [V_NO])]) | |
54 | V_YES | |
55 | m4_include(V_sites) | |
56 | m4_undefine([SITE]) | |
57 | ||
58 | V_ACTPA(ACTIVE) | |
59 | V_ACTPA(PASSIVE) | |
60 | V_YES | |
61 | m4_include(V_tunnels) | |
62 | ||
e45548b5 | 63 | V_YES |
64 | m4_include(V_global) | |
65 | ||
2e082dfe | 66 | m4_divert(V_VARIABLE) |
67 | WHVARIABLE | |
68 | m4_divert(V_JUNK) | |
69 | ||
70 | m4_define(V_WANTED, V_[]WANTED) | |
71 | m4_divert(0) | |
72 | m4_undivert(V_WANTED) | |
73 | m4_divert(-1) | |
74 | m4_undivert(V_JUNK) | |
75 | m4_undivert(V_ACTIVES) | |
76 | m4_undivert(V_PASSIVES) | |
77 | m4_undivert(V_VARIABLE) |