1 /* 2 This file is part of GNU Radius SNMP Library. 3 Copyright (C) 2001,2007 Free Software Foundation, Inc. 4 Written by Sergey Poznyakoff 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public License as 8 published by the Free Software Foundation; either version 3 of the 9 License, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with this library; see the file COPYING.LIB. If not, 18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 Boston, MA 02111-1307, USA. */ 20 21 #define MIB_ERROR -1 22 #define MIB_SUCCESS 0 23 #define MIB_MATCH_EXACT 0 24 #define MIB_MATCH_UPPER 1 25 #define MIB_MATCH_PREV 2 26 27 struct mib_node_t; 28 29 enum mib_node_cmd { 30 MIB_NODE_GET, 31 MIB_NODE_SET, 32 MIB_NODE_SET_TRY, 33 MIB_NODE_COMPARE, 34 MIB_NODE_NEXT, 35 MIB_NODE_GET_SUBID, 36 MIB_NODE_RESET 37 }; 38 39 typedef int (*mib_fp)(enum mib_node_cmd, void *, 40 subid_t, 41 struct snmp_var **, int *); 42 43 struct mib_node_t { 44 struct mib_node_t *up, *down, *next; 45 subid_t subid; 46 int index; 47 mib_fp handler; 48 void *closure; 49 }; 50 51 #define SUBID_X (subid_t)-1 52 53 int mib_lookup(struct mib_node_t *node, oid_t oid, int len, 54 struct mib_node_t **return_node); 55 int mib_insert_node(struct mib_node_t **root_node, oid_t oid, int len, 56 struct mib_node_t **return_node); 57 int mib_insert(struct mib_node_t **node, oid_t oid, 58 struct mib_node_t **return_node); 59 60 61 62