2
* Copyright (C) 2000 Jochen Friedrich <jochen@scram.de>
3
* Copyright (C) 1999 Kunihiro Ishiguro <kunihiro@zebra.org>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23
#include <freeradius-devel/ident.h>
24
RCSIDH(smux_h, "$Id: smux.h,v 1.12 2007/12/02 16:52:51 aland Exp $")
26
#ifdef HAVE_ASN1_SNMP_SNMPIMPL_H
29
#include <snmp_impl.h>
31
#elif defined (HAVE_NET_SNMP_NET_SNMP_CONFIG_H)
32
# include <net-snmp/net-snmp-config.h>
33
# include <net-snmp/definitions.h>
34
# include <net-snmp/types.h>
36
#elif defined(HAVE_UCD_SNMP_ASN1_SNMP_SNMPIMPL_H)
37
# include <ucd-snmp/ucd-snmp-config.h>
38
# include <ucd-snmp/asn1.h>
39
# include <ucd-snmp/snmp.h>
40
# include <ucd-snmp/snmp_impl.h>
43
#define SMUX_PORT_DEFAULT 199
45
#define SMUXMAXPKTSIZE 1500
46
#define SMUXMAXSTRLEN 256
48
#define SMUX_OPEN (ASN_APPLICATION | ASN_CONSTRUCTOR | 0)
49
#define SMUX_CLOSE (ASN_APPLICATION | ASN_PRIMITIVE | 1)
50
#define SMUX_RREQ (ASN_APPLICATION | ASN_CONSTRUCTOR | 2)
51
#define SMUX_RRSP (ASN_APPLICATION | ASN_PRIMITIVE | 3)
52
#define SMUX_SOUT (ASN_APPLICATION | ASN_PRIMITIVE | 4)
54
#define SMUX_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0)
55
#define SMUX_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 1)
56
#define SMUX_GETRSP (ASN_CONTEXT | ASN_CONSTRUCTOR | 2)
57
#define SMUX_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 3)
59
/* Structures here are mostly compatible with UCD SNMP 4.1.1 */
61
#define MATCH_FAILED (-1)
62
#define MATCH_SUCCEEDED 0
66
#define SMUX_REGISTER_MIB(descr, var, vartype, theoid) \
67
smux_register_mib(descr, (struct variable *)var, sizeof(struct vartype), \
68
sizeof(var)/sizeof(struct vartype), \
69
theoid, sizeof(theoid)/sizeof(oid))
71
typedef int (WriteMethod)(int action,
75
const unsigned char *statP,
79
typedef const unsigned char *(FindVarMethod)(struct variable *vp,
84
WriteMethod **write_method);
96
/* Index of the MIB.*/
99
/* Type of variable. */
102
/* Access control list. */
105
/* Callback function. */
106
FindVarMethod *findVar;
108
/* Suffix of the MIB. */
110
oid name[MAX_OID_LEN];
117
oid name[MAX_OID_LEN];
120
/* List of the variables. */
121
struct variable *variables;
123
/* Length of the variables list. */
126
/* Width of the variables list. */
129
/* Registered flag. */
133
/* Declare SMUX return value. */
134
#define SNMP_LOCAL_VARIABLES \
135
static int32_t snmp_int_val; \
136
static struct in_addr snmp_in_addr_val;
138
#define SNMP_INTEGER(V) \
140
*var_len = sizeof (int32_t), \
142
(u_char *) &snmp_int_val \
145
#define SNMP_IPADDRESS(V) \
147
*var_len = sizeof (struct in_addr), \
148
snmp_in_addr_val = V, \
149
(u_char *) &snmp_in_addr_val \
152
void smux_init(oid [], size_t);
153
void smux_start(void);
154
void smux_stop(void);
155
void smux_register_mib(const char *, struct variable *, size_t, int, oid [], size_t);
156
int smux_header_generic (struct variable *, oid [], size_t *, int, size_t *,
159
int smux_str2oid (char *str, oid *my_oid, size_t *oid_len);
160
oid *smux_oid_dup (oid *objid, size_t objid_len);
161
int smux_register(void);