Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.h
106216 views
1
/*
2
* Copyright (c) 2001-2003
3
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4
* All rights reserved.
5
*
6
* Author: Harti Brandt <[email protected]>
7
*
8
* Redistribution of this software and documentation and use in source and
9
* binary forms, with or without modification, are permitted provided that
10
* the following conditions are met:
11
*
12
* 1. Redistributions of source code or documentation must retain the above
13
* copyright notice, this list of conditions and the following disclaimer.
14
* 2. Redistributions in binary form must reproduce the above copyright
15
* notice, this list of conditions and the following disclaimer in the
16
* documentation and/or other materials provided with the distribution.
17
*
18
* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY FRAUNHOFER FOKUS
19
* AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22
* FRAUNHOFER FOKUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
25
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
*
30
* Netgraph interface for SNMPd. Exported stuff.
31
*/
32
#ifndef SNMP_NETGRAPH_H_
33
#define SNMP_NETGRAPH_H_
34
35
#include <netgraph/ng_message.h>
36
37
extern ng_ID_t snmp_node;
38
extern u_char *snmp_nodename;
39
40
typedef void ng_cookie_f(const struct ng_mesg *, const char *, ng_ID_t, void *);
41
typedef void ng_hook_f(const char *, const u_char *, size_t, void *);
42
43
void *ng_register_cookie(const struct lmodule *, u_int32_t cookie,
44
ng_ID_t, ng_cookie_f *, void *);
45
void ng_unregister_cookie(void *reg);
46
47
void *ng_register_hook(const struct lmodule *, const char *,
48
ng_hook_f *, void *);
49
void ng_unregister_hook(void *reg);
50
51
void ng_unregister_module(const struct lmodule *);
52
53
int ng_output(const char *path, u_int cookie, u_int opcode,
54
const void *arg, size_t arglen);
55
int ng_output_node(const char *node, u_int cookie, u_int opcode,
56
const void *arg, size_t arglen);
57
int ng_output_id(ng_ID_t node, u_int cookie, u_int opcode,
58
const void *arg, size_t arglen);
59
60
struct ng_mesg *ng_dialog(const char *path, u_int cookie, u_int opcode,
61
const void *arg, size_t arglen);
62
struct ng_mesg *ng_dialog_node(const char *node, u_int cookie, u_int opcode,
63
const void *arg, size_t arglen);
64
struct ng_mesg *ng_dialog_id(ng_ID_t id, u_int cookie, u_int opcode,
65
const void *arg, size_t arglen);
66
67
int ng_send_data(const char *hook, const void *sndbuf, size_t sndlen);
68
69
ng_ID_t ng_mkpeer_id(ng_ID_t, const char *name, const char *type,
70
const char *hook, const char *peerhook);
71
int ng_connect_node(const char *node, const char *ourhook, const char *peerhook);
72
int ng_connect_id(ng_ID_t id, const char *ourhook, const char *peerhook);
73
int ng_connect2_id(ng_ID_t id, ng_ID_t peer, const char *ourhook,
74
const char *peerhook);
75
int ng_connect2_tee_id(ng_ID_t id, ng_ID_t peer, const char *ourhook,
76
const char *peerhook);
77
int ng_rmhook(const char *ourhook);
78
int ng_rmhook_id(ng_ID_t, const char *);
79
int ng_rmhook_tee_id(ng_ID_t, const char *);
80
int ng_shutdown_id(ng_ID_t);
81
82
ng_ID_t ng_next_node_id(ng_ID_t node, const char *type, const char *hook);
83
ng_ID_t ng_node_id(const char *path);
84
ng_ID_t ng_node_id_node(const char *node);
85
ng_ID_t ng_node_name(ng_ID_t, char *);
86
ng_ID_t ng_node_type(ng_ID_t, char *);
87
int ng_peer_hook_id(ng_ID_t, const char *, char *);
88
89
#endif
90
91