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