1122405Sharti/*
2122405Sharti * Copyright (c) 2001-2003
3122405Sharti *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4122405Sharti *	All rights reserved.
5122405Sharti *
6122405Sharti * Author: Harti Brandt <harti@freebsd.org>
7122405Sharti *
8122405Sharti * Redistribution of this software and documentation and use in source and
9122405Sharti * binary forms, with or without modification, are permitted provided that
10122405Sharti * the following conditions are met:
11122405Sharti *
12122405Sharti * 1. Redistributions of source code or documentation must retain the above
13122405Sharti *    copyright notice, this list of conditions and the following disclaimer.
14122405Sharti * 2. Redistributions in binary form must reproduce the above copyright
15122405Sharti *    notice, this list of conditions and the following disclaimer in the
16122405Sharti *    documentation and/or other materials provided with the distribution.
17122405Sharti *
18122405Sharti * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY FRAUNHOFER FOKUS
19122405Sharti * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20122405Sharti * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21122405Sharti * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
22122405Sharti * FRAUNHOFER FOKUS OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,
23122405Sharti * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24122405Sharti * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
25122405Sharti * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26122405Sharti * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27122405Sharti * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28122405Sharti * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29122405Sharti *
30122405Sharti * $FreeBSD$
31122405Sharti *
32122405Sharti * Netgraph interface for SNMPd. Exported stuff.
33122405Sharti */
34122405Sharti#ifndef SNMP_NETGRAPH_H_
35122405Sharti#define SNMP_NETGRAPH_H_
36122405Sharti
37122405Sharti#include <netgraph/ng_message.h>
38122405Sharti
39122405Shartiextern ng_ID_t	snmp_node;
40122405Shartiextern u_char *snmp_nodename;
41122405Sharti
42122405Shartitypedef void ng_cookie_f(const struct ng_mesg *, const char *, ng_ID_t, void *);
43122405Shartitypedef void ng_hook_f(const char *, const u_char *, size_t, void *);
44122405Sharti
45122405Shartivoid *ng_register_cookie(const struct lmodule *, u_int32_t cookie,
46122405Sharti    ng_ID_t, ng_cookie_f *, void *);
47122405Shartivoid ng_unregister_cookie(void *reg);
48122405Sharti
49122405Shartivoid *ng_register_hook(const struct lmodule *, const char *,
50122405Sharti    ng_hook_f *, void *);
51122405Shartivoid ng_unregister_hook(void *reg);
52122405Sharti
53122405Shartivoid ng_unregister_module(const struct lmodule *);
54122405Sharti
55122405Shartiint ng_output(const char *path, u_int cookie, u_int opcode,
56122405Sharti    const void *arg, size_t arglen);
57122405Shartiint ng_output_node(const char *node, u_int cookie, u_int opcode,
58122405Sharti    const void *arg, size_t arglen);
59122405Shartiint ng_output_id(ng_ID_t node, u_int cookie, u_int opcode,
60122405Sharti    const void *arg, size_t arglen);
61122405Sharti
62122405Shartistruct ng_mesg *ng_dialog(const char *path, u_int cookie, u_int opcode,
63122405Sharti    const void *arg, size_t arglen);
64122405Shartistruct ng_mesg *ng_dialog_node(const char *node, u_int cookie, u_int opcode,
65122405Sharti    const void *arg, size_t arglen);
66122405Shartistruct ng_mesg *ng_dialog_id(ng_ID_t id, u_int cookie, u_int opcode,
67122405Sharti    const void *arg, size_t arglen);
68122405Sharti
69122405Shartiint ng_send_data(const char *hook, const void *sndbuf, size_t sndlen);
70122405Sharti
71122405Sharting_ID_t ng_mkpeer_id(ng_ID_t, const char *name, const char *type,
72122405Sharti    const char *hook, const char *peerhook);
73122405Shartiint ng_connect_node(const char *node, const char *ourhook, const char *peerhook);
74122405Shartiint ng_connect_id(ng_ID_t id, const char *ourhook, const char *peerhook);
75122405Shartiint ng_connect2_id(ng_ID_t id, ng_ID_t peer, const char *ourhook,
76122405Sharti    const char *peerhook);
77122405Shartiint ng_connect2_tee_id(ng_ID_t id, ng_ID_t peer, const char *ourhook,
78122405Sharti    const char *peerhook);
79122405Shartiint ng_rmhook(const char *ourhook);
80122405Shartiint ng_rmhook_id(ng_ID_t, const char *);
81122405Shartiint ng_rmhook_tee_id(ng_ID_t, const char *);
82122405Shartiint ng_shutdown_id(ng_ID_t);
83122405Sharti
84122405Sharting_ID_t ng_next_node_id(ng_ID_t node, const char *type, const char *hook);
85122405Sharting_ID_t ng_node_id(const char *path);
86122405Sharting_ID_t ng_node_id_node(const char *node);
87122405Sharting_ID_t ng_node_name(ng_ID_t, char *);
88122405Sharting_ID_t ng_node_type(ng_ID_t, char *);
89122405Shartiint ng_peer_hook_id(ng_ID_t, const char *, char *);
90122405Sharti
91122405Sharti#endif
92