FreeBSD/usr.sbin/rpcbind/tests/addrmerge_test.c
/*
 * Helper function used by most test cases
 * param recvdstaddr	If non-null, the uaddr on which the request was received
 */
Helper function used by most test cases
param recvdstaddr    If non-null, the uaddr on which the request was received
Helper function used by most test cases param recvdstaddr If non - null the uaddr on which the request was received
static char*
do_addrmerge4(const char* recvdstaddr)
{
	struct netbuf caller;
	struct sockaddr_in caller_in;
	const char *serv_uaddr, *clnt_uaddr, *netid;
	caller.maxlen = sizeof(struct sockaddr_storage);
	caller.len = sizeof(caller_in);
	caller_in.sin_family = AF_INET;
	caller_in.sin_len = sizeof(caller_in);
	caller_in.sin_port = 1234;
	caller_in.sin_addr.s_addr = inet_addr("192.0.2.1");
	caller.buf = (void*)&caller_in;
	if (recvdstaddr != NULL)
		clnt_uaddr = recvdstaddr;
	else
		clnt_uaddr = "192.0.2.1.3.46";
	serv_uaddr = "0.0.0.0.3.46";
	netid = "udp";
	return (addrmerge(&caller, serv_uaddr, clnt_uaddr, netid));
}
static char * do_addrmerge4 ( const char * recvdstaddr ) { struct netbuf caller ; struct sockaddr_in caller_in ; const char * serv_uaddr , * clnt_uaddr , * netid ; caller . maxlen = sizeof ( struct sockaddr_storage ) ; caller . len = sizeof ( caller_in ) ; caller_in . sin_family = AF_INET ; caller_in . sin_len = sizeof ( caller_in ) ; caller_in . sin_port = 1234 ; caller_in . sin_addr . s_addr = inet_addr ( " " ) ; caller . buf = ( void * ) & caller_in ; if ( recvdstaddr != NULL ) clnt_uaddr = recvdstaddr ; else clnt_uaddr = " " ; serv_uaddr = " " ; netid = " " ; return ( addrmerge ( & caller , serv_uaddr , clnt_uaddr , netid ) ) ; }
Helper function used by most test cases
 param recvdstaddr    If non-null, the uaddr on which the request was received
Helper function used by most test cases param recvdstaddr If non - null the uaddr on which the request was received
/* caller contains the client's IP address */ /* assume server is bound in INADDR_ANY port 814 */