snmp_vars.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Definitions for SNMP (RFC 1067) agent variable finder.
  3. *
  4. */
  5. #ifndef _SNMP_VARS_H_
  6. #define _SNMP_VARS_H_
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /* Portions of this file are subject to the following copyright(s). See
  11. * the Net-SNMP's COPYING file for more details and other copyrights
  12. * that may apply:
  13. */
  14. /***********************************************************
  15. Copyright 1988, 1989 by Carnegie Mellon University
  16. Copyright 1989 TGV, Incorporated
  17. All Rights Reserved
  18. Permission to use, copy, modify, and distribute this software and its
  19. documentation for any purpose and without fee is hereby granted,
  20. provided that the above copyright notice appear in all copies and that
  21. both that copyright notice and this permission notice appear in
  22. supporting documentation, and that the name of CMU and TGV not be used
  23. in advertising or publicity pertaining to distribution of the software
  24. without specific, written prior permission.
  25. CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  26. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  27. EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  28. CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  29. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  30. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  31. PERFORMANCE OF THIS SOFTWARE.
  32. ******************************************************************/
  33. /*
  34. * Portions of this file are copyrighted by:
  35. * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
  36. * Use is subject to license terms specified in the COPYING file
  37. * distributed with the Net-SNMP package.
  38. */
  39. struct variable;
  40. /**
  41. * Duplicates a variable.
  42. *
  43. * @return Pointer to the duplicate variable upon success; NULL upon
  44. * failure.
  45. *
  46. * @see struct variable
  47. * @see struct variable1
  48. * @see struct variable2
  49. * @see struct variable3
  50. * @see struct variable4
  51. * @see struct variable7
  52. * @see struct variable8
  53. * @see struct variable13
  54. */
  55. struct variable *netsnmp_duplicate_variable(const struct variable *var);
  56. /*
  57. * Function pointer called by the master agent for writes.
  58. */
  59. typedef int (WriteMethod) (int action,
  60. u_char * var_val,
  61. u_char var_val_type,
  62. size_t var_val_len,
  63. u_char * statP,
  64. oid * name, size_t length);
  65. /*
  66. * Function pointer called by the master agent for mib information retrieval
  67. */
  68. typedef u_char *(FindVarMethod) (struct variable * vp,
  69. oid * name,
  70. size_t * length,
  71. int exact,
  72. size_t * var_len,
  73. WriteMethod ** write_method);
  74. /*
  75. * Function pointer called by the master agent for setting up subagent requests
  76. */
  77. typedef int (AddVarMethod) (netsnmp_agent_session *asp,
  78. netsnmp_variable_list * vbp);
  79. struct nlist;
  80. extern long long_return;
  81. extern u_char return_buf[];
  82. extern oid nullOid[];
  83. extern int nullOidLen;
  84. #define INST 0xFFFFFFFF /* used to fill out the instance field of the variables table */
  85. struct variable {
  86. u_char magic; /* passed to function as a hint */
  87. char type; /* type of variable */
  88. /*
  89. * See important comment in snmp_vars.c relating to acl
  90. */
  91. u_short acl; /* access control list for variable */
  92. FindVarMethod *findVar; /* function that finds variable */
  93. u_char namelen; /* length of above */
  94. oid name[MAX_OID_LEN]; /* object identifier of variable */
  95. };
  96. int init_agent(const char *);
  97. void shutdown_agent(void);
  98. int should_init(const char *module_name);
  99. void add_to_init_list(char *module_list);
  100. #ifdef USING_AGENTX_SUBAGENT_MODULE
  101. void netsnmp_enable_subagent(void);
  102. #endif
  103. #ifndef _AGENT_REGISTRY_H
  104. #include <net-snmp/agent/agent_handler.h>
  105. #include <net-snmp/agent/var_struct.h>
  106. #include <net-snmp/agent/agent_registry.h>
  107. #endif
  108. /*
  109. * fail overloads non-negative integer value. it must be -1 !
  110. */
  111. #define MATCH_FAILED (-1)
  112. #define MATCH_SUCCEEDED 0
  113. #ifdef __cplusplus
  114. }
  115. #endif
  116. #endif /* _SNMP_VARS_H_ */