tor-fw-helper-upnp.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* Copyright (c) 2010, Jacob Appelbaum, Steven J. Murdoch.
  2. * Copyright (c) 2010-2013, The Tor Project, Inc. */
  3. /* See LICENSE for licensing information */
  4. /**
  5. * \file tor-fw-helper-upnp.h
  6. * \brief The main header for our firewall helper.
  7. **/
  8. #ifdef MINIUPNPC
  9. #ifndef TOR_TOR_FW_HELPER_UPNP_H
  10. #define TOR_TOR_FW_HELPER_UPNP_H
  11. #include <miniupnpc/miniwget.h>
  12. #include <miniupnpc/miniupnpc.h>
  13. #include <miniupnpc/upnpcommands.h>
  14. #include <miniupnpc/upnperrors.h>
  15. /** This is a magic number for miniupnpc lan address size. */
  16. #define UPNP_LANADDR_SZ 64
  17. /** This is our miniupnpc meta structure - it holds our request data,
  18. * responses, and various miniupnpc parameters. */
  19. typedef struct miniupnpc_state_t {
  20. struct UPNPUrls urls;
  21. struct IGDdatas data;
  22. char lanaddr[UPNP_LANADDR_SZ];
  23. int init;
  24. } miniupnpc_state_t;
  25. const tor_fw_backend_t *tor_fw_get_miniupnp_backend(void);
  26. int tor_upnp_init(tor_fw_options_t *options, void *backend_state);
  27. int tor_upnp_cleanup(tor_fw_options_t *options, void *backend_state);
  28. int tor_upnp_fetch_public_ip(tor_fw_options_t *options, void *backend_state);
  29. int tor_upnp_add_tcp_mapping(uint16_t internal_port, uint16_t external_port,
  30. int is_verbose, void *backend_state);
  31. #endif
  32. #endif