NCBI C++ ToolKit
Classes | Functions
ncbi_localip.h File Reference
#include <connect/ncbi_ipv6.h>
+ Include dependency graph for ncbi_localip.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  SNcbiDomainInfo
 

Functions

int NcbiIsLocalIP (unsigned int ip)
 Return non-zero (true) if the IP address (in network byte order) provided as an agrument, is a local one (i.e. More...
 
int NcbiIsLocalIPEx (const TNCBI_IPv6Addr *addr, SNcbiDomainInfo *info)
 Return non-zero (true) if the IP address (in network byte order) provided as an agrument, is a local one (i.e. More...
 
void NcbiInitLocalIP (void)
 Init local IP classification. More...
 

Function Documentation

◆ NcbiInitLocalIP()

void NcbiInitLocalIP ( void  )

Init local IP classification.

Note
Generally the required initialization is done automagically, so this call need *not* to be used explicitly.
Warning
This call invalidates any domain information returned to client via the NcbiIsLocalIPEx() calls.
See also
NcbiIsLocalIPEx, NcbiIsLocalIP

Definition at line 354 of file ncbi_localip.c.

References s_Inited.

◆ NcbiIsLocalIP()

int NcbiIsLocalIP ( unsigned int  ip)

Return non-zero (true) if the IP address (in network byte order) provided as an agrument, is a local one (i.e.

belongs to NCBI); return zero (false) otherwise.

Warning
Loopback addresses are generally considered "local". If that is a security issue, analyze the address prior to passing it in to this call.
See also
NcbiIsLocalIPEx, SOCK_IsLoopbackAddress

Definition at line 420 of file ncbi_localip.c.

References ip, NcbiIPv4ToIPv6(), NcbiIsLocalIPEx(), and SOCK_NetToHostLong.

◆ NcbiIsLocalIPEx()

int NcbiIsLocalIPEx ( const TNCBI_IPv6Addr addr,
SNcbiDomainInfo info 
)

Return non-zero (true) if the IP address (in network byte order) provided as an agrument, is a local one (i.e.

belongs to NCBI), and update domain info (when passed non-NULL) of the address, if available; return zero (false) otherwise.

Note
Domain information remains valid until a call for NcbiInitLocalIP().
Warning
Loopback addresses are generally considered "local". If that is a security issue, analyze the address prior to passing it in to this call.
See also
NcbiIsLocalIP, NcbiInitLocalIP Optional, can be NULL for no info to get
Parameters
addrEither true IPv6 or IPv6-mapped IPv4

Definition at line 362 of file ncbi_localip.c.

References a, assert, SIPRange::b, b, buf, CORE_LOCK_WRITE, CORE_LOG_X, CORE_UNLOCK, eIPRange_Application, eIPRange_None, eLOG_Trace, info, n, NcbiDumpIPRange(), NcbiIsEmptyIPv6(), NcbiIsInIPRange(), SNcbiDomainInfo::num, result, s_Inited, s_LoadLocalIPs(), s_LocalIP, SNcbiDomainInfo::sfx, and SizeOf.

Referenced by NcbiIsLocalIP().

Modified on Sun May 19 04:47:48 2024 by modify_doxy.py rev. 669887