SNMP++
3.3.4
Main Page
Classes
Files
File List
File Members
smival.h
Go to the documentation of this file.
1
/*_############################################################################
2
_##
3
_## smival.h
4
_##
5
_## SNMP++ v3.3
6
_## -----------------------------------------------
7
_## Copyright (c) 2001-2013 Jochen Katz, Frank Fock
8
_##
9
_## This software is based on SNMP++2.6 from Hewlett Packard:
10
_##
11
_## Copyright (c) 1996
12
_## Hewlett-Packard Company
13
_##
14
_## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
15
_## Permission to use, copy, modify, distribute and/or sell this software
16
_## and/or its documentation is hereby granted without fee. User agrees
17
_## to display the above copyright notice and this license notice in all
18
_## copies of the software and any documentation of the software. User
19
_## agrees to assume all liability for the use of the software;
20
_## Hewlett-Packard and Jochen Katz make no representations about the
21
_## suitability of this software for any purpose. It is provided
22
_## "AS-IS" without warranty of any kind, either express or implied. User
23
_## hereby grants a royalty-free license to any and all derivatives based
24
_## upon this software code base.
25
_##
26
_##########################################################################*/
27
/*===================================================================
28
29
Copyright (c) 1999
30
Hewlett-Packard Company
31
32
ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
33
Permission to use, copy, modify, distribute and/or sell this software
34
and/or its documentation is hereby granted without fee. User agrees
35
to display the above copyright notice and this license notice in all
36
copies of the software and any documentation of the software. User
37
agrees to assume all liability for the use of the software; Hewlett-Packard
38
makes no representations about the suitability of this software for any
39
purpose. It is provided "AS-IS without warranty of any kind,either express
40
or implied. User hereby grants a royalty-free license to any and all
41
derivatives based upon this software code base.
42
43
44
SNMP++ S M I V A L . H
45
46
SMIVALUE CLASS DEFINITION
47
48
DESIGN + AUTHOR: Jeff Meyer
49
50
DESCRIPTION:
51
SMIValue class definition. Superclass for the various types
52
of SNMP values (Address, Oid, Octet, etc.). Provides
53
only a few functions, most info is in subclass.
54
55
=====================================================================*/
56
// $Id: smival.h 2359 2013-05-09 20:07:01Z fock $
57
58
#ifndef _SMIVALUE
59
#define _SMIVALUE
60
61
//----[ includes ]-----------------------------------------------------
62
#include "
snmp_pp/smi.h
"
63
64
#ifdef SNMP_PP_NAMESPACE
65
namespace
Snmp_pp {
66
#endif
67
68
69
//----[ macros ]-------------------------------------------------------
70
#if defined(USE_CPP_CASTS)
71
#define PP_CONST_CAST(___type, ___ptr) const_cast< ___type >(___ptr)
72
#else
73
#define PP_CONST_CAST(___type, ___ptr) ((___type)(___ptr))
74
#endif
75
76
//======================================================================
77
// SMI value structure conforming with SMI RFC
78
//
79
typedef
struct
SmiVALUE
80
{
/* smiVALUE portion of VarBind */
81
SmiVALUE
()
82
: syntax(
sNMP_SYNTAX_NULL
)
83
{ memset( &value, 0,
sizeof
(value) ); }
84
85
SmiUINT32
syntax
;
/* Insert SNMP_SYNTAX_<type> */
86
union
{
87
SmiINT
sNumber
;
/* SNMP_SYNTAX_INT
88
SNMP_SYNTAX_INT32 */
89
SmiUINT32
uNumber
;
/* SNMP_SYNTAX_UINT32
90
SNMP_SYNTAX_CNTR32
91
SNMP_SYNTAX_GAUGE32
92
SNMP_SYNTAX_TIMETICKS */
93
SmiCNTR64
hNumber
;
/* SNMP_SYNTAX_CNTR64 */
94
SmiOCTETS
string
;
/* SNMP_SYNTAX_OCTETS
95
SNMP_SYNTAX_BITS
96
SNMP_SYNTAX_OPAQUE
97
SNMP_SYNTAX_IPADDR
98
SNMP_SYNTAX_NSAPADDR */
99
SmiOID
oid
;
/* SNMP_SYNTAX_OID */
100
SmiBYTE
empty
;
/* SNMP_SYNTAX_NULL
101
SNMP_SYNTAX_NOSUCHOBJECT
102
SNMP_SYNTAX_NOSUCHINSTANCE
103
SNMP_SYNTAX_ENDOFMIBVIEW */
104
} value;
105
} *
SmiLPVALUE
;
106
//=================================================================
107
108
//--------------------------------------------------------------------
109
//----[ SnmpSyntax class ]--------------------------------------------
110
//--------------------------------------------------------------------
111
112
/**
113
* An "abstract" (pure virtual) class that serves as the base class
114
* for all specific SNMP syntax types.
115
*/
116
class
DLLOPT
SnmpSyntax
{
117
118
public
:
119
120
/**
121
* Virtual function for getting a printable ASCII value for any SNMP
122
* value.
123
*
124
* @note The returned string is valid as long as the object is not
125
* modified.
126
* @note This function is NOT thread safe.
127
*/
128
virtual
const
char
*get_printable()
const
= 0;
129
130
/**
131
* Return the current syntax.
132
*/
133
virtual
SmiUINT32
get_syntax()
const
= 0;
134
135
/**
136
* Virtual clone operation for creating a new Value from an existing
137
* value.
138
*
139
* @note The caller MUST use the delete operation on the return
140
* value when done.
141
*/
142
virtual
SnmpSyntax
* clone()
const
= 0;
143
144
/**
145
* Virtual destructor to ensure deletion of derived classes...
146
*/
147
virtual
~SnmpSyntax
() {}
148
149
/**
150
* Overloaded assignment operator.
151
*
152
* @note This should be pure virtual, but buggy VC++ compiler
153
* complains about unresolved reference at link time.
154
* XXX probably happens because it's not implemented in
155
* all derived classes?
156
*/
157
virtual
SnmpSyntax
& operator = (
const
SnmpSyntax
&
/*val*/
) = 0;
158
159
/**
160
* Return validity of the object.
161
*/
162
virtual
bool
valid()
const
= 0;
163
164
/**
165
* Return the space needed for serialization.
166
*/
167
virtual
int
get_asn1_length()
const
= 0;
168
169
/**
170
* Reset the object.
171
*/
172
virtual
void
clear() = 0;
173
174
protected
:
175
SnmpSyntax
()
176
: smival()
177
{}
178
179
SmiVALUE
smival
;
180
};
181
182
#ifdef SNMP_PP_NAMESPACE
183
}
// end of namespace Snmp_pp
184
#endif
185
186
#endif // _SMIVALUE
SnmpSyntax::SnmpSyntax
SnmpSyntax()
Definition:
smival.h:175
SmiUINT32
unsigned long SmiUINT32
Definition:
smi.h:157
SnmpSyntax::smival
SmiVALUE smival
Definition:
smival.h:179
sNMP_SYNTAX_NULL
#define sNMP_SYNTAX_NULL
Definition:
smi.h:103
SmiVALUE::uNumber
SmiUINT32 uNumber
Definition:
smival.h:89
SmiVALUE::oid
SmiOID oid
Definition:
smival.h:99
SnmpSyntax::~SnmpSyntax
virtual ~SnmpSyntax()
Virtual destructor to ensure deletion of derived classes...
Definition:
smival.h:147
SmiVALUE::hNumber
SmiCNTR64 hNumber
Definition:
smival.h:93
SmiVALUE::SmiVALUE
SmiVALUE()
Definition:
smival.h:81
SmiVALUE
Definition:
smival.h:79
SmiOCTETS
Definition:
smi.h:160
SmiVALUE::empty
SmiBYTE empty
Definition:
smival.h:100
DLLOPT
#define DLLOPT
Definition:
config_snmp_pp.h:49
SmiINT
long SmiINT
Definition:
smi.h:151
smi.h
SmiVALUE::syntax
SmiUINT32 syntax
Definition:
smival.h:85
SmiVALUE::string
SmiOCTETS string
Definition:
smival.h:94
SmiLPVALUE
struct SmiVALUE * SmiLPVALUE
SmiBYTE
unsigned char SmiBYTE
Definition:
smi.h:148
SmiCNTR64
Definition:
smi.h:191
SmiVALUE::sNumber
SmiINT sNumber
Definition:
smival.h:87
SnmpSyntax
An "abstract" (pure virtual) class that serves as the base class for all specific SNMP syntax types...
Definition:
smival.h:116
SmiOID
Definition:
smi.h:168
include
snmp_pp
smival.h
Generated on Wed Feb 11 2015 20:48:56 for SNMP++ by
1.8.6