Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ASNMP / asnmp / smival.h
blob8e1dabf0680f4522bda0fd6b7911b137de555994
1 /* -*-C++-*- */
2 #ifndef SMIVALUE_
3 #define SMIVALUE_
4 //=============================================================================
5 /**
6 * @file smival.h
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 /*===================================================================
15 Copyright (c) 1996
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> */
42 union {
43 SmiINT sNumber; /* SNMP_SYNTAX_INT
44 SNMP_SYNTAX_INT32 */
45 SmiUINT32 uNumber; /* SNMP_SYNTAX_UINT32
46 SNMP_SYNTAX_CNTR32
47 SNMP_SYNTAX_GAUGE32
48 SNMP_SYNTAX_TIMETICKS */
49 SmiCNTR64 hNumber; /* SNMP_SYNTAX_CNTR64 */
50 SmiOCTETS string; /* SNMP_SYNTAX_OCTETS
51 SNMP_SYNTAX_BITS
52 SNMP_SYNTAX_OPAQUE
53 SNMP_SYNTAX_IPADDR
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 */
60 } value;
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 {
67 public:
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
76 /// value when done.
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*/)
87 return *this;
90 /// return validity of value object.
91 virtual int valid() const = 0;
93 protected:
94 SmiVALUE smival;
97 #endif // SMIVALUE_