~ubuntu-branches/ubuntu/natty/freeradius/natty-updates

« back to all changes in this revision

Viewing changes to src/include/smux.h

  • Committer: Bazaar Package Importer
  • Author(s): Josip Rodin
  • Date: 2009-11-23 03:57:37 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20091123035737-zsgtzhfych8hir68
Tags: 2.1.7+dfsg-1
* Adopting the package, closes: #536623.
* New upstream version, closes: #513484.
  + Fixes the blooper in unlang evaluation logic, closes: #526175.
* Used quilt (and added README.source), and moved upstream file patching
  into debian/patches/. The source is no longer in collab-maint git
  (to make it simpler for me to finally get this out the door), but
  kept the .gitignore should we need that again.
* Dropped the dialup_admin/bin/backup_radacct patch (integrated upstream).
* Dropped the raddb/Makefile patch (problem no longer exists upstream).
* Dropped the lib/packet.c lib/radius.c main/listen.c patches (was from
  upstream 2.0.5 anyway).
* Dropped references to otp.conf, it no longer exists upstream.
  Keep removing the conffile statoverride in prerm.
* Dropped references to snmp.conf, it no longer exists upstream.
  Keep removing the conffile statoverride in prerm.
* Ship /etc/freeradius/modules/* in the freeradius package.
* Stop shipping sites-enabled symlinks in the package and instead create
  them only on initial install, thanks to Matej Vela, closes: #533396.
* Add export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" to the init script
  at the request of John Morrissey, closes: #550143.
* Stop installing /var/run/freeradius in the package to silence Lintian.
  The init script already recreates it at will.
* Remove executable bit from example.pl to silence Lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* SNMP support
2
 
 * Copyright (C) 2000 Jochen Friedrich <jochen@scram.de>
3
 
 * Copyright (C) 1999 Kunihiro Ishiguro <kunihiro@zebra.org>
4
 
 *
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.
9
 
 *
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.
14
 
 *
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
18
 
 */
19
 
 
20
 
#ifndef _SMUX_H
21
 
#define _SMUX_H
22
 
 
23
 
#include <freeradius-devel/ident.h>
24
 
RCSIDH(smux_h, "$Id: smux.h,v 1.12 2007/12/02 16:52:51 aland Exp $")
25
 
 
26
 
#ifdef HAVE_ASN1_SNMP_SNMPIMPL_H
27
 
#include <asn1.h>
28
 
#include <snmp.h>
29
 
#include <snmp_impl.h>
30
 
 
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>
35
 
 
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>
41
 
#endif
42
 
 
43
 
#define SMUX_PORT_DEFAULT 199
44
 
 
45
 
#define SMUXMAXPKTSIZE    1500
46
 
#define SMUXMAXSTRLEN      256
47
 
 
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)
53
 
 
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)
58
 
 
59
 
/* Structures here are mostly compatible with UCD SNMP 4.1.1 */
60
 
 
61
 
#define MATCH_FAILED     (-1)
62
 
#define MATCH_SUCCEEDED  0
63
 
 
64
 
struct variable;
65
 
 
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))
70
 
 
71
 
typedef int (WriteMethod)(int action,
72
 
                          u_char  *var_val,
73
 
                          u_char   var_val_type,
74
 
                          size_t   var_val_len,
75
 
                          const unsigned char  *statP,
76
 
                          oid     *name,
77
 
                          size_t   length);
78
 
 
79
 
typedef const unsigned char *(FindVarMethod)(struct variable *vp,
80
 
  oid     *name,
81
 
  size_t  *length,
82
 
  int      exact,
83
 
  size_t  *var_len,
84
 
  WriteMethod   **write_method);
85
 
 
86
 
/* List */
87
 
struct list
88
 
{
89
 
  struct list *next;
90
 
  void        *data;
91
 
};
92
 
 
93
 
/* SNMP variable */
94
 
struct variable
95
 
{
96
 
  /* Index of the MIB.*/
97
 
  u_char magic;
98
 
 
99
 
  /* Type of variable. */
100
 
  char type;
101
 
 
102
 
  /* Access control list. */
103
 
  u_short acl;
104
 
 
105
 
  /* Callback function. */
106
 
  FindVarMethod *findVar;
107
 
 
108
 
  /* Suffix of the MIB. */
109
 
  u_char namelen;
110
 
  oid name[MAX_OID_LEN];
111
 
};
112
 
 
113
 
/* SNMP tree. */
114
 
struct subtree
115
 
{
116
 
  /* Tree's oid. */
117
 
  oid name[MAX_OID_LEN];
118
 
  u_char name_len;
119
 
 
120
 
  /* List of the variables. */
121
 
  struct variable *variables;
122
 
 
123
 
  /* Length of the variables list. */
124
 
  int variables_num;
125
 
 
126
 
  /* Width of the variables list. */
127
 
  int variables_width;
128
 
 
129
 
  /* Registered flag. */
130
 
  int registered;
131
 
};
132
 
 
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;
137
 
 
138
 
#define SNMP_INTEGER(V) \
139
 
  ( \
140
 
    *var_len = sizeof (int32_t), \
141
 
    snmp_int_val = V, \
142
 
    (u_char *) &snmp_int_val \
143
 
  )
144
 
 
145
 
#define SNMP_IPADDRESS(V) \
146
 
  ( \
147
 
    *var_len = sizeof (struct in_addr), \
148
 
    snmp_in_addr_val = V, \
149
 
    (u_char *) &snmp_in_addr_val \
150
 
  )
151
 
 
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 *,
157
 
    WriteMethod **);
158
 
int smux_open(void);
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);
162
 
 
163
 
#endif /* _SMUX_H */