{
107 #if defined(IN_CLASSA) && defined(IN_CLASSA_NET) && defined(IN_CLASSA_NSHIFT) 108 # if IN_CLASSA_MAX <= IN_LOOPBACKNET 109 # error "IN_LOOPBACKNET is out of range" 175 if(
buf[
len- 1] ==
'\r')
178 if(!(
len= strcspn(
buf,
"!#")))
180 if(!*(c =
buf+ strspn(
buf,
" \t")))
182 len= strcspn(c,
" \t");
184 if(*err && !*(err += strspn(err,
" \t")))
186 if(!*err &&
len&& *c ==
'['&& c[--
len] ==
']') {
188 if(
len>
sizeof(
local.a.octet) - 1)
194(
const char*)
local.a.octet) == 0) {
196(
"%s:%u: Ignoring duplicate domain '%s'",
214(
"%s:%u: Ignoring invalid local IP spec '%s'",
227(
"%s:%u: Local IP spec '%s' overlaps with an" 234(
"%s:%u: Too many local IP specs, max %u allowed",
241 if(status == eIO_Closed &&
n> 2) {
246(
"%s: Done loading local IP specs, %u line%s," 247 " %u entr%s (%u domain%s)",
source,
249(
unsigned int)
n,
n== 1 ?
"y":
"ies",
250domain, &
"s"[domain == 1]));
263(
"Loading local IP specs from \"%s\"",
source));
276 static const char* kFile[] = {
277 "/etc/ncbi/local_ips_v2",
278 "/etc/ncbi/local_ips" 284 buf,
sizeof(
buf) - 1,
"");
287 for(
n= 0;
n<
SizeOf(kFile); ++
n) {
297 if(errno == ENOENT &&
file!=
buf) {
298 # ifdef NCBI_OS_LINUX 306(
"Cannot load local IP specs from \"%s\"",
file));
320 "User-Agent: ncbi_localip",
328 if(net_info &&
n< 2) {
329 # ifdef NCBI_OS_LINUX 374 #ifdef NCBI_LOCALIP_DEBUG 380sprintf(
buf,
"Domain %u: %s",
398memset(&x_info, 0,
sizeof(x_info));
416memset(
info, 0,
sizeof(*
info));
429(
addr& 0xF0000000) ^ 0xF0000000
static CS_CONNECTION * conn
EIO_Status CONN_ReadLine(CONN conn, char *line, size_t size, size_t *n_read)
Read up to "size" bytes from connection into a string buffer pointed to by "line".
CONNECTOR HTTP_CreateConnector(const SConnNetInfo *net_info, const char *user_header, THTTP_Flags flags)
Same as HTTP_CreateConnector(net_info, flags, 0, 0, 0, 0) with the passed "user_header" overriding th...
EIO_Status CONN_Create(CONNECTOR connector, CONN *conn)
Same as CONN_CreateEx() called with 0 in the "flags" parameter.
FDestroy destroy
destroys handle, can be NULL
EIO_Status CONN_Close(CONN conn)
Close the connection and destroy all relevant internal data.
CONNECTOR FILE_CreateConnector(const char *ifname, const char *ofname)
@ fHTTP_NoAutoRetry
No auto-retries allowed.
@ fHTTP_SuppressMessages
Most annoying ones reduced to traces.
unsigned int SOCK_HostToNetLong(unsigned int value)
See man for the BSDisms, htonl() and htons().
#define SOCK_NetToHostLong
ELOG_Level
Log severity level.
int ConnNetInfo_SetupStandardArgs(SConnNetInfo *net_info, const char *service)
#define DEF_CONN_LOCAL_IPS
#define REG_CONN_LOCAL_IPS
SConnNetInfo * ConnNetInfo_Create(const char *service)
#define DEF_CONN_LOCAL_IPS_DISABLE
void ConnNetInfo_Destroy(SConnNetInfo *net_info)
@ eIO_Success
everything is fine, no error occurred
const CharType(& source)[N]
char * strncpy0(char *s1, const char *s2, size_t n)
Copy not more than "n" characters from string "s2" into "s1", and return the result,...
const char * ConnNetInfo_GetValueInternal(const char *service, const char *param, char *value, size_t value_size, const char *def_value)
int NcbiParseIPRange(SIPRange *range, const char *s)
Acceptable forms (netmasked IPv4s may omit trailing .0s before '/'): 4 quad full IP: 123....
int NcbiIsInIPRange(const SIPRange *range, const TNCBI_IPv6Addr *addr)
const char * NcbiDumpIPRange(const SIPRange *range, char *buf, size_t bufsize)
int NcbiIsEmptyIPv6(const TNCBI_IPv6Addr *addr)
Return non-zero if the address is empty (either as NULL or IPv6 or IPv4); return zero otherwise.
TNCBI_IPv6Addr * NcbiIPv4ToIPv6(TNCBI_IPv6Addr *addr, unsigned int ipv4, size_t pfxlen)
Embed a passed network byte order IPv4 address into an IPv6 address using the specified prefix length...
static const SIPRange * x_IsOverlappingRange(const SIPRange *start, const SIPRange *range, size_t n)
int NcbiIsLocalIP(unsigned int ip)
Return non-zero (true) if the IP address (in network byte order) provided as an agrument,...
void NcbiInitLocalIP(void)
Init local IP classification.
static int xx_LoadLocalIPs(CONN conn, const char *source)
static SIPRange s_LocalIP[256+1]
int NcbiIsLocalIPEx(const TNCBI_IPv6Addr *addr, SNcbiDomainInfo *info)
Return non-zero (true) if the IP address (in network byte order) provided as an agrument,...
static const struct @1001 kLocalIP[]
static int x_LoadLocalIPs(CONNECTOR c, const char *source)
static void s_LoadLocalIPs(void)
#define CORE_LOGF_X(subcode, level, fmt_args)
#define CORE_LOGF_ERRNO_X(subcode, level, error, fmt_args)
#define CORE_LOGF(level, fmt_args)
#define CORE_LOG_X(subcode, level, message)
#define CORE_LOG(level, message)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4