snmp_impl.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #ifndef SNMP_IMPL_H
  2. #define SNMP_IMPL_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /*
  7. * * file: snmp_impl.h
  8. */
  9. /*
  10. * Definitions for SNMP implementation.
  11. *
  12. *
  13. */
  14. /***********************************************************
  15. Copyright 1988, 1989 by Carnegie Mellon University
  16. All Rights Reserved
  17. Permission to use, copy, modify, and distribute this software and its
  18. documentation for any purpose and without fee is hereby granted,
  19. provided that the above copyright notice appear in all copies and that
  20. both that copyright notice and this permission notice appear in
  21. supporting documentation, and that the name of CMU not be
  22. used in advertising or publicity pertaining to distribution of the
  23. software without specific, written prior permission.
  24. CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  25. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  26. CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  27. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  28. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  29. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  30. SOFTWARE.
  31. ******************************************************************/
  32. #include<stdio.h>
  33. #include<net-snmp/types.h> /* for 'u_char', etc */
  34. #define COMMUNITY_MAX_LEN 256
  35. /*
  36. * Space for character representation of an object identifier
  37. */
  38. #define SPRINT_MAX_LEN 2560
  39. #ifndef NULL
  40. #define NULL 0
  41. #endif
  42. #ifndef TRUE
  43. #define TRUE 1
  44. #endif
  45. #ifndef FALSE
  46. #define FALSE 0
  47. #endif
  48. #define READ 1
  49. #define WRITE 0
  50. #define RESERVE1 0
  51. #define RESERVE2 1
  52. #define ACTION 2
  53. #define COMMIT 3
  54. #define FREE 4
  55. #define UNDO 5
  56. #define FINISHED_SUCCESS 9
  57. #define FINISHED_FAILURE 10
  58. /*
  59. * Access control statements for the agent
  60. */
  61. #define NETSNMP_OLDAPI_RONLY 0x1 /* read access only */
  62. #define NETSNMP_OLDAPI_RWRITE 0x2 /* read and write access (must have 0x2 bit set) */
  63. #define NETSNMP_OLDAPI_NOACCESS 0x0000 /* no access for anybody */
  64. #ifndef NETSNMP_NO_LEGACY_DEFINITIONS
  65. #define RONLY NETSNMP_OLDAPI_RONLY
  66. #define RWRITE NETSNMP_OLDAPI_RWRITE
  67. #define NOACCESS NETSNMP_OLDAPI_NOACCESS
  68. #endif
  69. /*
  70. * defined types (from the SMI, RFC 1157)
  71. */
  72. #define ASN_IPADDRESS (ASN_APPLICATION | 0)
  73. #define ASN_COUNTER (ASN_APPLICATION | 1)
  74. #define ASN_GAUGE (ASN_APPLICATION | 2)
  75. #define ASN_UNSIGNED (ASN_APPLICATION | 2) /* RFC 1902 - same as GAUGE */
  76. #define ASN_TIMETICKS (ASN_APPLICATION | 3)
  77. #define ASN_OPAQUE (ASN_APPLICATION | 4) /* changed so no conflict with other includes */
  78. /*
  79. * defined types (from the SMI, RFC 1442)
  80. */
  81. #define ASN_NSAP (ASN_APPLICATION | 5) /* historic - don't use */
  82. #define ASN_COUNTER64 (ASN_APPLICATION | 6)
  83. #define ASN_UINTEGER (ASN_APPLICATION | 7) /* historic - don't use */
  84. #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  85. /*
  86. * defined types from draft-perkins-opaque-01.txt
  87. */
  88. #define ASN_FLOAT (ASN_APPLICATION | 8)
  89. #define ASN_DOUBLE (ASN_APPLICATION | 9)
  90. #define ASN_INTEGER64 (ASN_APPLICATION | 10)
  91. #define ASN_UNSIGNED64 (ASN_APPLICATION | 11)
  92. #endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
  93. /*
  94. * changed to ERROR_MSG to eliminate conflict with other includes
  95. */
  96. #ifndef ERROR_MSG
  97. #define ERROR_MSG(string) snmp_set_detail(string)
  98. #endif
  99. /*
  100. * from snmp.c
  101. */
  102. extern u_char sid[]; /* size SID_MAX_LEN */
  103. NETSNMP_IMPORT int snmp_errno;
  104. /*
  105. * For calling secauth_build, FIRST_PASS is an indication that a new nonce
  106. * and lastTimeStamp should be recorded. LAST_PASS is an indication that
  107. * the packet should be checksummed and encrypted if applicable, in
  108. * preparation for transmission.
  109. * 0 means do neither, FIRST_PASS | LAST_PASS means do both.
  110. * For secauth_parse, FIRST_PASS means decrypt the packet, otherwise leave it
  111. * alone. LAST_PASS is ignored.
  112. */
  113. #define FIRST_PASS 1
  114. #define LAST_PASS 2
  115. u_char *snmp_comstr_parse(u_char *, size_t *, u_char *,
  116. size_t *, long *);
  117. u_char *snmp_comstr_build(u_char *, size_t *, u_char *,
  118. size_t *, long *, size_t);
  119. int has_access(u_char, int, int, int);
  120. #ifdef __cplusplus
  121. }
  122. #endif
  123. #endif /* SNMP_IMPL_H */