Annotation of mstools/h/snmp.h, revision 1.1

1.1     ! root        1: /*++ BUILD Version: 0001    // Increment this if a change has global effects
        !             2: 
        !             3: Copyright (c) 1992, Microsoft Corporation
        !             4: 
        !             5: Module Name:
        !             6: 
        !             7:     snmp.h
        !             8: 
        !             9: Abstract:
        !            10: 
        !            11:     Type definitions for SNMP Extension Agent Development.
        !            12: 
        !            13: 
        !            14:     This PRE-RELEASE header file contains definitions that may change
        !            15:     prior to the official release of Windows NT.   Microsoft makes no
        !            16:     warranty of any kind as to the suitability or correctness of this
        !            17:     code.
        !            18: 
        !            19: 
        !            20: --*/
        !            21: 
        !            22: #ifndef snmp_h
        !            23: #define snmp_h
        !            24: 
        !            25: static char *snmp__h = "@(#) $Logfile:   N:/agent/common/vcs/snmp.h_v  $ $Revision:   1.7  $";
        !            26: 
        !            27: 
        !            28: 
        !            29: #include <windows.h>
        !            30: 
        !            31: 
        !            32: 
        !            33: //
        !            34: // SNMP API Constant Definitions
        !            35: //
        !            36: 
        !            37: // Purely for code readability
        !            38: #define IN
        !            39: #define OUT
        !            40: 
        !            41: 
        !            42: // API return type
        !            43: 
        !            44: #define SNMPAPI          int
        !            45: 
        !            46: #if (_MSC_VER >= 800)
        !            47: #define SNMP_FUNC_TYPE   __stdcall
        !            48: #else
        !            49: #define SNMP_FUNC_TYPE
        !            50: #endif
        !            51: 
        !            52: 
        !            53: // API return codes
        !            54: #define SNMPAPI_NOERROR TRUE
        !            55: #define SNMPAPI_ERROR   FALSE
        !            56: 
        !            57: 
        !            58: // class field of BER tag
        !            59: #define ASN_UNIVERSAL         0x00
        !            60: #define ASN_APPLICATION       0x40
        !            61: #define ASN_CONTEXTSPECIFIC   0x80
        !            62: #define ASN_PRIVATE           0xC0
        !            63: 
        !            64: // primative/constructed field of BER tag
        !            65: #define ASN_PRIMATIVE         0x00
        !            66: #define ASN_CONSTRUCTOR       0x20
        !            67: 
        !            68: 
        !            69: // ASN.1 simple types
        !            70: #define ASN_INTEGER           (ASN_UNIVERSAL | ASN_PRIMATIVE | 0x02)
        !            71: #define ASN_OCTETSTRING       (ASN_UNIVERSAL | ASN_PRIMATIVE | 0x04)
        !            72: #define ASN_NULL              (ASN_UNIVERSAL | ASN_PRIMATIVE | 0x05)
        !            73: #define ASN_OBJECTIDENTIFIER  (ASN_UNIVERSAL | ASN_PRIMATIVE | 0x06)
        !            74: 
        !            75: // ASN.1 constructor types
        !            76: #define ASN_SEQUENCE          (ASN_UNIVERSAL | ASN_CONSTRUCTOR | 0x10)
        !            77: #define ASN_SEQUENCEOF        ASN_SEQUENCE
        !            78: 
        !            79: // ASN.1 application specific primatives
        !            80: #define ASN_RFC1155_IPADDRESS  (ASN_APPLICATION | ASN_PRIMATIVE | 0x00)
        !            81: #define ASN_RFC1155_COUNTER    (ASN_APPLICATION | ASN_PRIMATIVE | 0x01)
        !            82: #define ASN_RFC1155_GAUGE      (ASN_APPLICATION | ASN_PRIMATIVE | 0x02)
        !            83: #define ASN_RFC1155_TIMETICKS  (ASN_APPLICATION | ASN_PRIMATIVE | 0x03)
        !            84: #define ASN_RFC1155_OPAQUE     (ASN_APPLICATION | ASN_PRIMATIVE | 0x04)
        !            85: #define ASN_RFC1213_DISPSTRING ASN_OCTETSTRING
        !            86: 
        !            87: // ASN.1 application specific constructors
        !            88: #define ASN_RFC1157_GETREQUEST     \
        !            89:             (ASN_CONTEXTSPECIFIC | ASN_CONSTRUCTOR | 0x00)
        !            90: #define ASN_RFC1157_GETNEXTREQUEST \
        !            91:             (ASN_CONTEXTSPECIFIC | ASN_CONSTRUCTOR | 0x01)
        !            92: #define ASN_RFC1157_GETRESPONSE    \
        !            93:             (ASN_CONTEXTSPECIFIC | ASN_CONSTRUCTOR | 0x02)
        !            94: #define ASN_RFC1157_SETREQUEST     \
        !            95:             (ASN_CONTEXTSPECIFIC | ASN_CONSTRUCTOR | 0x03)
        !            96: #define ASN_RFC1157_TRAP           \
        !            97:             (ASN_CONTEXTSPECIFIC | ASN_CONSTRUCTOR | 0x04)
        !            98: 
        !            99: 
        !           100: // PDU error status
        !           101: #define SNMP_ERRORSTATUS_NOERROR        0
        !           102: #define SNMP_ERRORSTATUS_TOOBIG         1
        !           103: #define SNMP_ERRORSTATUS_NOSUCHNAME     2
        !           104: #define SNMP_ERRORSTATUS_BADVALUE       3
        !           105: #define SNMP_ERRORSTATUS_READONLY       4
        !           106: #define SNMP_ERRORSTATUS_GENERR         5
        !           107: 
        !           108: 
        !           109: // PDU generic traps
        !           110: #define SNMP_GENERICTRAP_COLDSTART      0
        !           111: #define SNMP_GENERICTRAP_WARMSTART      1
        !           112: #define SNMP_GENERICTRAP_LINKDOWN       2
        !           113: #define SNMP_GENERICTRAP_LINKUP         3
        !           114: #define SNMP_GENERICTRAP_AUTHFAILURE    4
        !           115: #define SNMP_GENERICTRAP_EGPNEIGHLOSS   5
        !           116: #define SNMP_GENERICTRAP_ENTERSPECIFIC  6
        !           117: 
        !           118: 
        !           119: 
        !           120: //
        !           121: // SNMP Error codes
        !           122: //
        !           123: 
        !           124: // General error codes
        !           125: #define SNMP_MEM_ALLOC_ERROR          1
        !           126: 
        !           127: // BER API error codes (using Get/Set LastError)
        !           128: #define SNMP_BERAPI_INVALID_LENGTH    10
        !           129: #define SNMP_BERAPI_INVALID_TAG       11
        !           130: #define SNMP_BERAPI_OVERFLOW          12
        !           131: #define SNMP_BERAPI_SHORT_BUFFER      13
        !           132: #define SNMP_BERAPI_INVALID_OBJELEM   14
        !           133: 
        !           134: // PDU API Error Codes
        !           135: #define SNMP_PDUAPI_UNRECOGNIZED_PDU  20
        !           136: #define SNMP_PDUAPI_INVALID_ES        21
        !           137: #define SNMP_PDUAPI_INVALID_GT        22
        !           138: 
        !           139: // AUTHENTICATION API Error Codes
        !           140: #define SNMP_AUTHAPI_INVALID_VERSION  30
        !           141: #define SNMP_AUTHAPI_INVALID_MSG_TYPE 31
        !           142: #define SNMP_AUTHAPI_TRIV_AUTH_FAILED 32
        !           143: 
        !           144: 
        !           145: 
        !           146: //
        !           147: // SNMP API Type Definitions
        !           148: //
        !           149: 
        !           150: typedef long           AsnInteger;
        !           151: typedef struct {
        !           152:     BYTE *stream;
        !           153:     UINT  length;
        !           154:     BOOL dynamic;
        !           155: }                      AsnOctetString;
        !           156: typedef struct {
        !           157:     UINT idLength;
        !           158:     UINT *ids;
        !           159: }                      AsnObjectIdentifier;
        !           160: 
        !           161: typedef AsnOctetString AsnSequence;
        !           162: typedef AsnSequence    AsnImplicitSequence;
        !           163: 
        !           164: typedef AsnOctetString AsnIPAddress;
        !           165: typedef AsnOctetString AsnDisplayString;
        !           166: typedef DWORD          AsnCounter;
        !           167: typedef DWORD          AsnGauge;
        !           168: typedef DWORD          AsnTimeticks;
        !           169: typedef AsnOctetString AsnOpaque;
        !           170: 
        !           171: typedef struct {
        !           172:     BYTE asnType;
        !           173:     union {
        !           174:         // RFC 1155 SimpleSyntax (subset of ISO ASN.1)
        !           175:         AsnInteger           number;
        !           176:         AsnOctetString       string;
        !           177:         AsnObjectIdentifier  object;
        !           178: 
        !           179:         // ISO ASN.1
        !           180:         AsnSequence          sequence;
        !           181: 
        !           182:         // RFC 1155 ApplicationSyntax
        !           183:         AsnIPAddress         address;
        !           184:         AsnCounter           counter;
        !           185:         AsnGauge             gauge;
        !           186:         AsnTimeticks         ticks;
        !           187:         AsnOpaque            arbitrary;
        !           188:     } asnValue;
        !           189: } AsnAny;
        !           190: 
        !           191: typedef AsnObjectIdentifier AsnObjectName;
        !           192: typedef AsnAny              AsnObjectSyntax;
        !           193: typedef AsnIPAddress        AsnNetworkAddress;
        !           194: 
        !           195: typedef struct vb {
        !           196:     AsnObjectName   name;
        !           197:     AsnObjectSyntax value;
        !           198: } RFC1157VarBind;
        !           199: 
        !           200: typedef struct {
        !           201:     RFC1157VarBind *list;
        !           202:     UINT           len;
        !           203: } RFC1157VarBindList;
        !           204: 
        !           205: typedef struct {
        !           206:     RFC1157VarBindList varBinds;
        !           207:     AsnInteger         requestType;
        !           208:     AsnInteger         requestId;
        !           209:     AsnInteger         errorStatus;
        !           210:     AsnInteger         errorIndex;
        !           211: } RFC1157Pdu;
        !           212: 
        !           213: typedef struct {
        !           214:     RFC1157VarBindList  varBinds;
        !           215:     AsnObjectIdentifier enterprise;
        !           216:     AsnNetworkAddress   agentAddr;
        !           217:     AsnInteger          genericTrap;
        !           218:     AsnInteger          specificTrap;
        !           219:     AsnTimeticks        timeStamp;
        !           220: } RFC1157TrapPdu;
        !           221: 
        !           222: typedef struct {
        !           223:    BYTE pduType;
        !           224:    union {
        !           225:       RFC1157Pdu     pdu;
        !           226:       RFC1157TrapPdu trap;
        !           227:    } pduValue;
        !           228: } RFC1157Pdus;
        !           229: 
        !           230: typedef struct {
        !           231:     AsnObjectIdentifier dstParty;
        !           232:     AsnObjectIdentifier srcParty;
        !           233:     RFC1157Pdus pdu;
        !           234:     AsnOctetString community; // This is temporary
        !           235: } SnmpMgmtCom;
        !           236: 
        !           237: 
        !           238: 
        !           239: //
        !           240: // SNMP Utility Prototypes
        !           241: //
        !           242: 
        !           243: 
        !           244: // Preferred names for the APIs, prototypes following may change in future.
        !           245: 
        !           246: #define SnmpUtilOidCpy(a,b)      SNMP_oidcpy(a,b)
        !           247: #define SnmpUtilOidAppend(a,b)   SNMP_oidappend(a,b)
        !           248: #define SnmpUtilOidNCmp(a,b,c)   SNMP_oidncmp(a,b,c)
        !           249: #define SnmpUtilOidCmp(a,b)      SNMP_oidcmp(a,b)
        !           250: #define SnmpUtilOidFree(a)       SNMP_oidfree(a)
        !           251: 
        !           252: #define SnmpUtilVarBindListCpy(a,b)  SNMP_CopyVarBindList(a,b)
        !           253: #define SnmpUtilVarBindCpy(a,b)      SNMP_CopyVarBind(a,b)
        !           254: #define SnmpUtilVarBindListFree(a)   SNMP_FreeVarBindList(a)
        !           255: #define SnmpUtilVarBindFree(a)       SNMP_FreeVarBind(a)
        !           256: 
        !           257: #define SnmpUtilPrintAsnAny(a)   SNMP_printany(a)
        !           258: 
        !           259: #ifdef SNMPDBG
        !           260: #define SNMP_free(x)   SNMP_DBG_free(x, __LINE__, __FILE__)
        !           261: #define SNMP_malloc(x) SNMP_DBG_malloc(x, __LINE__, __FILE__)
        !           262: #define SNMP_realloc(x, y)  SNMP_DBG_realloc(x, y, __LINE__, __FILE__)
        !           263: #else
        !           264: #define SNMP_free(x)   free(x)
        !           265: #define SNMP_malloc(x) malloc(x)
        !           266: #define SNMP_realloc(x, y)  realloc(x, y)
        !           267: #endif
        !           268: 
        !           269: void
        !           270: SNMP_FUNC_TYPE SNMP_DBG_free(
        !           271:     IN void *x,
        !           272:     IN int line,
        !           273:     IN char *file
        !           274:     );
        !           275: 
        !           276: void *
        !           277: SNMP_FUNC_TYPE SNMP_DBG_malloc(
        !           278:     IN unsigned int x,
        !           279:     IN int line,
        !           280:     IN char *file
        !           281:     );
        !           282: 
        !           283: void *
        !           284: SNMP_FUNC_TYPE SNMP_DBG_realloc(
        !           285:     IN void *x,
        !           286:     IN unsigned int y,
        !           287:     IN int line,
        !           288:     IN char *file
        !           289:     );
        !           290: 
        !           291: SNMPAPI
        !           292: SNMP_FUNC_TYPE SNMP_oidcpy(
        !           293:     OUT AsnObjectIdentifier *DestObjId, // Destination OID
        !           294:     IN AsnObjectIdentifier *SrcObjId    // Source OID
        !           295:     );
        !           296: 
        !           297: SNMPAPI
        !           298: SNMP_FUNC_TYPE SNMP_oidappend(
        !           299:     IN OUT AsnObjectIdentifier *DestObjId, // Destination OID
        !           300:     IN AsnObjectIdentifier *SrcObjId       // Source OID
        !           301:     );
        !           302: 
        !           303: SNMPAPI
        !           304: SNMP_FUNC_TYPE SNMP_oidncmp(
        !           305:     IN AsnObjectIdentifier *A, // First OID
        !           306:     IN AsnObjectIdentifier *B, // Second OID
        !           307:     IN UINT Len                // Max len to compare
        !           308:     );
        !           309: 
        !           310: #define SNMP_oidcmp(A,B) SNMP_oidncmp(A,B,max((A)->idLength,(B)->idLength))
        !           311: 
        !           312: void
        !           313: SNMP_FUNC_TYPE SNMP_oidfree(
        !           314:     IN OUT AsnObjectIdentifier *Obj // OID to free
        !           315:     );
        !           316: 
        !           317: SNMPAPI
        !           318: SNMP_FUNC_TYPE SNMP_CopyVarBindList(
        !           319:     RFC1157VarBindList *dst, // Destination var bind list
        !           320:     RFC1157VarBindList *src  // Source var bind list
        !           321:     );
        !           322: 
        !           323: SNMPAPI
        !           324: SNMP_FUNC_TYPE SNMP_CopyVarBind(
        !           325:     RFC1157VarBind *dst, // Destination var bind
        !           326:     RFC1157VarBind *src  // Source var bind
        !           327:     );
        !           328: 
        !           329: 
        !           330: void
        !           331: SNMP_FUNC_TYPE SNMP_FreeVarBindList(
        !           332:     RFC1157VarBindList *VarBindList // Variable bindings list to free
        !           333:     );
        !           334: 
        !           335: void
        !           336: SNMP_FUNC_TYPE SNMP_FreeVarBind(
        !           337:     RFC1157VarBind *VarBind // Variable binding to free
        !           338:     );
        !           339: 
        !           340: 
        !           341: void
        !           342: SNMP_FUNC_TYPE SNMP_printany(
        !           343:     IN AsnAny *Any
        !           344:     );
        !           345: 
        !           346: 
        !           347: #endif /* snmp_h */
        !           348: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.