summaryrefslogtreecommitdiff
path: root/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h
diff options
context:
space:
mode:
authorJacob Appelbaum <jacob@appelbaum.net>2010-09-24 12:52:07 -0700
committerNick Mathewson <nickm@torproject.org>2010-09-30 11:39:34 -0400
commit3eaa9a376c756b0b8f836c4a78c3cf4012d6ffd7 (patch)
treeebc4d8429ebe5354490f45cbd5cf3199bb1bd7c4 /src/tools/tor-fw-helper/tor-fw-helper-natpmp.h
parent9cc76cf0053cad90d2ff55d24993d9a0ac4c0cdb (diff)
downloadtor-3eaa9a376c756b0b8f836c4a78c3cf4012d6ffd7.tar.gz
tor-3eaa9a376c756b0b8f836c4a78c3cf4012d6ffd7.zip
Changes to tor-fw-helper, some based on Nick's review
* MINIUPNPC rather than the generic UPNP * Nick suggested a better abstraction model for tor-fw-helper * Fix autoconf to build with either natpmp or miniupnpc * Add AM_PROG_CC_C_O to fix automake complaint * update spec to address nickm's concern * refactor nat-pmp to match upnp state * we prefer tor_snprintf to snprintf * link properlty for tor_snprintf * rename test_commandline_options to log_commandline_options * cast this uint as an int * detect possible FD_SETSIZE errors * make note about future enhancements for natpmp * add upnp enhancement note * ChangeLog entry * doxygen and check-spaces cleanup * create tor-fw-helper.1.txt
Diffstat (limited to 'src/tools/tor-fw-helper/tor-fw-helper-natpmp.h')
-rw-r--r--src/tools/tor-fw-helper/tor-fw-helper-natpmp.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h
index 8fc1765f9f..38448dffa3 100644
--- a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h
+++ b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h
@@ -2,17 +2,46 @@
* Copyright (c) 2010, The Tor Project, Inc. */
/* See LICENSE for licensing information */
+/**
+ * \file tor-fw-helper-natpmp.h
+ **/
+
+#ifdef NAT_PMP
#ifndef _TOR_FW_HELPER_NATPMP_H
#define _TOR_FW_HELPER_NATPMP_H
#include <natpmp.h>
+/** This is the default NAT-PMP lease time in seconds. */
#define NATPMP_DEFAULT_LEASE 3600
+/** NAT-PMP has many codes for success; this is one of them. */
#define NATPMP_SUCCESS 0
-int tor_natpmp_add_tcp_mapping(tor_fw_options_t *tor_fw_options);
+/** This is our NAT-PMP meta structure - it holds our request data, responses,
+ * various NAT-PMP parameters, and of course the status of the motion in the
+ * NAT-PMP ocean. */
+typedef struct natpmp_state_t {
+ natpmp_t natpmp;
+ natpmpresp_t response;
+ int fetch_public_ip;
+ int status;
+ int init; /**< Have we been initialized? */
+ int protocol; /**< This will only be TCP. */
+ int lease;
+} natpmp_state_t;
+
+const tor_fw_backend_t *tor_fw_get_natpmp_backend(void);
+
+int tor_natpmp_init(tor_fw_options_t *tor_fw_options, void *backend_state);
-int tor_natpmp_fetch_public_ip(tor_fw_options_t *tor_fw_options);
+int tor_natpmp_cleanup(tor_fw_options_t *tor_fw_options, void *backend_state);
+int tor_natpmp_add_tcp_mapping(tor_fw_options_t *tor_fw_options,
+ void *backend_state);
+
+int tor_natpmp_fetch_public_ip(tor_fw_options_t *tor_fw_options,
+ void *backend_state);
+
+#endif
#endif