FreeBSD/contrib/ntp/ntpdate/ntpdate.c
/*
 * findserver - find a server in the list given its address
 * ***(For now it isn't totally AF-Independant, to check later..)
 */
find a server in the list given its address
(For now it isn't totally AF-Independant, to check later..)
find a server in the list given its address ( For now it isn ' t totally AF - Independant to check later .. )
static struct server *
findserver(
	sockaddr_u *addr
	)
{
	struct server *server;
	struct server *mc_server;
	mc_server = NULL;
	if (SRCPORT(addr) != NTP_PORT)
		return 0;
	for (server = sys_servers; server != NULL; 
	     server = server->next_server) {
		if (SOCK_EQ(addr, &server->srcadr))
			return server;
		if (AF(addr) == AF(&server->srcadr)) {
			if (IS_MCAST(&server->srcadr))
				mc_server = server;
		}
	}
	if (mc_server != NULL) {	
		struct server *sp;
		if (mc_server->event_time != 0) {
			mc_server->event_time = 0;
			complete_servers++;
		}
		server = emalloc_zero(sizeof(*server));
		server->srcadr = *addr;
		server->event_time = ++sys_numservers;
		for (sp = sys_servers; sp->next_server != NULL;
		     sp = sp->next_server)
			;
		sp->next_server = server;
		transmit(server);
	}
	return NULL;
}
static struct server * findserver ( sockaddr_u * addr ) { struct server * server ; struct server * mc_server ; mc_server = NULL ; if ( SRCPORT ( addr ) != NTP_PORT ) return 0 ; for ( server = sys_servers ; server != NULL ; server = server -> next_server ) { if ( SOCK_EQ ( addr , & server -> srcadr ) ) return server ; if ( AF ( addr ) == AF ( & server -> srcadr ) ) { if ( IS_MCAST ( & server -> srcadr ) ) mc_server = server ; } } if ( mc_server != NULL ) { struct server * sp ; if ( mc_server -> event_time != 0 ) { mc_server -> event_time = 0 ; complete_servers ++ ; } server = emalloc_zero ( sizeof ( * server ) ) ; server -> srcadr = * addr ; server -> event_time = ++ sys_numservers ; for ( sp = sys_servers ; sp -> next_server != NULL ; sp = sp -> next_server ) ; sp -> next_server = server ; transmit ( server ) ; } return NULL ; }
findserver - find a server in the list given its address
 ***(For now it isn't totally AF-Independant, to check later..)
findserver - find a server in the list given its address *** ( For now it isn ' t totally AF - Independant to check later .. )
/* empty */