1259ee3d7SHartmut Brandt /*
2259ee3d7SHartmut Brandt  * Copyright (c) 2001-2003
3259ee3d7SHartmut Brandt  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4259ee3d7SHartmut Brandt  *	All rights reserved.
5259ee3d7SHartmut Brandt  *
6259ee3d7SHartmut Brandt  * Author: Harti Brandt <harti@freebsd.org>
7259ee3d7SHartmut Brandt  *
8259ee3d7SHartmut Brandt  * Redistribution of this software and documentation and use in source and
9259ee3d7SHartmut Brandt  * binary forms, with or without modification, are permitted provided that
10259ee3d7SHartmut Brandt  * the following conditions are met:
11259ee3d7SHartmut Brandt  *
12259ee3d7SHartmut Brandt  * 1. Redistributions of source code or documentation must retain the above
13259ee3d7SHartmut Brandt  *    copyright notice, this list of conditions and the following disclaimer.
14259ee3d7SHartmut Brandt  * 2. Redistributions in binary form must reproduce the above copyright
15259ee3d7SHartmut Brandt  *    notice, this list of conditions and the following disclaimer in the
16259ee3d7SHartmut Brandt  *    documentation and/or other materials provided with the distribution.
17259ee3d7SHartmut Brandt  *
18259ee3d7SHartmut Brandt  * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY FRAUNHOFER FOKUS
19259ee3d7SHartmut Brandt  * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20259ee3d7SHartmut Brandt  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21259ee3d7SHartmut Brandt  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
22259ee3d7SHartmut Brandt  * FRAUNHOFER FOKUS OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,
23259ee3d7SHartmut Brandt  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24259ee3d7SHartmut Brandt  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
25259ee3d7SHartmut Brandt  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26259ee3d7SHartmut Brandt  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27259ee3d7SHartmut Brandt  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28259ee3d7SHartmut Brandt  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29259ee3d7SHartmut Brandt  *
30259ee3d7SHartmut Brandt  * Netgraph interface for SNMPd. Exported stuff.
31259ee3d7SHartmut Brandt  */
32259ee3d7SHartmut Brandt #ifndef SNMP_NETGRAPH_H_
33259ee3d7SHartmut Brandt #define SNMP_NETGRAPH_H_
34259ee3d7SHartmut Brandt 
35259ee3d7SHartmut Brandt #include <netgraph/ng_message.h>
36259ee3d7SHartmut Brandt 
37259ee3d7SHartmut Brandt extern ng_ID_t	snmp_node;
38259ee3d7SHartmut Brandt extern u_char *snmp_nodename;
39259ee3d7SHartmut Brandt 
40259ee3d7SHartmut Brandt typedef void ng_cookie_f(const struct ng_mesg *, const char *, ng_ID_t, void *);
41259ee3d7SHartmut Brandt typedef void ng_hook_f(const char *, const u_char *, size_t, void *);
42259ee3d7SHartmut Brandt 
43259ee3d7SHartmut Brandt void *ng_register_cookie(const struct lmodule *, u_int32_t cookie,
44259ee3d7SHartmut Brandt     ng_ID_t, ng_cookie_f *, void *);
45259ee3d7SHartmut Brandt void ng_unregister_cookie(void *reg);
46259ee3d7SHartmut Brandt 
47259ee3d7SHartmut Brandt void *ng_register_hook(const struct lmodule *, const char *,
48259ee3d7SHartmut Brandt     ng_hook_f *, void *);
49259ee3d7SHartmut Brandt void ng_unregister_hook(void *reg);
50259ee3d7SHartmut Brandt 
51259ee3d7SHartmut Brandt void ng_unregister_module(const struct lmodule *);
52259ee3d7SHartmut Brandt 
53259ee3d7SHartmut Brandt int ng_output(const char *path, u_int cookie, u_int opcode,
54259ee3d7SHartmut Brandt     const void *arg, size_t arglen);
55259ee3d7SHartmut Brandt int ng_output_node(const char *node, u_int cookie, u_int opcode,
56259ee3d7SHartmut Brandt     const void *arg, size_t arglen);
57259ee3d7SHartmut Brandt int ng_output_id(ng_ID_t node, u_int cookie, u_int opcode,
58259ee3d7SHartmut Brandt     const void *arg, size_t arglen);
59259ee3d7SHartmut Brandt 
60259ee3d7SHartmut Brandt struct ng_mesg *ng_dialog(const char *path, u_int cookie, u_int opcode,
61259ee3d7SHartmut Brandt     const void *arg, size_t arglen);
62259ee3d7SHartmut Brandt struct ng_mesg *ng_dialog_node(const char *node, u_int cookie, u_int opcode,
63259ee3d7SHartmut Brandt     const void *arg, size_t arglen);
64259ee3d7SHartmut Brandt struct ng_mesg *ng_dialog_id(ng_ID_t id, u_int cookie, u_int opcode,
65259ee3d7SHartmut Brandt     const void *arg, size_t arglen);
66259ee3d7SHartmut Brandt 
67259ee3d7SHartmut Brandt int ng_send_data(const char *hook, const void *sndbuf, size_t sndlen);
68259ee3d7SHartmut Brandt 
69259ee3d7SHartmut Brandt ng_ID_t ng_mkpeer_id(ng_ID_t, const char *name, const char *type,
70259ee3d7SHartmut Brandt     const char *hook, const char *peerhook);
71259ee3d7SHartmut Brandt int ng_connect_node(const char *node, const char *ourhook, const char *peerhook);
72259ee3d7SHartmut Brandt int ng_connect_id(ng_ID_t id, const char *ourhook, const char *peerhook);
73259ee3d7SHartmut Brandt int ng_connect2_id(ng_ID_t id, ng_ID_t peer, const char *ourhook,
74259ee3d7SHartmut Brandt     const char *peerhook);
75259ee3d7SHartmut Brandt int ng_connect2_tee_id(ng_ID_t id, ng_ID_t peer, const char *ourhook,
76259ee3d7SHartmut Brandt     const char *peerhook);
77259ee3d7SHartmut Brandt int ng_rmhook(const char *ourhook);
78259ee3d7SHartmut Brandt int ng_rmhook_id(ng_ID_t, const char *);
79259ee3d7SHartmut Brandt int ng_rmhook_tee_id(ng_ID_t, const char *);
80259ee3d7SHartmut Brandt int ng_shutdown_id(ng_ID_t);
81259ee3d7SHartmut Brandt 
82259ee3d7SHartmut Brandt ng_ID_t ng_next_node_id(ng_ID_t node, const char *type, const char *hook);
83259ee3d7SHartmut Brandt ng_ID_t ng_node_id(const char *path);
84259ee3d7SHartmut Brandt ng_ID_t ng_node_id_node(const char *node);
85259ee3d7SHartmut Brandt ng_ID_t ng_node_name(ng_ID_t, char *);
86259ee3d7SHartmut Brandt ng_ID_t ng_node_type(ng_ID_t, char *);
87259ee3d7SHartmut Brandt int ng_peer_hook_id(ng_ID_t, const char *, char *);
88259ee3d7SHartmut Brandt 
89259ee3d7SHartmut Brandt #endif
90