Determines if the given ASCII string contains an Internet address using dot notation.
#include <sys/types.h> #include <netinet/in.h> u_long isinet_addr (name) char *name;
The isinet_addr subroutine determines if the given ASCII string contains an Internet address using dot notation (for example, "120.121.122.123"). The isaddr_inet subroutine considers Internet address strings as a valid string, and considers any other string type as an invalid strings.
The isinet_addr subrountine expects the ASCII string to conform to the following format:
string ::= field | field delimited_field^1-3 delimited_field ::= delimiter field delimiter ::= . field ::= 0 X | 0 x | 0 X hexadecimal* | 0 x hexadecimal* | decimal* | 0 octal* hexadecimal ::= decimal | a | b | c | d | e | f | A | B | C | D | E | F decimal ::= octal | 8 | 9 octal ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
A^n | Indicates n repetitions of pattern A. |
A^n-m | Indicates n to m repetitions of pattern A. |
A* | Indicates zero or more repetitions of pattern A, up to environmental limits. |
The BNF description explicitly states the space character (' '), if used.
{text} | Indicates text, not a BNF symbol. |
The isinet_addr subrountine allows the application to terminate the string with a null terminator (0x00) or a space (0x30). It ignores characters trailing the space character and considers the string invalid if the application does not terminate the string with a null terminator (0x00) or space (0x30).
The following describes the restrictions on the field values:
Address Format | Field Restrictions (values in decimal base) |
---|---|
a | a < 4294967296. |
a.b | a < 256; b < 16777216. |
a.b.c | a < 256; b < 256; c < 16777216. |
a.b.c.d | a < 256; b < 2^8; c < 256; d < 256. |
The isinet_addr subrountine applications can enter field values exceeding the field value restrictions specified previously; isinet_addr accepts the least significant bits up to an integer in length. The isinet_addr subroutine still checks to see if the truncated value exceeds the maximum field value. For example, if an application gives the string 0.0;0;0xFF00000001 then isinet_addr interprets the string as 0.0.0.0x00000001 and considers the string as valid.
isinet_addr applications cannot omit field values between delimiters and considers a string with successive periods as invalid.
Notes:
- The isinet_addr subroutine does not check the pointer to the ASCII string; the user takes responsibility for ensuring validity of the address of the ASCII string.
- The application assumes responsibility for verifying that the network number and host number for the Internet address conforms to a class A or B or C Internet address; any other string is processed as a class C address.
name | Address of ASCII string buffer. |
The isinet_addr subroutine returns 1 for valid input strings and 0 for invalid input strings. isinet_addr returns the value as an unsigned long type.
This subroutine is part of AIX Base Operating System (BOS) Runtime.
All applications using isinet_addr must compile with _BSD defined. Also, all socket applications must include the BSD library libbsd when applicable.
Internet address conversion subroutines: inet_addr subroutine, inet_lnaof subroutine, inet_makeaddr subroutine, inet_netof subroutine, inet_network subroutine, inet_ntoa subroutine.
Host information retrieval subroutines: endhostent subroutine, gethostbyaddr subroutine, gethostbyname subroutine, sethostent subroutine.
Network information retrieval subroutines: getnetbyaddr subroutine, getnetbyname subroutine, getnetent subroutine, setnetent subroutine.