snmpUDPDomain.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef _SNMPUDPDOMAIN_H
  2. #define _SNMPUDPDOMAIN_H
  3. /*
  4. * Portions of this file are copyrighted by:
  5. * Copyright (c) 2016 VMware, Inc. All rights reserved.
  6. * Use is subject to license terms specified in the COPYING file
  7. * distributed with the Net-SNMP package.
  8. */
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #include <net-snmp/library/snmp_transport.h>
  13. #include <net-snmp/library/asn1.h>
  14. #ifdef HAVE_SYS_SOCKET_H
  15. #include <sys/socket.h>
  16. #endif
  17. #ifdef HAVE_NETINET_IN_H
  18. #include <netinet/in.h>
  19. #endif
  20. config_require(UDPIPv4Base);
  21. #include <net-snmp/library/snmpUDPIPv4BaseDomain.h>
  22. netsnmp_transport *
  23. netsnmp_udp_transport(const struct netsnmp_ep *ep, int local);
  24. netsnmp_transport *netsnmp_udp_create_tspec(netsnmp_tdomain_spec *tspec);
  25. netsnmp_transport *
  26. netsnmp_udp_transport_with_source(const struct netsnmp_ep *ep, int local,
  27. const struct netsnmp_ep *src_addr);
  28. #define C2SE_ERR_SUCCESS 0
  29. #define C2SE_ERR_MISSING_ARG -1
  30. #define C2SE_ERR_COMMUNITY_TOO_LONG -2
  31. #define C2SE_ERR_SECNAME_TOO_LONG -3
  32. #define C2SE_ERR_CONTEXT_TOO_LONG -4
  33. #define C2SE_ERR_MASK_MISMATCH -5
  34. #define C2SE_ERR_MEMORY -6
  35. typedef struct com2SecEntry_s com2SecEntry;
  36. int netsnmp_udp_com2SecEntry_create(com2SecEntry **entryp,
  37. const char *community,
  38. const char *secName,
  39. const char *contextName,
  40. struct in_addr *network,
  41. struct in_addr *mask,
  42. int negate);
  43. void netsnmp_udp_com2Sec_free(com2SecEntry *e);
  44. int netsnmp_udp_com2SecList_remove(com2SecEntry *e);
  45. /*
  46. * Register any configuration tokens specific to the agent.
  47. */
  48. NETSNMP_IMPORT
  49. void netsnmp_udp_agent_config_tokens_register(void);
  50. NETSNMP_IMPORT
  51. void netsnmp_udp_parse_security(const char *token, char *param);
  52. NETSNMP_IMPORT
  53. int netsnmp_udp_getSecName(void *opaque, int olength,
  54. const char *community,
  55. size_t community_len,
  56. const char **secname,
  57. const char **contextName);
  58. /*
  59. * "Constructor" for transport domain object.
  60. */
  61. void netsnmp_udp_ctor(void);
  62. /*
  63. * protected-ish functions used by other core-code
  64. */
  65. char *netsnmp_udp_fmtaddr(netsnmp_transport *t, const void *data, int len);
  66. #if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR)
  67. int netsnmp_udp_recvfrom(int s, void *buf, int len, struct sockaddr *from,
  68. socklen_t *fromlen, struct sockaddr *dstip,
  69. socklen_t *dstlen, int *if_index);
  70. int netsnmp_udp_sendto(int fd, const struct in_addr *srcip, int if_index,
  71. const struct sockaddr *remote, const void *data,
  72. int len);
  73. #endif
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif/*_SNMPUDPDOMAIN_H*/