tor-fw-helper-natpmp.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Copyright (c) 2010, Jacob Appelbaum, Steven J. Murdoch.
  2. * Copyright (c) 2010-2015, The Tor Project, Inc. */
  3. /* See LICENSE for licensing information */
  4. /**
  5. * \file tor-fw-helper-natpmp.h
  6. **/
  7. #ifdef NAT_PMP
  8. #ifndef TOR_TOR_FW_HELPER_NATPMP_H
  9. #define TOR_TOR_FW_HELPER_NATPMP_H
  10. #include <natpmp.h>
  11. /** This is the default NAT-PMP lease time in seconds. */
  12. #define NATPMP_DEFAULT_LEASE 3600
  13. /** NAT-PMP has many codes for success; this is one of them. */
  14. #define NATPMP_SUCCESS 0
  15. /** This is our NAT-PMP meta structure - it holds our request data, responses,
  16. * various NAT-PMP parameters, and of course the status of the motion in the
  17. * NAT-PMP ocean. */
  18. typedef struct natpmp_state_t {
  19. natpmp_t natpmp;
  20. natpmpresp_t response;
  21. int fetch_public_ip;
  22. int status;
  23. int init; /**< Have we been initialized? */
  24. int protocol; /**< This will only be TCP. */
  25. int lease;
  26. } natpmp_state_t;
  27. const tor_fw_backend_t *tor_fw_get_natpmp_backend(void);
  28. int tor_natpmp_init(tor_fw_options_t *tor_fw_options, void *backend_state);
  29. int tor_natpmp_cleanup(tor_fw_options_t *tor_fw_options, void *backend_state);
  30. int tor_natpmp_add_tcp_mapping(uint16_t internal_port, uint16_t external_port,
  31. int is_verbose, void *backend_state);
  32. int tor_natpmp_fetch_public_ip(tor_fw_options_t *tor_fw_options,
  33. void *backend_state);
  34. #endif
  35. #endif