4 //=============================================================================
8 * SMIValue class definition. Superclass for the various types
9 * of SNMP values (Address, Oid, Octet, etc.). Provides
10 * only a few functions, most info is in subclass.
12 //=============================================================================
14 /*===================================================================
16 Hewlett-Packard Company
18 ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
19 Permission to use, copy, modify, distribute and/or sell this software
20 and/or its documentation is hereby granted without fee. User agrees
21 to display the above copyright notice and this license notice in all
22 copies of the software and any documentation of the software. User
23 agrees to assume all liability for the use of the software; Hewlett-Packard
24 makes no representations about the suitability of this software for any
25 purpose. It is provided "AS-IS without warranty of any kind,either express
26 or implied. User hereby grants a royalty-free license to any and all
27 derivatives based upon this software code base.
28 =====================================================================*/
30 //----[ includes ]-----------------------------------------------------
31 #include "asnmp/smi.h"
32 #include "asnmp/ASNMP_Export.h"
33 #include "ace/os_include/os_stddef.h"
35 //----[ macros ]-------------------------------------------------------
37 //======================================================================
38 // SMI value structure conforming with SMI RFC
40 typedef struct { /* smiVALUE portion of VarBind */
41 SmiUINT32 syntax
; /* Insert SNMP_SYNTAX_<type> */
43 SmiINT sNumber
; /* SNMP_SYNTAX_INT
45 SmiUINT32 uNumber
; /* SNMP_SYNTAX_UINT32
48 SNMP_SYNTAX_TIMETICKS */
49 SmiCNTR64 hNumber
; /* SNMP_SYNTAX_CNTR64 */
50 SmiOCTETS string
; /* SNMP_SYNTAX_OCTETS
54 SNMP_SYNTAX_NSAPADDR */
55 SmiOID oid
; /* SNMP_SYNTAX_OID */
56 SmiBYTE empty
; /* SNMP_SYNTAX_NULL
57 SNMP_SYNTAX_NOSUCHOBJECT
58 SNMP_SYNTAX_NOSUCHINSTANCE
59 SNMP_SYNTAX_ENDOFMIBVIEW */
61 } SmiVALUE
, *SmiLPVALUE
;
63 // An "abstract" (pure virtual) class that serves as the base class
64 // for all specific SNMP syntax types.
66 class ASNMP_Export SnmpSyntax
{
68 /// virtual function for getting a printable ASCII value for any SNMP Value
69 virtual const char * to_string() = 0;
71 /// return the current syntax
72 virtual SmiUINT32
get_syntax() = 0;
74 /// virtual clone operation for creating a new Value from an existing
75 /// value. The caller MUST use the delete operation on the return
77 virtual SnmpSyntax
* clone() const = 0;
79 /// virtual destructor to ensure deletion of derived classes...
80 virtual ~SnmpSyntax() {};
82 /// overloaded assignment operator
83 /// This should be pure virtual, but WinNT compiler
84 /// complains about unresolved reference at link time.
85 virtual SnmpSyntax
& operator=(SnmpSyntax
&/*val*/)
90 /// return validity of value object.
91 virtual int valid() const = 0;