Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

smi.h

Go to the documentation of this file.
00001 /*_############################################################################
00002   _## 
00003   _##  smi.h  
00004   _##
00005   _##  SNMP++v3.2.15
00006   _##  -----------------------------------------------
00007   _##  Copyright (c) 2001-2004 Jochen Katz, Frank Fock
00008   _##
00009   _##  This software is based on SNMP++2.6 from Hewlett Packard:
00010   _##  
00011   _##    Copyright (c) 1996
00012   _##    Hewlett-Packard Company
00013   _##  
00014   _##  ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
00015   _##  Permission to use, copy, modify, distribute and/or sell this software 
00016   _##  and/or its documentation is hereby granted without fee. User agrees 
00017   _##  to display the above copyright notice and this license notice in all 
00018   _##  copies of the software and any documentation of the software. User 
00019   _##  agrees to assume all liability for the use of the software; 
00020   _##  Hewlett-Packard and Jochen Katz make no representations about the 
00021   _##  suitability of this software for any purpose. It is provided 
00022   _##  "AS-IS" without warranty of any kind, either express or implied. User 
00023   _##  hereby grants a royalty-free license to any and all derivatives based
00024   _##  upon this software code base. 
00025   _##  
00026   _##  Stuttgart, Germany, Tue Jan  4 21:42:42 CET 2005 
00027   _##  
00028   _##########################################################################*/
00029 /*===================================================================
00030 
00031   Copyright (c) 1999
00032   Hewlett-Packard Company
00033 
00034   ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
00035   Permission to use, copy, modify, distribute and/or sell this software
00036   and/or its documentation is hereby granted without fee. User agrees
00037   to display the above copyright notice and this license notice in all
00038   copies of the software and any documentation of the software. User
00039   agrees to assume all liability for the use of the software; Hewlett-Packard
00040   makes no representations about the suitability of this software for any
00041   purpose. It is provided "AS-IS without warranty of any kind,either express
00042   or implied. User hereby grants a royalty-free license to any and all
00043   derivatives based upon this software code base.
00044 
00045 
00046   SNMP++ S M I . H
00047 
00048   SMI DEFINITIONS
00049 
00050   AUTHOR:
00051   Peter E Mellquist
00052 
00053   LANGUAGE:
00054   ANSI C++
00055 
00056   OPERATING SYSTEMS:
00057   MS-Windows Win32
00058   BSD UNIX
00059 
00060   DESCRIPTION:
00061   Address class definition. Encapsulates various network
00062   addresses into easy to use, safe and portable classes.
00063 
00064 =====================================================================*/
00065 // $Id: smi.h,v 1.4 2004/03/03 23:11:21 katz Exp $
00066 
00067 #ifndef _SMIDEF
00068 #define _SMIDEF
00069 
00070 // make sure configuration is included first
00071 #include "snmp_pp/config_snmp_pp.h"
00072 
00073 #ifdef SNMP_PP_NAMESPACE
00074 namespace Snmp_pp {
00075 #endif
00076 
00077 #define WINFAR
00078 #define STRCAT strcat
00079 #define STRLEN strlen
00080 #define MEMCPY memcpy
00081 #define STRCPY strcpy
00082 #define MEMCMP memcmp
00083 #define XPORT
00084 
00085 // HANDLE needs to be defined for each type of platform
00086 // for win32 - HANDLE is a HWND
00087 // for unix  - HANDLE is an unsigned long
00088 // unix and win32 ( Windu compile , unix takes presedence )
00089 #ifdef  WIN32
00090 #ifndef SNMPHANDLE
00091 #define SNMPHANDLE HWND
00092 #endif
00093 #endif
00094 
00095 
00096 #ifdef __unix
00097 #ifndef SNMPHANDLE
00098 #define SNMPHANDLE unsigned long
00099 #define DLLOPT
00100 #endif
00101 #endif
00102 
00103 #ifndef TRUE
00104 #define TRUE 1
00105 #endif
00106 
00107 #ifndef FALSE
00108 #define FALSE 0
00109 #endif
00110 
00111 //----------[ ASN/BER Base Types ]-----------------------------------------
00112 /** @name ASN/BER Base Types
00113  *
00114  * Basic Encoding Rules (BER) (used in forming SYNTAXes and certain
00115  * SNMP types/values).
00116  */
00117 //@{
00118 #define aSN_UNIVERSAL    (0x00)
00119 #define aSN_APPLICATION  (0x40)
00120 #define aSN_CONTEXT      (0x80)
00121 #define aSN_PRIVATE      (0xC0)
00122 #define aSN_PRIMITIVE    (0x00)
00123 #define aSN_CONSTRUCTOR  (0x20)
00124 //@}
00125 
00126 //------[ SNMP ObjectSyntax Values ]---------------------------------------
00127 #define sNMP_SYNTAX_SEQUENCE  (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x10)
00128 
00129 /** @name Syntax Types
00130  *
00131  * These values are used in the "syntax" member of the smiVALUE
00132  * structure which follows.
00133  *
00134  * The get_syntax() method of any class derived from SnmpSyntax returns
00135  * one of these values.
00136  *
00137  * @note UInt32 is indistinguishable from Gauge32 per SNMPv2 Draft Standard
00138  * @note NsapAddr is obsoleted as unique SMI type per SNMPv2 Draft Standard
00139  */
00140 //@{
00141 #define sNMP_SYNTAX_INT         (aSN_UNIVERSAL | aSN_PRIMITIVE | 0x02)
00142 #define sNMP_SYNTAX_BITS        (aSN_UNIVERSAL | aSN_PRIMITIVE | 0x03)
00143 #define sNMP_SYNTAX_OCTETS      (aSN_UNIVERSAL | aSN_PRIMITIVE | 0x04)
00144 #define sNMP_SYNTAX_NULL        (aSN_UNIVERSAL | aSN_PRIMITIVE | 0x05)
00145 #define sNMP_SYNTAX_OID         (aSN_UNIVERSAL | aSN_PRIMITIVE | 0x06)
00146 #define sNMP_SYNTAX_INT32       sNMP_SYNTAX_INT
00147 #define sNMP_SYNTAX_IPADDR      (aSN_APPLICATION | aSN_PRIMITIVE | 0x00)
00148 #define sNMP_SYNTAX_CNTR32      (aSN_APPLICATION | aSN_PRIMITIVE | 0x01)
00149 #define sNMP_SYNTAX_GAUGE32     (aSN_APPLICATION | aSN_PRIMITIVE | 0x02)
00150 #define sNMP_SYNTAX_TIMETICKS   (aSN_APPLICATION | aSN_PRIMITIVE | 0x03)
00151 #define sNMP_SYNTAX_OPAQUE      (aSN_APPLICATION | aSN_PRIMITIVE | 0x04)
00152 #define sNMP_SYNTAX_CNTR64      (aSN_APPLICATION | aSN_PRIMITIVE | 0x06)
00153 #define sNMP_SYNTAX_UINT32      sNMP_SYNTAX_GAUGE32
00154 //@}
00155 
00156 //-------------------------------------------------------------------------
00157 
00158 //---------------[ Exception conditions for SNMPv2 ]-----------------------
00159 /** @name Exception conditions for SNMPv2 */
00160 //@{
00161 #define sNMP_SYNTAX_NOSUCHOBJECT    (aSN_CONTEXT | aSN_PRIMITIVE | 0x00)
00162 #define sNMP_SYNTAX_NOSUCHINSTANCE  (aSN_CONTEXT | aSN_PRIMITIVE | 0x01)
00163 #define sNMP_SYNTAX_ENDOFMIBVIEW    (aSN_CONTEXT | aSN_PRIMITIVE | 0x02)
00164 //@}
00165 
00166 //--------------[ different types of PDU's ]-------------------------------
00167 /** @name Pdu types */
00168 //@{
00169 #define sNMP_PDU_GET        (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x0)
00170 #define sNMP_PDU_GETNEXT    (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x1)
00171 #define sNMP_PDU_RESPONSE   (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x2)
00172 #define sNMP_PDU_SET        (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x3)
00173 #define sNMP_PDU_V1TRAP     (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x4)
00174 #define sNMP_PDU_GETBULK    (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x5)
00175 #define sNMP_PDU_INFORM     (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x6)
00176 #define sNMP_PDU_TRAP       (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x7)
00177 #define sNMP_PDU_REPORT     (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x8)
00178 //@}
00179 
00180 
00181 //------[ smi typedefs ]---------------------------------------------------
00182 /** @name SMI typedefs
00183  *
00184  * SNMP-related types from RFC1442 (SMI).
00185  */
00186 //@{
00187 
00188 // byte
00189 typedef unsigned char    SmiBYTE,       WINFAR *SmiLPBYTE;
00190 
00191 // int
00192 typedef long             SmiINT,        WINFAR *SmiLPINT;
00193 
00194 // int 32
00195 typedef SmiINT           SmiINT32,      WINFAR *SmiLPINT32;
00196 
00197 // unit32
00198 typedef unsigned long    SmiUINT32,     WINFAR *SmiLPUINT32;
00199 
00200 // octet struct
00201 typedef struct {
00202      SmiUINT32 len;
00203      SmiLPBYTE ptr;}     SmiOCTETS,     WINFAR *SmiLPOCTETS;
00204 
00205 // bits
00206 typedef SmiOCTETS        SmiBITS,       WINFAR *SmiLPBITS;
00207 
00208 // SMI oid struct
00209 typedef struct {
00210      SmiUINT32   len;
00211      SmiLPUINT32 ptr;}   SmiOID,        WINFAR *SmiLPOID;
00212 
00213 // ipaddr
00214 typedef SmiOCTETS        SmiIPADDR,     WINFAR *SmiLPIPADDR;
00215 
00216 // 32bit counter
00217 typedef SmiUINT32        SmiCNTR32,     WINFAR *SmiLPCNTR32;
00218 
00219 // gauge
00220 typedef SmiUINT32        SmiGAUGE32,    WINFAR *SmiLPGAUGE32;
00221 
00222 // timeticks
00223 typedef SmiUINT32        SmiTIMETICKS,  WINFAR *SmiLPTIMETICKS;
00224 
00225 // opaque
00226 typedef SmiOCTETS        SmiOPAQUE,     WINFAR *SmiLPOPAQUE;
00227 
00228 // nsapaddr
00229 typedef SmiOCTETS        SmiNSAPADDR,   WINFAR *SmiLPNSAPADDR;
00230 
00231 // 64 bit counter
00232 typedef struct {
00233         SmiUINT32 hipart;
00234         SmiUINT32 lopart;} SmiCNTR64,   WINFAR *SmiLPCNTR64;
00235 //@}
00236 
00237 #ifdef SNMP_PP_NAMESPACE
00238 }; // end of namespace Snmp_pp
00239 #endif 
00240 
00241 #endif
00242 
00243 

Generated on Tue Jan 4 22:42:14 2005 for SNMP++ by doxygen 1.3.2