extern.h revision 1.13 1 1.13 dyoung /* $NetBSD: extern.h,v 1.13 2008/07/15 20:56:13 dyoung Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*
4 1.1 thorpej * Copyright (c) 1983, 1993
5 1.1 thorpej * The Regents of the University of California. All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * Redistribution and use in source and binary forms, with or without
8 1.1 thorpej * modification, are permitted provided that the following conditions
9 1.1 thorpej * are met:
10 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
11 1.1 thorpej * notice, this list of conditions and the following disclaimer.
12 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
14 1.1 thorpej * documentation and/or other materials provided with the distribution.
15 1.1 thorpej * 3. Neither the name of the University nor the names of its contributors
16 1.1 thorpej * may be used to endorse or promote products derived from this software
17 1.1 thorpej * without specific prior written permission.
18 1.1 thorpej *
19 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.1 thorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.1 thorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 1.1 thorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.1 thorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.1 thorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.1 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.1 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.1 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.1 thorpej * SUCH DAMAGE.
30 1.1 thorpej */
31 1.12 dyoung #ifndef _IFCONFIG_EXTERN_H
32 1.12 dyoung #define _IFCONFIG_EXTERN_H
33 1.12 dyoung
34 1.12 dyoung #include <prop/proplib.h>
35 1.11 dyoung #include "util.h"
36 1.1 thorpej
37 1.6 thorpej #define RIDADDR 0
38 1.6 thorpej #define ADDR 1
39 1.6 thorpej #define MASK 2
40 1.6 thorpej #define DSTADDR 3
41 1.6 thorpej
42 1.13 dyoung typedef void (*usage_cb_t)(prop_dictionary_t);
43 1.12 dyoung typedef void (*status_cb_t)(prop_dictionary_t, prop_dictionary_t);
44 1.12 dyoung typedef void (*statistics_cb_t)(prop_dictionary_t);
45 1.12 dyoung
46 1.13 dyoung enum flag_type {
47 1.13 dyoung FLAG_T_MOD = 0
48 1.13 dyoung , FLAG_T_CMD = 1
49 1.13 dyoung };
50 1.13 dyoung
51 1.13 dyoung typedef enum flag_type flag_type_t;
52 1.13 dyoung
53 1.12 dyoung struct statistics_func {
54 1.12 dyoung SIMPLEQ_ENTRY(statistics_func) f_next;
55 1.12 dyoung statistics_cb_t f_func;
56 1.12 dyoung };
57 1.12 dyoung
58 1.13 dyoung struct usage_func {
59 1.13 dyoung SIMPLEQ_ENTRY(usage_func) f_next;
60 1.13 dyoung usage_cb_t f_func;
61 1.13 dyoung };
62 1.13 dyoung
63 1.12 dyoung struct status_func {
64 1.12 dyoung SIMPLEQ_ENTRY(status_func) f_next;
65 1.12 dyoung status_cb_t f_func;
66 1.12 dyoung };
67 1.12 dyoung
68 1.12 dyoung struct cmdloop_branch {
69 1.12 dyoung SIMPLEQ_ENTRY(cmdloop_branch) b_next;
70 1.12 dyoung struct parser *b_parser;
71 1.12 dyoung };
72 1.12 dyoung
73 1.12 dyoung
74 1.12 dyoung typedef struct statistics_func statistics_func_t;
75 1.12 dyoung typedef struct status_func status_func_t;
76 1.13 dyoung typedef struct usage_func usage_func_t;
77 1.12 dyoung typedef struct cmdloop_branch cmdloop_branch_t;
78 1.12 dyoung
79 1.12 dyoung void cmdloop_branch_init(cmdloop_branch_t *, struct parser *);
80 1.12 dyoung int register_family(struct afswtch *);
81 1.12 dyoung int register_cmdloop_branch(cmdloop_branch_t *);
82 1.12 dyoung void statistics_func_init(statistics_func_t *, statistics_cb_t);
83 1.12 dyoung void status_func_init(status_func_t *, status_cb_t);
84 1.13 dyoung void usage_func_init(usage_func_t *, usage_cb_t);
85 1.12 dyoung int register_statistics(statistics_func_t *);
86 1.12 dyoung int register_status(status_func_t *);
87 1.13 dyoung int register_usage(usage_func_t *);
88 1.12 dyoung int register_flag(int);
89 1.12 dyoung bool get_flag(int);
90 1.12 dyoung
91 1.12 dyoung extern bool lflag, vflag, zflag;
92 1.12 dyoung
93 1.12 dyoung #endif /* _IFCONFIG_EXTERN_H */
94