/usr/include/gsnmp/utils.h is in libgsnmp0-dev 0.3.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | /*
* GNET-SNMP -- glib-based SNMP implementation
*
* Copyright (C) 2003 Juergen Schoenwaelder
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: utils.h 3178 2009-07-28 10:23:24Z schoenw $
*/
#ifndef __GNET_SNMP_UTILS_H__
#define __GNET_SNMP_UTILS_H__
/*
* Return the gsnmp specific command line option group to be used with
* the glib command line option parser.
*/
GOptionGroup *gnet_snmp_get_option_group ();
/*
* Lexicographically compare two object identifiers oid1 and oid2 with
* length len1 and len2 and return -1, 0 or 1 if oid1 is found to be
* less than, to match or be greater than oid2.
*/
gint gnet_snmp_compare_oids (const guint32 *oid1, const gsize len1,
const guint32 *oid2, const gsize len2);
/*
* Parse a string into an SNMP URI. This function also handles
* abbreviated URIs.
*/
GURI* gnet_snmp_parse_uri (const gchar *string, GError **error);
/*
* Parse the query contained in 2nd element of a path of the snmp: URI
* scheme. The path passed to this function is the full path of the
* URI.
*/
typedef enum
{
GNET_SNMP_URI_ERROR_NOOIDS,
GNET_SNMP_URI_ERROR_TRAIL,
GNET_SNMP_URI_ERROR_LPAREN,
GNET_SNMP_URI_ERROR_RPAREN,
GNET_SNMP_URI_ERROR_COMMA,
GNET_SNMP_URI_ERROR_INT,
GNET_SNMP_URI_ERROR_DOT,
GNET_SNMP_URI_ERROR_STAR,
GNET_SNMP_URI_ERROR_PLUS,
GNET_SNMP_URI_ERROR_TOKEN,
GNET_SNMP_URI_ERROR_EOF
} GNetSnmpUriError;
#define GNET_SNMP_URI_ERROR gnet_snmp_uri_error_quark()
GQuark gnet_snmp_uri_error_quark();
typedef enum
{
GNET_SNMP_URI_GET,
GNET_SNMP_URI_NEXT,
GNET_SNMP_URI_WALK
} GNetSnmpUriType;
gboolean gnet_snmp_parse_path (const gchar *path, GList **vbl,
GNetSnmpUriType *type,
GError **error);
/*
* The following types and the associated functions are used to
* map enumerated numbers to labels and vice versa.
*/
typedef struct _GNetSnmpEnum GNetSnmpEnum;
typedef struct _GNetSnmpIdentity GNetSnmpIdentity;
struct _GNetSnmpEnum {
gint32 const number;
gchar const *label;
};
gchar const *
gnet_snmp_enum_get_label(GNetSnmpEnum const *table, gint32 const id);
gboolean
gnet_snmp_enum_get_number(GNetSnmpEnum const *table, gchar const *str,
gint32 *number);
struct _GNetSnmpIdentity {
guint32 const *oid;
gsize const oidlen;
gchar const *label;
};
gchar const *
gnet_snmp_identity_get_label(GNetSnmpIdentity const *table,
guint32 const *oid, gsize oidlen);
guint32 *
gnet_snmp_identity_get_identity(GNetSnmpIdentity const *table,
gchar const *str, gsize *oidlen);
/*
* SNMP specific enumerations
*/
extern GNetSnmpEnum const gnet_snmp_enum_version_table[];
extern GNetSnmpEnum const gnet_snmp_enum_error_table[];
extern GNetSnmpEnum const gnet_snmp_enum_debug_table[];
extern GNetSnmpEnum const gnet_snmp_enum_tdomain_table[];
extern GNetSnmpEnum const gnet_snmp_enum_type_table[];
extern GNetSnmpEnum const gnet_snmp_enum_pdu_table[];
/*
* The following utility functions and data structures are used by the
* scli stubs generated by the smidump MIB compiler.
*/
typedef enum
{
GSNMP_ATTR_FLAG_WRITABLE = 1 << 0, /* attribute is writable */
GSNMP_ATTR_FLAG_FIXED_LENGTH = 1 << 1, /* if set, len_offset contains the length */
GSNMP_ATTR_FLAG_MASK = 0x03
} GNetSnmpAttrFlags;
typedef struct {
const guint32 subid; /* column/scalar subid */
const GNetSnmpVarBindType type; /* SNMP type of the value */
const gint tag; /* internal identification tag */
const gchar *label; /* label (used for error reports) */
const gpointer constraints;/* range or size constraints */
const guint16 val_offset; /* offset for the value pointer */
const guint16 len_offset; /* offset for the length pointer */
const GNetSnmpAttrFlags flags; /* various flags, see above */
} GNetSnmpAttribute;
extern int gnet_snmp_attr_assign(GList *vbl,
guint32 const *base, size_t const len,
const GNetSnmpAttribute *attributes,
const gpointer p);
extern void gnet_snmp_attr_get(const GNetSnmp *s, GList **vbl,
guint32 *base, size_t const len,
guint const idx,
const GNetSnmpAttribute *attributes,
const gint64 mask);
extern void gnet_snmp_attr_set(const GNetSnmp *s, GList **vbl,
guint32 *base, size_t len,
guint const idx,
const GNetSnmpAttribute *attributes,
const gint64 mask,
const gpointer p);
#endif /* __GNET_SNMP_UTILS_H__ */
|