2010-04-16 17:45:12 -07:00
|
|
|
/* Copyright (c) 2010, Jacob Appelbaum, Steven J. Murdoch.
|
|
|
|
* Copyright (c) 2010, The Tor Project, Inc. */
|
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
2010-09-24 12:52:07 -07:00
|
|
|
/**
|
|
|
|
* \file tor-fw-helper-natpmp.h
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifdef NAT_PMP
|
2010-04-16 17:45:12 -07:00
|
|
|
#ifndef _TOR_FW_HELPER_NATPMP_H
|
|
|
|
#define _TOR_FW_HELPER_NATPMP_H
|
|
|
|
|
|
|
|
#include <natpmp.h>
|
|
|
|
|
2010-09-24 12:52:07 -07:00
|
|
|
/** This is the default NAT-PMP lease time in seconds. */
|
2010-04-16 17:45:12 -07:00
|
|
|
#define NATPMP_DEFAULT_LEASE 3600
|
2010-09-24 12:52:07 -07:00
|
|
|
/** NAT-PMP has many codes for success; this is one of them. */
|
2010-04-16 17:45:12 -07:00
|
|
|
#define NATPMP_SUCCESS 0
|
|
|
|
|
2010-09-24 12:52:07 -07:00
|
|
|
/** 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 {
|
2010-09-30 15:21:37 -04:00
|
|
|
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;
|
2010-09-24 12:52:07 -07:00
|
|
|
} 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);
|
2010-04-16 17:45:12 -07:00
|
|
|
|
2010-09-24 12:52:07 -07:00
|
|
|
int tor_natpmp_cleanup(tor_fw_options_t *tor_fw_options, void *backend_state);
|
2010-04-16 17:45:12 -07:00
|
|
|
|
2010-09-24 12:52:07 -07:00
|
|
|
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
|
2010-04-16 17:45:12 -07:00
|
|
|
#endif
|
|
|
|
|