Content-type: text/html Man page of ns_addr

ns_addr

Section: C Library Functions (3)
Index Return to Main Contents
 

NAME

ns_addr, ns_ntoa, ns_ntoa_r - Xerox NS address conversion routines  

LIBRARY

Standard C Library (libc.a)  

SYNOPSIS

#include <sys/types.h> #include <netns/ns.h>

struct ns_addr ns_addr(        char *cp);

char *ns_ntoa(        struct ns_addr ns);

The following function is supported in order to maintain backward compatibility with previous versions of the operating system. int ns_ntoa_r(        struct ns_addr ns,
       char *buf,
       int buf_len);
 

PARAMETERS

Points to a character string representing an XNS address. Specifies an XNS address. Points to the buffer that will contain the returned ASCII strings. Specifies the size of the buffer buf. This must be at least 40 characters.  

DESCRIPTION

The ns_addr() function interprets character strings representing Xerox NS addresses, and returns binary information suitable for use in functions. The ns_ntoa() function takes XNS addresses and returns ASCII strings representing the address in a notation in common use in the Xerox development environment: <network number>.<host number>.<port number>

Trailing zero fields are suppressed, and each number is printed in hexadecimal, in a format suitable for input to the ns_addr() function. Any fields lacking superdecimal digits will have a trailing H appended.

Unfortunately, no universal standard exists for representing XNS addresses. An effort has been made to ensure that the ns_addr() function be compatible with most formats in common use.

The ns_addr() function first separates an address into one to three fields using a . (dot), a : (colon), or a # (number sign) single delimiter. Each field is then examined for byte separators (colon or period). If there are byte separators, each subfield separated is taken to be a small hexadecimal number, and the entire component is taken as a network-byte-ordered quantity to be zero extended in the high-network-order bytes.

Next, the field is inspected for dashes. If there are dashes, the field is assumed to be a number in decimal notation with dashes separating the millenia. Next, the field is assumed to be a number. It is interpreted as hexadecimal if there is a leading 0x (as in C), a trailing H (as in Mesa), or if there are any superdecimal digits present. It is interpreted as octal if there is a leading 0 (zero) and there are no superoctal digits. Otherwise, it is converted as a decimal number.

The ns_ntoa_r() function is a reentrant version of ns_ntoa(). It is supported in order to maintain backward compatibility with previous versions of the operating system.

Upon successful completion, ns_ntoa_r() provides the converted string in the buffer pointed at by buf, and returns a value of 0 (zero). Otherwise it returns a value of -1.  

ERRORS

If any of the following conditions occurs, ns_ntoa_r() sets errno to the corresponding value: The buffer pointed to by buf is invalid, or buf_len is less than 40 characters.  

RELATED INFORMATION

Files: hosts(4), networks(4). delim off


 

Index

NAME
LIBRARY
SYNOPSIS
PARAMETERS
DESCRIPTION
ERRORS
RELATED INFORMATION

This document was created by man2html, using the manual pages.
Time: 02:41:55 GMT, October 02, 2010