summaryrefslogtreecommitdiff
path: root/src/tools/tor-fw-helper/tor-fw-helper-upnp.h
diff options
context:
space:
mode:
authorJacob Appelbaum <jacob@appelbaum.net>2010-04-16 17:45:12 -0700
committerNick Mathewson <nickm@torproject.org>2010-09-30 11:37:53 -0400
commit9cc76cf0053cad90d2ff55d24993d9a0ac4c0cdb (patch)
tree46bcd8f511653b52b5b7fe1348485e42b43b9fab /src/tools/tor-fw-helper/tor-fw-helper-upnp.h
parent3ad43ef75f09a21c0c1fc6eb173f8d131c7d638c (diff)
downloadtor-9cc76cf0053cad90d2ff55d24993d9a0ac4c0cdb.tar.gz
tor-9cc76cf0053cad90d2ff55d24993d9a0ac4c0cdb.zip
First implementation of tor-fw-helper.
tor-fw-helper is a command-line tool to wrap and abstract various firewall port-forwarding tools. This commit matches the state of Jacob's tor-fw-helper branch as of 23 September 2010. (commit msg by Nick)
Diffstat (limited to 'src/tools/tor-fw-helper/tor-fw-helper-upnp.h')
-rw-r--r--src/tools/tor-fw-helper/tor-fw-helper-upnp.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/tools/tor-fw-helper/tor-fw-helper-upnp.h b/src/tools/tor-fw-helper/tor-fw-helper-upnp.h
new file mode 100644
index 0000000000..aac7452319
--- /dev/null
+++ b/src/tools/tor-fw-helper/tor-fw-helper-upnp.h
@@ -0,0 +1,32 @@
+/* Copyright (c) 2010, Jacob Appelbaum, Steven J. Murdoch.
+ * Copyright (c) 2010, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef _TOR_FW_HELPER_UPNP_H
+#define _TOR_FW_HELPER_UPNP_H
+
+#include <miniupnpc/miniwget.h>
+#include <miniupnpc/miniupnpc.h>
+#include <miniupnpc/upnpcommands.h>
+#include <miniupnpc/upnperrors.h>
+
+#define UPNP_LANADDR_SZ 64
+
+typedef struct miniupnpc_state_t {
+ struct UPNPUrls urls;
+ struct IGDdatas data;
+ char lanaddr[UPNP_LANADDR_SZ];
+ int init;
+} miniupnpc_state_t;
+
+int tor_upnp_init(miniupnpc_state_t *state);
+
+int tor_upnp_cleanup(miniupnpc_state_t *state);
+
+int tor_upnp_fetch_public_ip(miniupnpc_state_t *state);
+
+int tor_upnp_add_tcp_mapping(miniupnpc_state_t *state,
+ uint16_t internal_port, uint16_t external_port);
+
+#endif
+