NCBI C++ ToolKit
Functions
ncbi_iprange.c File Reference
#include "ncbi_ansi_ext.h"
#include "ncbi_assert.h"
#include <connect/ncbi_iprange.h>
#include <connect/ncbi_socket.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+ Include dependency graph for ncbi_iprange.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Functions

int NcbiIsInIPRange (const SIPRange *range, const TNCBI_IPv6Addr *addr)
 
SIPRange NcbiTrueIPRange (const SIPRange *range)
 
static size_t x_size (const char *dst, size_t len, const char *ptr)
 
const char * NcbiDumpIPRange (const SIPRange *range, char *buf, size_t bufsize)
 
int NcbiParseIPRange (SIPRange *range, const char *str)
 Acceptable forms (netmasked IPv4s may omit trailing .0s before '/'): 4 quad full IP: 123.123.123.123 IPv4 range: 123.123.1-123 (meaning 123.123.1.0 thru 123.123.123.255) IPv4 w/netmask: 123.123/255.255.240.0 (equivalent to the following line) IPv4 CIDR: 123.123/20 (meaning 123.123.0.0 thru 123.123.15.255) IPv4 wildcard: 123.123. More...
 

Function Documentation

◆ NcbiDumpIPRange()

const char* NcbiDumpIPRange ( const SIPRange range,
char *  buf,
size_t  bufsize 
)

◆ NcbiIsInIPRange()

int NcbiIsInIPRange ( const SIPRange range,
const TNCBI_IPv6Addr addr 
)

◆ NcbiParseIPRange()

int NcbiParseIPRange ( SIPRange range,
const char *  s 
)

Acceptable forms (netmasked IPv4s may omit trailing .0s before '/'): 4 quad full IP: 123.123.123.123 IPv4 range: 123.123.1-123 (meaning 123.123.1.0 thru 123.123.123.255) IPv4 w/netmask: 123.123/255.255.240.0 (equivalent to the following line) IPv4 CIDR: 123.123/20 (meaning 123.123.0.0 thru 123.123.15.255) IPv4 wildcard: 123.123.

* (meaning 123.123.0.0 thru 123.123.255.255) IPv6[/CIDR]: aa:bb::cc/64 (IPv6 addr must be complete,/CIDR optional) hostname: DNS format

Note
IP subnets (both IPv4 and IPv6) require that the unmasked "host" portion of the address was 0 (otherwise, parsing fails).
Returns
0 (false) if failed; non-zero (true) if successful and the parsed range stored at the location pointed to by "range".

Definition at line 216 of file ncbi_iprange.c.

References assert, eIPRange_Host, eIPRange_Network, eIPRange_Range, int, isspace(), len, n, NcbiDNSIPToAddr(), NcbiIPToAddr(), NcbiIPv4ToIPv6(), NcbiIPv6ToIPv4(), NcbiIsEmptyIPv6(), NcbiIsIPv4(), NcbiStringToIPv4(), out(), compile_time_bits::range(), SOCK_gethostbyname(), SOCK_HostToNetLong(), SOCK_isip(), SOCK_isipEx(), SOCK_NetToHostLong, str(), and t.

Referenced by xx_LoadLocalIPs().

◆ NcbiTrueIPRange()

SIPRange NcbiTrueIPRange ( const SIPRange range)

◆ x_size()

static size_t x_size ( const char *  dst,
size_t  len,
const char *  ptr 
)
static
Modified on Sun Mar 03 03:15:42 2024 by modify_doxy.py rev. 669887