154359Sroberto/* 254359Sroberto * refnumtoa - return asciized refclock addresses stored in local array space 354359Sroberto */ 4290001Sglebius#include <config.h> 554359Sroberto#include <stdio.h> 654359Sroberto 7290001Sglebius#include "ntp_net.h" 854359Sroberto#include "lib_strbuf.h" 954359Sroberto#include "ntp_stdlib.h" 1054359Sroberto 11290001Sglebiusconst char * 1254359Srobertorefnumtoa( 13290001Sglebius sockaddr_u *num 1454359Sroberto ) 1554359Sroberto{ 16290001Sglebius u_int32 netnum; 17290001Sglebius char *buf; 18290001Sglebius const char *rclock; 19132451Sroberto 20290001Sglebius if (!ISREFCLOCKADR(num)) 21290001Sglebius return socktoa(num); 22290001Sglebius 2354359Sroberto LIB_GETBUF(buf); 24290001Sglebius netnum = SRCADR(num); 25290001Sglebius rclock = clockname((int)((u_long)netnum >> 8) & 0xff); 2654359Sroberto 27290001Sglebius if (rclock != NULL) 28290001Sglebius snprintf(buf, LIB_BUFLENGTH, "%s(%lu)", 29290001Sglebius rclock, (u_long)netnum & 0xff); 30290001Sglebius else 31290001Sglebius snprintf(buf, LIB_BUFLENGTH, "REFCLK(%lu,%lu)", 32290001Sglebius ((u_long)netnum >> 8) & 0xff, 33290001Sglebius (u_long)netnum & 0xff); 3454359Sroberto 3554359Sroberto return buf; 3654359Sroberto} 37