Bitcoin Core  28.1.0
P2P Digital Currency
Functions | Variables
mapport.cpp File Reference
#include <config/bitcoin-config.h>
#include <mapport.h>
#include <clientversion.h>
#include <common/system.h>
#include <logging.h>
#include <net.h>
#include <netaddress.h>
#include <netbase.h>
#include <util/thread.h>
#include <util/threadinterrupt.h>
#include <compat/compat.h>
#include <natpmp.h>
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
#include <miniupnpc/upnperrors.h>
#include <atomic>
#include <cassert>
#include <chrono>
#include <functional>
#include <string>
#include <thread>
Include dependency graph for mapport.cpp:

Go to the source code of this file.

Functions

static bool NatpmpInit (natpmp_t *natpmp)
 
static bool NatpmpDiscover (natpmp_t *natpmp, struct in_addr &external_ipv4_addr)
 
static bool NatpmpMapping (natpmp_t *natpmp, const struct in_addr &external_ipv4_addr, uint16_t private_port, bool &external_ip_discovered)
 
static bool ProcessNatpmp ()
 
static bool ProcessUpnp ()
 
static void ThreadMapPort ()
 
void StartThreadMapPort ()
 
static void DispatchMapPort ()
 
static void MapPortProtoSetEnabled (MapPortProtoFlag proto, bool enabled)
 
void StartMapPort (bool use_upnp, bool use_natpmp)
 
void InterruptMapPort ()
 
void StopMapPort ()
 

Variables

static CThreadInterrupt g_mapport_interrupt
 
static std::thread g_mapport_thread
 
static std::atomic_uint g_mapport_enabled_protos {MapPortProtoFlag::NONE}
 
static std::atomic< MapPortProtoFlagg_mapport_current_proto {MapPortProtoFlag::NONE}
 
static constexpr auto PORT_MAPPING_REANNOUNCE_PERIOD {20min}
 
static constexpr auto PORT_MAPPING_RETRY_PERIOD {5min}
 
static uint16_t g_mapport_external_port = 0
 

Function Documentation

◆ DispatchMapPort()

static void DispatchMapPort ( )
static

Definition at line 260 of file mapport.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InterruptMapPort()

void InterruptMapPort ( )

Definition at line 305 of file mapport.cpp.

Here is the caller graph for this function:

◆ MapPortProtoSetEnabled()

static void MapPortProtoSetEnabled ( MapPortProtoFlag  proto,
bool  enabled 
)
static

Definition at line 289 of file mapport.cpp.

Here is the caller graph for this function:

◆ NatpmpDiscover()

static bool NatpmpDiscover ( natpmp_t *  natpmp,
struct in_addr &  external_ipv4_addr 
)
static

Definition at line 59 of file mapport.cpp.

Here is the caller graph for this function:

◆ NatpmpInit()

static bool NatpmpInit ( natpmp_t *  natpmp)
static

Definition at line 51 of file mapport.cpp.

Here is the caller graph for this function:

◆ NatpmpMapping()

static bool NatpmpMapping ( natpmp_t *  natpmp,
const struct in_addr &  external_ipv4_addr,
uint16_t  private_port,
bool &  external_ip_discovered 
)
static

Definition at line 84 of file mapport.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessNatpmp()

static bool ProcessNatpmp ( )
static

Definition at line 121 of file mapport.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessUpnp()

static bool ProcessUpnp ( )
static

Definition at line 149 of file mapport.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StartMapPort()

void StartMapPort ( bool  use_upnp,
bool  use_natpmp 
)

Definition at line 298 of file mapport.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StartThreadMapPort()

void StartThreadMapPort ( )

Definition at line 252 of file mapport.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StopMapPort()

void StopMapPort ( )

Definition at line 313 of file mapport.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ThreadMapPort()

static void ThreadMapPort ( )
static

Definition at line 220 of file mapport.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_mapport_current_proto

std::atomic<MapPortProtoFlag> g_mapport_current_proto {MapPortProtoFlag::NONE}
static

Definition at line 43 of file mapport.cpp.

◆ g_mapport_enabled_protos

std::atomic_uint g_mapport_enabled_protos {MapPortProtoFlag::NONE}
static

Definition at line 42 of file mapport.cpp.

◆ g_mapport_external_port

uint16_t g_mapport_external_port = 0
static

Definition at line 50 of file mapport.cpp.

◆ g_mapport_interrupt

CThreadInterrupt g_mapport_interrupt
static

Definition at line 29 of file mapport.cpp.

◆ g_mapport_thread

std::thread g_mapport_thread
static

Definition at line 41 of file mapport.cpp.

◆ PORT_MAPPING_REANNOUNCE_PERIOD

constexpr auto PORT_MAPPING_REANNOUNCE_PERIOD {20min}
static

Definition at line 46 of file mapport.cpp.

◆ PORT_MAPPING_RETRY_PERIOD

constexpr auto PORT_MAPPING_RETRY_PERIOD {5min}
static

Definition at line 47 of file mapport.cpp.