FreeBSD/sys/rpc/svc_generic.c
/*
 * The high level interface to svc_tli_create().
 * It tries to create a server for "nconf" and registers the service
 * with the rpcbind. It calls svc_tli_create();
 */
The high level interface to svc_tli_create().
It tries to create a server for "nconf" and registers the service
with the rpcbind.
The high level interface to svc_tli_create () . It tries to create a server for " nconf " and registers the service with the rpcbind .
SVCXPRT *
svc_tp_create(
	SVCPOOL *pool,
	void (*dispatch)(struct svc_req *, SVCXPRT *),
	rpcprog_t prognum,		
	rpcvers_t versnum,		
	const char *uaddr,		
	const struct netconfig *nconf) 
{
	struct netconfig nconfcopy;
	struct netbuf *taddr;
	struct t_bind bind;
	SVCXPRT *xprt;
	if (nconf == NULL) {
		printf(
	"svc_tp_create: invalid netconfig structure for prog %u vers %u\n",
				(unsigned)prognum, (unsigned)versnum);
		return (NULL);
	}
	if (uaddr) {
		taddr = uaddr2taddr(nconf, uaddr);
		bind.addr = *taddr;
		free(taddr, M_RPC);
		bind.qlen = -1;
		xprt = svc_tli_create(pool, NULL, nconf, &bind, 0, 0);
		free(bind.addr.buf, M_RPC);
	} else {
		xprt = svc_tli_create(pool, NULL, nconf, NULL, 0, 0);
	}
	if (xprt == NULL) {
		return (NULL);
	}
	nconfcopy = *nconf;
	(void) rpcb_unset(prognum, versnum, &nconfcopy);
	if (svc_reg(xprt, prognum, versnum, dispatch, nconf) == FALSE) {
		printf(
		"svc_tp_create: Could not register prog %u vers %u on %s\n",
				(unsigned)prognum, (unsigned)versnum,
				nconf->nc_netid);
		xprt_unregister(xprt);
		SVC_RELEASE(xprt);
		return (NULL);
	}
	return (xprt);
}
SVCXPRT * svc_tp_create ( SVCPOOL * pool , void ( * dispatch ) ( struct svc_req * , SVCXPRT * ) , rpcprog_t prognum , rpcvers_t versnum , const char * uaddr , const struct netconfig * nconf ) { struct netconfig nconfcopy ; struct netbuf * taddr ; struct t_bind bind ; SVCXPRT * xprt ; if ( nconf == NULL ) { printf ( " \n " , ( unsigned ) prognum , ( unsigned ) versnum ) ; return ( NULL ) ; } if ( uaddr ) { taddr = uaddr2taddr ( nconf , uaddr ) ; bind . addr = * taddr ; free ( taddr , M_RPC ) ; bind . qlen = -1 ; xprt = svc_tli_create ( pool , NULL , nconf , & bind , 0 , 0 ) ; free ( bind . addr . buf , M_RPC ) ; } else { xprt = svc_tli_create ( pool , NULL , nconf , NULL , 0 , 0 ) ; } if ( xprt == NULL ) { return ( NULL ) ; } nconfcopy = * nconf ; ( void ) rpcb_unset ( prognum , versnum , & nconfcopy ) ; if ( svc_reg ( xprt , prognum , versnum , dispatch , nconf ) == FALSE ) { printf ( " \n " , ( unsigned ) prognum , ( unsigned ) versnum , nconf -> nc_netid ) ; xprt_unregister ( xprt ) ; SVC_RELEASE ( xprt ) ; return ( NULL ) ; } return ( xprt ) ; }
The high level interface to svc_tli_create().
The high level interface to svc_tli_create () .
/* Program number */ /* Version number */ /* Address (or null for default) */ /* Netconfig structure for the network */ /*LINTED const castaway*/