update #4 - router
[tomato.git] / release / src / router / shared / nvparse.h
blob24e1fc3fdead4873052e25f8d9a25c4c0f36a1ff
1 /*
2 * Routines for managing persistent storage of port mappings, etc.
4 * Copyright (C) 2012, Broadcom Corporation. All Rights Reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 * $Id: nvparse.h 374496 2012-12-13 08:59:12Z $
21 #ifndef _nvparse_h_
22 #define _nvparse_h_
24 /* 256 entries per list */
25 #if defined(MAX_NVPARSE)
26 #undef MAX_NVPARSE
27 #define MAX_NVPARSE 256
28 #endif
30 /* Maximum number of Traffic Management rules */
31 #define MAX_NUM_TRF_MGMT_RULES 10
33 /* 20 DSCP + 0x0 default */
34 #define MAX_NUM_TRF_MGMT_DWM_RULES 21
36 #if !defined(AUTOFW_PORT_DEPRECATED)
38 * Automatic (application specific) port forwards are described by a
39 * netconf_app_t structure. A specific outbound connection triggers
40 * the expectation of one or more inbound connections which may be
41 * optionally remapped to a different port range.
43 extern bool valid_autofw_port(const netconf_app_t *app);
44 extern bool get_autofw_port(int which, netconf_app_t *app);
45 extern bool set_autofw_port(int which, const netconf_app_t *app);
46 extern bool del_autofw_port(int which);
47 #endif /* !AUTOFW_PORT_DEPRECATED */
50 * Persistent (static) port forwards are described by a netconf_nat_t
51 * structure. On Linux, a netconf_filter_t that matches the target
52 * parameters of the netconf_nat_t should also be added to the INPUT
53 * and FORWARD tables to ACCEPT the forwarded connection.
55 extern bool valid_forward_port(const netconf_nat_t *nat);
56 extern bool get_forward_port(int which, netconf_nat_t *nat);
57 extern bool set_forward_port(int which, const netconf_nat_t *nat);
58 extern bool del_forward_port(int which);
61 * Client filters are described by two netconf_filter_t structures that
62 * differ in match.src.ipaddr alone (to support IP address ranges)
64 extern bool valid_filter_client(const netconf_filter_t *start, const netconf_filter_t *end);
65 extern bool get_filter_client(int which, netconf_filter_t *start, netconf_filter_t *end);
66 extern bool set_filter_client(int which, const netconf_filter_t *start,
67 const netconf_filter_t *end);
68 extern bool del_filter_client(int which);
70 #ifdef __CONFIG_URLFILTER__
72 * URL filters are described by two netconf_urlfilter_t structures that
73 * differ in match.src.ipaddr alone (to support IP address ranges)
75 extern bool valid_filter_url(const netconf_urlfilter_t *start, const netconf_urlfilter_t *end);
76 extern bool get_filter_url(int which, netconf_urlfilter_t *start, netconf_urlfilter_t *end);
77 extern bool set_filter_url(int which, const netconf_urlfilter_t *start,
78 const netconf_urlfilter_t *end);
79 extern bool del_filter_url(int which);
80 #endif /* __CONFIG_URLFILTER__ */
82 #ifdef TRAFFIC_MGMT
83 extern bool valid_trf_mgmt_port(const netconf_trmgmt_t *trmgmt);
84 extern bool set_trf_mgmt_port(char *prefix, int which, const netconf_trmgmt_t *trmgmt);
85 extern bool get_trf_mgmt_port(char *prefix, int which, netconf_trmgmt_t *trmgmt);
86 extern bool del_trf_mgmt_port(char *prefix, int which);
87 extern bool set_trf_mgmt_dwm(char *prefix, int which, const netconf_trmgmt_t *trmgmt);
88 extern bool get_trf_mgmt_dwm(char *prefix, int which, netconf_trmgmt_t *trmgmt);
89 extern bool del_trf_mgmt_dwm(char *prefix, int which);
90 #endif /* TRAFFIC_MGMT */
92 extern bool set_trf_mgmt_dwm(char *prefix, int which, const netconf_trmgmt_t *trmgmt);
93 extern bool get_trf_mgmt_dwm(char *prefix, int which, netconf_trmgmt_t *trmgmt);
94 extern bool del_trf_mgmt_dwm(char *prefix, int which);
97 * WPA/WDS per link configuration. Parameters after 'auth' are
98 * authentication algorithm dependant:
100 * When auth is "psk", the parameter list is:
102 * bool get_wds_wsec(int unit, int which, char *mac, char *role,
103 * char *crypto, char *auth, char *ssid, char *passphrase);
105 extern bool get_wds_wsec(int unit, int which, char *mac, char *role,
106 char *crypto, char *auth, ...);
107 extern bool set_wds_wsec(int unit, int which, char *mac, char *role,
108 char *crypto, char *auth, ...);
109 extern bool del_wds_wsec(int unit, int which);
111 /* Conversion routine for deprecated variables */
112 extern void convert_deprecated(void);
114 #endif /* _nvparse_h_ */