2 * Copyright (C) 2000 Jochen Friedrich <jochen@scram.de>
3 * Copyright (C) 1999 Kunihiro Ishiguro <kunihiro@zebra.org>
5 * You should have received a copy of the GNU General Public License
6 * along with GNU Zebra; see the file COPYING. If not, write to the Free
7 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
14 #ifdef HAVE_ASN1_SNMP_SNMPIMPL_H
17 #include <snmp_impl.h>
19 # ifdef HAVE_UCD_SNMP_ASN1_SNMP_SNMPIMPL_H
20 # include <ucd-snmp/ucd-snmp-config.h>
21 # include <ucd-snmp/asn1.h>
22 # include <ucd-snmp/snmp.h>
23 # include <ucd-snmp/snmp_impl.h>
27 #define SMUX_PORT_DEFAULT 199
29 #define SMUXMAXPKTSIZE 1500
30 #define SMUXMAXSTRLEN 256
32 #define SMUX_OPEN (ASN_APPLICATION | ASN_CONSTRUCTOR | 0)
33 #define SMUX_CLOSE (ASN_APPLICATION | ASN_PRIMITIVE | 1)
34 #define SMUX_RREQ (ASN_APPLICATION | ASN_CONSTRUCTOR | 2)
35 #define SMUX_RRSP (ASN_APPLICATION | ASN_PRIMITIVE | 3)
36 #define SMUX_SOUT (ASN_APPLICATION | ASN_PRIMITIVE | 4)
38 #define SMUX_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0)
39 #define SMUX_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 1)
40 #define SMUX_GETRSP (ASN_CONTEXT | ASN_CONSTRUCTOR | 2)
41 #define SMUX_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 3)
43 /* Structures here are mostly compatible with UCD SNMP 4.1.1 */
45 #define MATCH_FAILED (-1)
46 #define MATCH_SUCCEEDED 0
50 #define REGISTER_MIB(descr, var, vartype, theoid) \
51 smux_register_mib(descr, (struct variable *)var, sizeof(struct vartype), \
52 sizeof(var)/sizeof(struct vartype), \
53 theoid, sizeof(theoid)/sizeof(oid))
55 typedef int (WriteMethod)(int action,
59 const unsigned char *statP,
63 typedef const unsigned char *(FindVarMethod)(struct variable *vp,
68 WriteMethod **write_method);
80 /* Index of the MIB.*/
83 /* Type of variable. */
86 /* Access control list. */
89 /* Callback function. */
90 FindVarMethod *findVar;
92 /* Suffix of the MIB. */
94 oid name[MAX_OID_LEN];
101 oid name[MAX_OID_LEN];
104 /* List of the variables. */
105 struct variable *variables;
107 /* Length of the variables list. */
110 /* Width of the variables list. */
113 /* Registered flag. */
117 /* Declare SMUX return value. */
118 #define SNMP_LOCAL_VARIABLES \
119 static int32_t snmp_int_val; \
120 static struct in_addr snmp_in_addr_val;
122 #define SNMP_INTEGER(V) \
124 *var_len = sizeof (int32_t), \
126 (u_char *) &snmp_int_val \
129 #define SNMP_IPADDRESS(V) \
131 *var_len = sizeof (struct in_addr), \
132 snmp_in_addr_val = V, \
133 (u_char *) &snmp_in_addr_val \
136 void smux_init(oid [], size_t);
137 void smux_start(void);
138 void smux_stop(void);
139 void smux_register_mib(const char *, struct variable *, size_t, int, oid [], size_t);
140 int smux_header_generic (struct variable *, oid [], size_t *, int, size_t *,
143 int smux_str2oid (char *str, oid *my_oid, size_t *oid_len);
144 oid *smux_oid_dup (oid *objid, size_t objid_len);
145 int smux_register(void);