1*61151Sbostic.\" Copyright (c) 1986, 1991, 1993 2*61151Sbostic.\" The Regents of the University of California. All rights reserved. 327494Smckusick.\" 443572Strent.\" %sccs.include.redist.man% 527494Smckusick.\" 6*61151Sbostic.\" @(#)ns.3 8.1 (Berkeley) 06/04/93 736750Sbostic.\" 848352Scael.Dd 948352Scael.Dt NS 3 1048352Scael.Os BSD 4.3 1148352Scael.Sh NAME 1248352Scael.Nm ns_addr , 1348352Scael.Nm ns_ntoa 1448352Scael.Nd Xerox 1548352Scael.Tn NS Ns (tm) 1648352Scaeladdress conversion routines 1748352Scael.Sh SYNOPSIS 1848352Scael.Fd #include <sys/types.h> 1948352Scael.Fd #include <netns/ns.h> 2048352Scael.Ft struct ns_addr 2148352Scael.Fn ns_addr "char *cp" 2248352Scael.Ft char * 2348352Scael.Fn ns_ntoa "struct ns_addr ns" 2448352Scael.Sh DESCRIPTION 2527494SmckusickThe routine 2648352Scael.Fn ns_addr 2727494Smckusickinterprets character strings representing 2848352Scael.Tn XNS 2948352Scaeladdresses, returning binary information suitable 3027494Smckusickfor use in system calls. 3148352ScaelThe routine 3248352Scael.Fn ns_ntoa 3348352Scaeltakes 3448352Scael.Tn XNS 3548352Scaeladdresses and returns 3648352Scael.Tn ASCII 3727494Smckusickstrings representing the address in a 3827494Smckusicknotation in common use in the Xerox Development Environment: 3948352Scael.Bd -filled -offset indent 4048352Scael<network number>.<host number>.<port number> 4148352Scael.Ed 4248352Scael.Pp 4327494SmckusickTrailing zero fields are suppressed, and each number is printed in hexadecimal, 4428037Skarelsin a format suitable for input to 4548352Scael.Fn ns_addr . 4627494SmckusickAny fields lacking super-decimal digits will have a 4748352Scaeltrailing 4848352Scael.Ql H 4948352Scaelappended. 5048352Scael.Pp 5148352ScaelUnfortunately, no universal standard exists for representing 5248352Scael.Tn XNS 5348352Scaeladdresses. 5427494SmckusickAn effort has been made to insure that 5548352Scael.Fn ns_addr 5627494Smckusickbe compatible with most formats in common use. 5727494SmckusickIt will first separate an address into 1 to 3 fields using a single delimiter 5827494Smckusickchosen from 5948352Scaelperiod 6048352Scael.Ql \&. , 6148352Scaelcolon 6248352Scael.Ql \&: 6348352Scaelor pound-sign 6448352Scael.Ql \&# . 6528037SkarelsEach field is then examined for byte separators (colon or period). 6627494SmckusickIf there are byte separators, each subfield separated is taken to be 6727494Smckusicka small hexadecimal number, and the entirety is taken as a network-byte-ordered 6827494Smckusickquantity to be zero extended in the high-network-order bytes. 6927494SmckusickNext, the field is inspected for hyphens, in which case 7027494Smckusickthe field is assumed to be a number in decimal notation 7127494Smckusickwith hyphens separating the millenia. 7227494SmckusickNext, the field is assumed to be a number: 7327494SmckusickIt is interpreted 7448352Scaelas hexadecimal if there is a leading 7548352Scael.Ql 0x 7648352Scael(as in C), 7748352Scaela trailing 7848352Scael.Ql H 7948352Scael(as in Mesa), or there are any super-decimal digits present. 8048352ScaelIt is interpreted as octal is there is a leading 8148352Scael.Ql 0 8228037Skarelsand there are no super-octal digits. 8327494SmckusickOtherwise, it is converted as a decimal number. 8448352Scael.Sh RETURN VALUES 8548352ScaelNone. (See 8648352Scael.Sx BUGS . ) 8748352Scael.Sh SEE ALSO 8848352Scael.Xr hosts 5 , 8948352Scael.Xr networks 5 , 9048352Scael.Sh HISTORY 9148352ScaelThe 9248352Scael.Fn ns_addr 9348352Scaeland 9448352Scael.Fn ns_toa 9548352Scaelfunctions appeared in 9648352Scael.Bx 4.3 . 9748352Scael.Sh BUGS 9827494SmckusickThe string returned by 9948352Scael.Fn ns_ntoa 10027494Smckusickresides in a static memory area. 10148352ScaelThe function 10248352Scael.Fn ns_addr 10327494Smckusickshould diagnose improperly formed input, and there should be an unambiguous 10427494Smckusickway to recognize this. 105