Address conversion routines.
Standard C Library (libc.a)
#include <sys/types.h> #include <netns/ns.h>
struct ns_addr(char *cp)
The ns_addr subroutine interprets character strings representing addresses, returning binary information suitable for use in system calls.
The ns_addr subroutine separates an address into one to three fields using a single delimiter and examines each field for byte separators (colon or period). The delimiters are:
Item | Description |
---|---|
. | period |
: | colon |
# | pound sign. |
If byte separators are found, each subfield separated is taken to be a small hexadecimal number, and the entirety is taken as a network-byte-ordered quantity to be zero extended in the high-networked-order bytes. Next, the field is inspected for hyphens, which would indicate the field is a number in decimal notation with hyphens separating the millenia. The field is assumed to be a number, interpreted as hexadecimal, if a leading 0x (as in C), a trailing H, (as in Mesa), or any super-octal digits are present. The field is interpreted as octal if a leading 0 is present and there are no super-octal digits. Otherwise, the field is converted as a decimal number.
Item | Description |
---|---|
cp | Returns a pointer to the address of a ns_addr structure. |