1 /*_############################################################################
6 _## -----------------------------------------------
7 _## Copyright (c) 2001-2010 Jochen Katz, Frank Fock
9 _## This software is based on SNMP++2.6 from Hewlett Packard:
11 _## Copyright (c) 1996
12 _## Hewlett-Packard Company
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.
26 _## Stuttgart, Germany, Thu Sep 2 00:07:47 CEST 2010
28 _##########################################################################*/
29 /*===================================================================
32 Hewlett-Packard Company
34 ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
35 Permission to use, copy, modify, distribute and/or sell this software
36 and/or its documentation is hereby granted without fee. User agrees
37 to display the above copyright notice and this license notice in all
38 copies of the software and any documentation of the software. User
39 agrees to assume all liability for the use of the software; Hewlett-Packard
40 makes no representations about the suitability of this software for any
41 purpose. It is provided "AS-IS without warranty of any kind,either express
42 or implied. User hereby grants a royalty-free license to any and all
43 derivatives based upon this software code base.
46 SNMP++ S M I V A L . H
48 SMIVALUE CLASS DEFINITION
50 DESIGN + AUTHOR: Jeff Meyer
53 SMIValue class definition. Superclass for the various types
54 of SNMP values (Address, Oid, Octet, etc.). Provides
55 only a few functions, most info is in subclass.
57 =====================================================================*/
58 // $Id: smival.h 1541 2009-05-29 11:29:22Z katz $
63 //----[ includes ]-----------------------------------------------------
64 #include "snmp_pp/smi.h"
66 #ifdef SNMP_PP_NAMESPACE
71 //----[ macros ]-------------------------------------------------------
72 #if defined(USE_CPP_CASTS)
73 #define PP_CONST_CAST(___type, ___ptr) const_cast< ___type >(___ptr)
75 #define PP_CONST_CAST(___type, ___ptr) ((___type)(___ptr))
78 //======================================================================
79 // SMI value structure conforming with SMI RFC
81 typedef struct { /* smiVALUE portion of VarBind */
82 SmiUINT32 syntax; /* Insert SNMP_SYNTAX_<type> */
84 SmiINT sNumber; /* SNMP_SYNTAX_INT
86 SmiUINT32 uNumber; /* SNMP_SYNTAX_UINT32
89 SNMP_SYNTAX_TIMETICKS */
90 SmiCNTR64 hNumber; /* SNMP_SYNTAX_CNTR64 */
91 SmiOCTETS string; /* SNMP_SYNTAX_OCTETS
95 SNMP_SYNTAX_NSAPADDR */
96 SmiOID oid; /* SNMP_SYNTAX_OID */
97 SmiBYTE empty; /* SNMP_SYNTAX_NULL
98 SNMP_SYNTAX_NOSUCHOBJECT
99 SNMP_SYNTAX_NOSUCHINSTANCE
100 SNMP_SYNTAX_ENDOFMIBVIEW */
102 } SmiVALUE, *SmiLPVALUE;
103 //=================================================================
105 //--------------------------------------------------------------------
106 //----[ SnmpSyntax class ]--------------------------------------------
107 //--------------------------------------------------------------------
110 * An "abstract" (pure virtual) class that serves as the base class
111 * for all specific SNMP syntax types.
113 class DLLOPT SnmpSyntax {
118 * Virtual function for getting a printable ASCII value for any SNMP
121 * @note The returned string is valid as long as the object is not
123 * @note This function is NOT thread safe.
125 virtual const char *get_printable() const = 0;
128 * Return the current syntax.
130 virtual SmiUINT32 get_syntax() const = 0;
133 * Virtual clone operation for creating a new Value from an existing
136 * @note The caller MUST use the delete operation on the return
139 virtual SnmpSyntax * clone() const = 0;
142 * Virtual destructor to ensure deletion of derived classes...
144 virtual ~SnmpSyntax() {};
147 * Overloaded assignment operator.
149 * @note This should be pure virtual, but buggy VC++ compiler
150 * complains about unresolved reference at link time.
152 virtual SnmpSyntax& operator=(const SnmpSyntax &/*val*/) { return *this; };
155 * Return validity of the object.
157 virtual bool valid() const = 0;
160 * Return the space needed for serialization.
162 virtual int get_asn1_length() const = 0;
167 virtual void clear() = 0;
174 #ifdef SNMP_PP_NAMESPACE
175 } // end of namespace Snmp_pp