1 /* 2 * Copyright (c) 2001-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Author: Harti Brandt <harti@freebsd.org> 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 * $FreeBSD$ 31 * 32 * Netgraph interface for SNMPd. Exported stuff. 33 */ 34 #ifndef SNMP_NETGRAPH_H_ 35 #define SNMP_NETGRAPH_H_ 36 37 #include <netgraph/ng_message.h> 38 39 extern ng_ID_t snmp_node; 40 extern u_char *snmp_nodename; 41 42 typedef void ng_cookie_f(const struct ng_mesg *, const char *, ng_ID_t, void *); 43 typedef void ng_hook_f(const char *, const u_char *, size_t, void *); 44 45 void *ng_register_cookie(const struct lmodule *, u_int32_t cookie, 46 ng_ID_t, ng_cookie_f *, void *); 47 void ng_unregister_cookie(void *reg); 48 49 void *ng_register_hook(const struct lmodule *, const char *, 50 ng_hook_f *, void *); 51 void ng_unregister_hook(void *reg); 52 53 void ng_unregister_module(const struct lmodule *); 54 55 int ng_output(const char *path, u_int cookie, u_int opcode, 56 const void *arg, size_t arglen); 57 int ng_output_node(const char *node, u_int cookie, u_int opcode, 58 const void *arg, size_t arglen); 59 int ng_output_id(ng_ID_t node, u_int cookie, u_int opcode, 60 const void *arg, size_t arglen); 61 62 struct ng_mesg *ng_dialog(const char *path, u_int cookie, u_int opcode, 63 const void *arg, size_t arglen); 64 struct ng_mesg *ng_dialog_node(const char *node, u_int cookie, u_int opcode, 65 const void *arg, size_t arglen); 66 struct ng_mesg *ng_dialog_id(ng_ID_t id, u_int cookie, u_int opcode, 67 const void *arg, size_t arglen); 68 69 int ng_send_data(const char *hook, const void *sndbuf, size_t sndlen); 70 71 ng_ID_t ng_mkpeer_id(ng_ID_t, const char *name, const char *type, 72 const char *hook, const char *peerhook); 73 int ng_connect_node(const char *node, const char *ourhook, const char *peerhook); 74 int ng_connect_id(ng_ID_t id, const char *ourhook, const char *peerhook); 75 int ng_connect2_id(ng_ID_t id, ng_ID_t peer, const char *ourhook, 76 const char *peerhook); 77 int ng_connect2_tee_id(ng_ID_t id, ng_ID_t peer, const char *ourhook, 78 const char *peerhook); 79 int ng_rmhook(const char *ourhook); 80 int ng_rmhook_id(ng_ID_t, const char *); 81 int ng_rmhook_tee_id(ng_ID_t, const char *); 82 int ng_shutdown_id(ng_ID_t); 83 84 ng_ID_t ng_next_node_id(ng_ID_t node, const char *type, const char *hook); 85 ng_ID_t ng_node_id(const char *path); 86 ng_ID_t ng_node_id_node(const char *node); 87 ng_ID_t ng_node_name(ng_ID_t, char *); 88 ng_ID_t ng_node_type(ng_ID_t, char *); 89 int ng_peer_hook_id(ng_ID_t, const char *, char *); 90 91 #endif 92