/* * This is sample code generated by rpcgen. * These are only templates and you can use them * as a guideline for developing your own functions. */ #include "prot.h" #include "protRelayUtil.h" #ifdef RELAY_DEBUG /* must not use this when the relay is daemonized! */ #include #endif bool_t rssib_rel_echo_0_svc(void *argp, void *result, struct svc_req *rqstp) { /* PING */ return 1; } bool_t rssib_rel_getmcport_0_svc(void *argp, struct McAddr *result, struct svc_req *rqstp) { bool_t retval; const struct sockaddr_in *ca = getRssibMapClntAddr(); #ifdef RELAY_DEBUG printf("GETMCPORT\n"); #endif if ( ca ) { result->ipaddr = ntohl( ca->sin_addr.s_addr ); result->portno = (int)(unsigned short)ntohs( ca->sin_port ); retval = 1; } else { retval = 0; } return retval; } bool_t rssib_rel_lkup_0_svc(struct MapReq *argp, struct MapReq *result, struct svc_req *rqstp) { struct timeval tout; CLIENT *clnt; enum clnt_stat stat; tout.tv_sec = 1; tout.tv_usec = 0; clnt = getRssibMapClnt(); result->ports.ports_val = 0; result->ports.ports_len = 0; /* Relay the lookup request over UDP multicast */ if ( ! clnt ) { /* should never happen; client is created at startup */ return 0; } #ifdef RELAY_DEBUG printf("RELAY CALL %d\n", argp->ipAddr); #endif stat = clnt_call( clnt, RSSIB_MAP_LKUP, (xdrproc_t)xdr_MapReq, (caddr_t)argp, (xdrproc_t)xdr_MapReq, (caddr_t)result, tout ); if ( RPC_SUCCESS == stat ) { return 1; } else { printErrMsg( "RPC relayed LOOKUP failed: %s", clnt_sperrno( stat ) ); } return 0; } int rssib_rel_0_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) { xdr_free (xdr_result, result); /* * Insert additional freeing code here, if needed */ return 1; }