1*48352Scael.\" Copyright (c) 1986, 1991 The Regents of the University of California. 236750Sbostic.\" All rights reserved. 327494Smckusick.\" 443572Strent.\" %sccs.include.redist.man% 527494Smckusick.\" 6*48352Scael.\" @(#)ns.3 6.5 (Berkeley) 04/19/91 736750Sbostic.\" 8*48352Scael.Dd 9*48352Scael.Dt NS 3 10*48352Scael.Os BSD 4.3 11*48352Scael.Sh NAME 12*48352Scael.Nm ns_addr , 13*48352Scael.Nm ns_ntoa 14*48352Scael.Nd Xerox 15*48352Scael.Tn NS Ns (tm) 16*48352Scaeladdress conversion routines 17*48352Scael.Sh SYNOPSIS 18*48352Scael.Fd #include <sys/types.h> 19*48352Scael.Fd #include <netns/ns.h> 20*48352Scael.Ft struct ns_addr 21*48352Scael.Fn ns_addr "char *cp" 22*48352Scael.Ft char * 23*48352Scael.Fn ns_ntoa "struct ns_addr ns" 24*48352Scael.Sh DESCRIPTION 2527494SmckusickThe routine 26*48352Scael.Fn ns_addr 2727494Smckusickinterprets character strings representing 28*48352Scael.Tn XNS 29*48352Scaeladdresses, returning binary information suitable 3027494Smckusickfor use in system calls. 31*48352ScaelThe routine 32*48352Scael.Fn ns_ntoa 33*48352Scaeltakes 34*48352Scael.Tn XNS 35*48352Scaeladdresses and returns 36*48352Scael.Tn ASCII 3727494Smckusickstrings representing the address in a 3827494Smckusicknotation in common use in the Xerox Development Environment: 39*48352Scael.Bd -filled -offset indent 40*48352Scael<network number>.<host number>.<port number> 41*48352Scael.Ed 42*48352Scael.Pp 4327494SmckusickTrailing zero fields are suppressed, and each number is printed in hexadecimal, 4428037Skarelsin a format suitable for input to 45*48352Scael.Fn ns_addr . 4627494SmckusickAny fields lacking super-decimal digits will have a 47*48352Scaeltrailing 48*48352Scael.Ql H 49*48352Scaelappended. 50*48352Scael.Pp 51*48352ScaelUnfortunately, no universal standard exists for representing 52*48352Scael.Tn XNS 53*48352Scaeladdresses. 5427494SmckusickAn effort has been made to insure that 55*48352Scael.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 59*48352Scaelperiod 60*48352Scael.Ql \&. , 61*48352Scaelcolon 62*48352Scael.Ql \&: 63*48352Scaelor pound-sign 64*48352Scael.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 74*48352Scaelas hexadecimal if there is a leading 75*48352Scael.Ql 0x 76*48352Scael(as in C), 77*48352Scaela trailing 78*48352Scael.Ql H 79*48352Scael(as in Mesa), or there are any super-decimal digits present. 80*48352ScaelIt is interpreted as octal is there is a leading 81*48352Scael.Ql 0 8228037Skarelsand there are no super-octal digits. 8327494SmckusickOtherwise, it is converted as a decimal number. 84*48352Scael.Sh RETURN VALUES 85*48352ScaelNone. (See 86*48352Scael.Sx BUGS . ) 87*48352Scael.Sh SEE ALSO 88*48352Scael.Xr hosts 5 , 89*48352Scael.Xr networks 5 , 90*48352Scael.Sh HISTORY 91*48352ScaelThe 92*48352Scael.Fn ns_addr 93*48352Scaeland 94*48352Scael.Fn ns_toa 95*48352Scaelfunctions appeared in 96*48352Scael.Bx 4.3 . 97*48352Scael.Sh BUGS 9827494SmckusickThe string returned by 99*48352Scael.Fn ns_ntoa 10027494Smckusickresides in a static memory area. 101*48352ScaelThe function 102*48352Scael.Fn ns_addr 10327494Smckusickshould diagnose improperly formed input, and there should be an unambiguous 10427494Smckusickway to recognize this. 105