2022-01-20 18:27:56 +00:00
|
|
|
// This file Copyright © 2007-2022 Mnemosyne LLC.
|
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0), GPLv3 (SPDX: GPL-3.0),
|
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2006-09-25 18:37:45 +00:00
|
|
|
|
2017-11-14 20:21:28 +00:00
|
|
|
#pragma once
|
|
|
|
|
2008-11-24 20:17:36 +00:00
|
|
|
#ifndef __TRANSMISSION__
|
2017-04-19 12:04:45 +00:00
|
|
|
#error only libtransmission should #include this header.
|
2008-11-24 20:17:36 +00:00
|
|
|
#endif
|
|
|
|
|
2009-08-12 14:40:32 +00:00
|
|
|
/**
|
2009-05-29 19:17:12 +00:00
|
|
|
* @addtogroup port_forwarding Port Forwarding
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2022-01-22 00:07:24 +00:00
|
|
|
#include "natpmp.h"
|
|
|
|
|
|
|
|
enum tr_natpmp_state
|
|
|
|
{
|
|
|
|
TR_NATPMP_IDLE,
|
|
|
|
TR_NATPMP_ERR,
|
|
|
|
TR_NATPMP_DISCOVER,
|
|
|
|
TR_NATPMP_RECV_PUB,
|
|
|
|
TR_NATPMP_SEND_MAP,
|
|
|
|
TR_NATPMP_RECV_MAP,
|
|
|
|
TR_NATPMP_SEND_UNMAP,
|
|
|
|
TR_NATPMP_RECV_UNMAP
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tr_natpmp
|
|
|
|
{
|
|
|
|
bool has_discovered;
|
|
|
|
bool is_mapped;
|
|
|
|
|
|
|
|
tr_port public_port;
|
|
|
|
tr_port private_port;
|
|
|
|
|
|
|
|
time_t renew_time;
|
|
|
|
time_t command_time;
|
|
|
|
tr_natpmp_state state;
|
|
|
|
natpmp_t natpmp;
|
|
|
|
};
|
2006-09-25 18:37:45 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
tr_natpmp* tr_natpmpInit(void);
|
2008-09-23 19:11:04 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void tr_natpmpClose(tr_natpmp*);
|
2008-09-23 19:11:04 +00:00
|
|
|
|
2022-01-22 00:07:24 +00:00
|
|
|
tr_port_forwarding tr_natpmpPulse(tr_natpmp*, tr_port port, bool isEnabled, tr_port* public_port, tr_port* real_private_port);
|
2007-12-01 05:11:30 +00:00
|
|
|
|
2009-05-29 19:17:12 +00:00
|
|
|
/* @} */
|