File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / quagga / lib / smux.h
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Sun Jul 21 23:54:39 2013 UTC (10 years, 11 months ago) by misho
Branches: quagga, MAIN
CVS tags: v0_99_22p0, v0_99_22, HEAD
0.99.22

    1: /* SNMP support
    2:  * Copyright (C) 1999 Kunihiro Ishiguro <kunihiro@zebra.org>
    3:  *
    4:  * This file is part of GNU Zebra.
    5:  *
    6:  * GNU Zebra is free software; you can redistribute it and/or modify it
    7:  * under the terms of the GNU General Public License as published by the
    8:  * Free Software Foundation; either version 2, or (at your option) any
    9:  * later version.
   10:  *
   11:  * GNU Zebra is distributed in the hope that it will be useful, but
   12:  * WITHOUT ANY WARRANTY; without even the implied warranty of
   13:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   14:  * General Public License for more details.
   15:  *
   16:  * You should have received a copy of the GNU General Public License
   17:  * along with GNU Zebra; see the file COPYING.  If not, write to the Free
   18:  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   19:  * 02111-1307, USA.  
   20:  */
   21: 
   22: #ifndef _ZEBRA_SNMP_H
   23: #define _ZEBRA_SNMP_H
   24: 
   25: #include <net-snmp/agent/net-snmp-agent-includes.h>
   26: #include <net-snmp/agent/snmp_vars.h>
   27: 
   28: /* Structures here are mostly compatible with UCD SNMP 4.1.1 */
   29: #define MATCH_FAILED     (-1)
   30: #define MATCH_SUCCEEDED  0
   31: 
   32: /* SYNTAX TruthValue from SNMPv2-TC. */
   33: #define SNMP_TRUE  1
   34: #define SNMP_FALSE 2
   35: 
   36: /* SYNTAX RowStatus from SNMPv2-TC. */
   37: #define SNMP_VALID  1
   38: #define SNMP_INVALID 2
   39: 
   40: #define IN_ADDR_SIZE sizeof(struct in_addr)
   41: 
   42: #undef REGISTER_MIB
   43: #define REGISTER_MIB(descr, var, vartype, theoid)		\
   44:     smux_register_mib(descr, (struct variable *)var, sizeof(struct vartype), \
   45:     sizeof(var)/sizeof(struct vartype),			\
   46:     theoid, sizeof(theoid)/sizeof(oid))
   47: 
   48: struct trap_object
   49: {
   50:   int namelen; /* Negative if the object is not indexed */
   51:   oid name[MAX_OID_LEN];
   52: };
   53: 
   54: /* Declare SMUX return value. */
   55: #define SNMP_LOCAL_VARIABLES \
   56:   static long snmp_int_val; \
   57:   static struct in_addr snmp_in_addr_val;
   58: 
   59: #define SNMP_INTEGER(V) \
   60:   ( \
   61:     *var_len = sizeof (snmp_int_val), \
   62:     snmp_int_val = V, \
   63:     (u_char *) &snmp_int_val \
   64:   )
   65: 
   66: #define SNMP_IPADDRESS(V) \
   67:   ( \
   68:     *var_len = sizeof (struct in_addr), \
   69:     snmp_in_addr_val = V, \
   70:     (u_char *) &snmp_in_addr_val \
   71:   )
   72: 
   73: extern void smux_init (struct thread_master *tm);
   74: extern void smux_register_mib(const char *, struct variable *, 
   75:                               size_t, int, oid [], size_t);
   76: extern int smux_header_generic (struct variable *, oid [], size_t *, 
   77:                                 int, size_t *, WriteMethod **);
   78: extern int smux_header_table (struct variable *, oid *, size_t *, 
   79: 			      int, size_t *, WriteMethod **);
   80: 
   81: /* For traps, three OID are provided:
   82: 
   83:  1. The enterprise OID to use (the last argument will be appended to
   84:     it to form the SNMP trap OID)
   85: 
   86:  2. The base OID for objects to be sent in traps.
   87: 
   88:  3. The index OID for objects to be sent in traps. This index is used
   89:     to designate a particular instance of a column.
   90: 
   91:  The provided trap object contains the bindings to be sent with the
   92:  trap. The base OID will be prefixed to the provided OID and, if the
   93:  length is positive, the requested OID is assumed to be a columnar
   94:  object and the index OID will be appended.
   95: 
   96:  The two first arguments are the MIB registry used to locate the trap
   97:  objects.
   98: 
   99:  The use of the arguments may differ depending on the implementation
  100:  used.
  101: */
  102: extern int smux_trap (struct variable *, size_t,
  103: 		      const oid *, size_t,
  104: 		      const oid *, size_t,
  105: 		      const oid *, size_t,
  106: 		      const struct trap_object *, size_t,
  107: 		      u_char);
  108: 
  109: extern int oid_compare (oid *, int, oid *, int);
  110: extern void oid2in_addr (oid [], int, struct in_addr *);
  111: extern void *oid_copy (void *, const void *, size_t);
  112: extern void oid_copy_addr (oid [], struct in_addr *, int);
  113: 
  114: #endif /* _ZEBRA_SNMP_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>