Bitcoin Core  0.18.99
P2P Digital Currency
Classes | Typedefs | Enumerations | Functions | Variables
net.h File Reference
#include <addrdb.h>
#include <addrman.h>
#include <amount.h>
#include <bloom.h>
#include <compat.h>
#include <crypto/siphash.h>
#include <hash.h>
#include <limitedmap.h>
#include <netaddress.h>
#include <policy/feerate.h>
#include <protocol.h>
#include <random.h>
#include <streams.h>
#include <sync.h>
#include <uint256.h>
#include <threadinterrupt.h>
#include <atomic>
#include <deque>
#include <stdint.h>
#include <thread>
#include <memory>
#include <condition_variable>
#include <arpa/inet.h>
Include dependency graph for net.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AddedNodeInfo
 
struct  CSerializedNetMsg
 
class  CConnman
 
struct  CConnman::Options
 
struct  CConnman::ListenSocket
 
struct  CombinerAll
 
class  NetEventsInterface
 Interface for message handling. More...
 
struct  LocalServiceInfo
 
class  CNodeStats
 
class  CNetMessage
 
class  CNode
 Information about a peer. More...
 

Typedefs

typedef int64_t NodeId
 
typedef std::map< std::string, uint64_t > mapMsgCmdSize
 

Enumerations

enum  {
  LOCAL_NONE, LOCAL_IF, LOCAL_BIND, LOCAL_UPNP,
  LOCAL_MANUAL, LOCAL_MAX
}
 

Functions

void Discover ()
 
void StartMapPort ()
 
void InterruptMapPort ()
 
void StopMapPort ()
 
unsigned short GetListenPort ()
 
bool BindListenPort (const CService &bindAddr, std::string &strError, bool fWhitelisted=false)
 
bool IsPeerAddrLocalGood (CNode *pnode)
 
void AdvertiseLocal (CNode *pnode)
 
void SetReachable (enum Network net, bool reachable)
 Mark a network as reachable or unreachable (no automatic connects to it) More...
 
bool IsReachable (enum Network net)
 
bool IsReachable (const CNetAddr &addr)
 
bool AddLocal (const CService &addr, int nScore=LOCAL_NONE)
 
bool AddLocal (const CNetAddr &addr, int nScore=LOCAL_NONE)
 
void RemoveLocal (const CService &addr)
 
bool SeenLocal (const CService &addr)
 vote for a local address More...
 
bool IsLocal (const CService &addr)
 check whether a given address is potentially local More...
 
bool GetLocal (CService &addr, const CNetAddr *paddrPeer=nullptr)
 
CAddress GetLocalAddress (const CNetAddr *paddrPeer, ServiceFlags nLocalServices)
 
std::map< CNetAddr, LocalServiceInfo > mapLocalHost GUARDED_BY (cs_mapLocalHost)
 
int64_t PoissonNextSend (int64_t now, int average_interval_seconds)
 Return a timestamp in the future (in microseconds) for exponentially distributed events. More...
 

Variables

std::unique_ptr< CConnmang_connman
 
std::unique_ptr< BanMang_banman
 
bool fDiscover
 
bool fListen
 
bool g_relay_txes
 
std::string strSubVersion
 Subversion as sent to the P2P network in version messages. More...
 
CCriticalSection cs_mapLocalHost
 
const std::string NET_MESSAGE_COMMAND_OTHER
 

Typedef Documentation

◆ mapMsgCmdSize

typedef std::map<std::string, uint64_t> mapMsgCmdSize

Definition at line 536 of file net.h.

◆ NodeId

typedef int64_t NodeId

Definition at line 85 of file net.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LOCAL_NONE 
LOCAL_IF 
LOCAL_BIND 
LOCAL_UPNP 
LOCAL_MANUAL 
LOCAL_MAX 

Definition at line 487 of file net.h.

Function Documentation

◆ AddLocal() [1/2]

bool AddLocal ( const CService addr,
int  nScore = LOCAL_NONE 
)

Definition at line 204 of file net.cpp.

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

◆ AddLocal() [2/2]

bool AddLocal ( const CNetAddr addr,
int  nScore = LOCAL_NONE 
)

Definition at line 230 of file net.cpp.

Here is the call graph for this function:

◆ AdvertiseLocal()

void AdvertiseLocal ( CNode pnode)

Definition at line 177 of file net.cpp.

Here is the call graph for this function:

◆ BindListenPort()

bool BindListenPort ( const CService bindAddr,
std::string &  strError,
bool  fWhitelisted = false 
)
Here is the caller graph for this function:

◆ Discover()

void Discover ( )

Definition at line 2068 of file net.cpp.

Here is the call graph for this function:

◆ GetListenPort()

unsigned short GetListenPort ( )

Definition at line 94 of file net.cpp.

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

◆ GetLocal()

bool GetLocal ( CService addr,
const CNetAddr paddrPeer = nullptr 
)

Definition at line 100 of file net.cpp.

Here is the caller graph for this function:

◆ GetLocalAddress()

CAddress GetLocalAddress ( const CNetAddr paddrPeer,
ServiceFlags  nLocalServices 
)

Definition at line 149 of file net.cpp.

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

◆ GUARDED_BY()

std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY ( cs_mapLocalHost  )
Here is the caller graph for this function:

◆ InterruptMapPort()

void InterruptMapPort ( )

Definition at line 1507 of file net.cpp.

Here is the caller graph for this function:

◆ IsLocal()

bool IsLocal ( const CService addr)

check whether a given address is potentially local

Definition at line 275 of file net.cpp.

Here is the caller graph for this function:

◆ IsPeerAddrLocalGood()

bool IsPeerAddrLocalGood ( CNode pnode)

Definition at line 169 of file net.cpp.

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

◆ IsReachable() [1/2]

bool IsReachable ( enum Network  net)
Returns
true if the network is reachable, false otherwise

Definition at line 250 of file net.cpp.

Here is the caller graph for this function:

◆ IsReachable() [2/2]

bool IsReachable ( const CNetAddr addr)
Returns
true if the address is in a reachable network, false otherwise

Definition at line 256 of file net.cpp.

Here is the call graph for this function:

◆ PoissonNextSend()

int64_t PoissonNextSend ( int64_t  now,
int  average_interval_seconds 
)

Return a timestamp in the future (in microseconds) for exponentially distributed events.

Definition at line 2716 of file net.cpp.

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

◆ RemoveLocal()

void RemoveLocal ( const CService addr)

Definition at line 235 of file net.cpp.

Here is the caller graph for this function:

◆ SeenLocal()

bool SeenLocal ( const CService addr)

vote for a local address

Definition at line 262 of file net.cpp.

◆ SetReachable()

void SetReachable ( enum Network  net,
bool  reachable 
)

Mark a network as reachable or unreachable (no automatic connects to it)

Note
Networks are reachable by default

Definition at line 242 of file net.cpp.

◆ StartMapPort()

void StartMapPort ( )

Definition at line 1503 of file net.cpp.

◆ StopMapPort()

void StopMapPort ( )

Definition at line 1511 of file net.cpp.

Variable Documentation

◆ cs_mapLocalHost

CCriticalSection cs_mapLocalHost

Definition at line 83 of file net.cpp.

◆ fDiscover

bool fDiscover

Definition at line 80 of file net.cpp.

◆ fListen

bool fListen

Definition at line 81 of file net.cpp.

◆ g_banman

std::unique_ptr<BanMan> g_banman

Definition at line 86 of file init.cpp.

◆ g_connman

std::unique_ptr<CConnman> g_connman

Definition at line 84 of file init.cpp.

◆ g_relay_txes

bool g_relay_txes

Definition at line 82 of file net.cpp.

◆ NET_MESSAGE_COMMAND_OTHER

const std::string NET_MESSAGE_COMMAND_OTHER

Definition at line 73 of file net.cpp.

◆ strSubVersion

std::string strSubVersion

Subversion as sent to the P2P network in version messages.

Definition at line 86 of file net.cpp.