int main(int argn, char *argc[]) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case //run_mode can switch into stand alone program or program launch by shell script //1 : stand alone, debug mode, more screen information //0 : launch by shell script as test case, only one printf -> result status int run_mode = 0; int test_status = 1; //Default test result set to FAILED int progNum = 5000000; //This test doesn't care with progNum, just local test of reg/unreg... int port = 600; SVCXPRT *transp = NULL; //Initialization pmap_unset(progNum, VERSNUM); if (run_mode) { printf("Before creation\n"); } transp = svcudp_create(RPC_ANYSOCK); pmap_set(progNum, VERSNUM, IPPROTO_UDP, port); test_status = !pmap_unset(progNum, VERSNUM); //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }
void cleanup(int sig) { (void) pmap_unset(RUSERSPROG, RUSERSVERS_IDLE); (void) pmap_unset(RUSERSPROG, RUSERSVERS_ORIG); exit(0); }
int main(int argc, char *argv[]) { SVCXPRT *transp; int sock = 0; int proto = 0; struct sockaddr_in from; int fromlen; if (argc == 2) closedown = atoi(argv[1]); if (closedown <= 0) closedown = 20; /* * See if inetd started us */ fromlen = sizeof(from); if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0) { from_inetd = 0; sock = RPC_ANYSOCK; proto = IPPROTO_UDP; } if (!from_inetd) { daemon(0, 0); (void)pmap_unset(RSTATPROG, RSTATVERS_TIME); (void)pmap_unset(RSTATPROG, RSTATVERS_SWTCH); (void)pmap_unset(RSTATPROG, RSTATVERS_ORIG); (void) signal(SIGINT, cleanup); (void) signal(SIGTERM, cleanup); (void) signal(SIGHUP, cleanup); } openlog("rpc.rstatd", LOG_CONS|LOG_PID, LOG_DAEMON); transp = svcudp_create(sock); if (transp == NULL) { syslog(LOG_ERR, "cannot create udp service"); exit(1); } if (!svc_register(transp, RSTATPROG, RSTATVERS_TIME, rstat_service, proto)) { syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_TIME, %s)", proto?"udp":"(inetd)"); exit(1); } if (!svc_register(transp, RSTATPROG, RSTATVERS_SWTCH, rstat_service, proto)) { syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_SWTCH, %s)", proto?"udp":"(inetd)"); exit(1); } if (!svc_register(transp, RSTATPROG, RSTATVERS_ORIG, rstat_service, proto)) { syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_ORIG, %s)", proto?"udp":"(inetd)"); exit(1); } svc_run(); syslog(LOG_ERR, "svc_run returned"); exit(1); }
int main (int argc, char **argv) { register SVCXPRT *transp; pmap_unset (TELL_ME_DAY1, TELL_ME_DAY_VERSION1); pmap_unset (TELL_ME_DAY2, TELL_ME_DAY_VERSION2); pmap_unset (TELL_ME_DAY3, TELL_ME_DAY_VERSION3); pmap_unset (TELL_ME_DAY4, TELL_ME_DAY_VERSION4); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf (stderr, "%s", "cannot create udp service."); exit(1); } if (!svc_register(transp, TELL_ME_DAY1, TELL_ME_DAY_VERSION1, tell_me_day1_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (TELL_ME_DAY1, TELL_ME_DAY_VERSION1, udp)."); exit(1); } if (!svc_register(transp, TELL_ME_DAY2, TELL_ME_DAY_VERSION2, tell_me_day2_2, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (TELL_ME_DAY2, TELL_ME_DAY_VERSION2, udp)."); exit(1); } if (!svc_register(transp, TELL_ME_DAY3, TELL_ME_DAY_VERSION3, tell_me_day3_3, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (TELL_ME_DAY3, TELL_ME_DAY_VERSION3, udp)."); exit(1); } if (!svc_register(transp, TELL_ME_DAY4, TELL_ME_DAY_VERSION4, tell_me_day4_4, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (TELL_ME_DAY4, TELL_ME_DAY_VERSION4, udp)."); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, TELL_ME_DAY1, TELL_ME_DAY_VERSION1, tell_me_day1_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (TELL_ME_DAY1, TELL_ME_DAY_VERSION1, tcp)."); exit(1); } if (!svc_register(transp, TELL_ME_DAY2, TELL_ME_DAY_VERSION2, tell_me_day2_2, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (TELL_ME_DAY2, TELL_ME_DAY_VERSION2, tcp)."); exit(1); } if (!svc_register(transp, TELL_ME_DAY3, TELL_ME_DAY_VERSION3, tell_me_day3_3, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (TELL_ME_DAY3, TELL_ME_DAY_VERSION3, tcp)."); exit(1); } if (!svc_register(transp, TELL_ME_DAY4, TELL_ME_DAY_VERSION4, tell_me_day4_4, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (TELL_ME_DAY4, TELL_ME_DAY_VERSION4, tcp)."); exit(1); } svc_run (); fprintf (stderr, "%s", "svc_run returned"); exit (1); /* NOTREACHED */ }
void cleanup(int sig) { (void) pmap_unset(RSTATPROG, RSTATVERS_TIME); (void) pmap_unset(RSTATPROG, RSTATVERS_SWTCH); (void) pmap_unset(RSTATPROG, RSTATVERS_ORIG); exit(0); }
static void unregister_services (void) { if (nfs_version & (0x1 << 1)) { pmap_unset (MOUNTPROG, MOUNTVERS); pmap_unset (MOUNTPROG, MOUNTVERS_POSIX); } if (nfs_version & (0x1 << 2)) pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3); }
static void daemon_simulator (void) { signal (SIGHUP, sim_killer); signal (SIGINT, sim_killer); signal (SIGTERM, sim_killer); pmap_unset (sim_port, SIM_SM_VERS); /* this registers both UDP and TCP services */ rpc_init("statd", sim_port, SIM_SM_VERS, sim_sm_prog_1, 0); svc_run (); pmap_unset (sim_port, SIM_SM_VERS); }
int main (int argc, char **argv) { register SVCXPRT *transp; pmap_unset (DEVICE_ASYNC, DEVICE_ASYNC_VERSION); pmap_unset (DEVICE_CORE, DEVICE_CORE_VERSION); pmap_unset (DEVICE_INTR, DEVICE_INTR_VERSION); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf (stderr, "%s", "cannot create udp service."); exit(1); } if (!svc_register(transp, DEVICE_ASYNC, DEVICE_ASYNC_VERSION, device_async_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (DEVICE_ASYNC, DEVICE_ASYNC_VERSION, udp)."); exit(1); } if (!svc_register(transp, DEVICE_CORE, DEVICE_CORE_VERSION, device_core_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (DEVICE_CORE, DEVICE_CORE_VERSION, udp)."); exit(1); } if (!svc_register(transp, DEVICE_INTR, DEVICE_INTR_VERSION, device_intr_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (DEVICE_INTR, DEVICE_INTR_VERSION, udp)."); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, DEVICE_ASYNC, DEVICE_ASYNC_VERSION, device_async_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (DEVICE_ASYNC, DEVICE_ASYNC_VERSION, tcp)."); exit(1); } if (!svc_register(transp, DEVICE_CORE, DEVICE_CORE_VERSION, device_core_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (DEVICE_CORE, DEVICE_CORE_VERSION, tcp)."); exit(1); } if (!svc_register(transp, DEVICE_INTR, DEVICE_INTR_VERSION, device_intr_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (DEVICE_INTR, DEVICE_INTR_VERSION, tcp)."); exit(1); } svc_run (); fprintf (stderr, "%s", "svc_run returned"); exit (1); /* NOTREACHED */ }
void leave (int type, int wait) { struct task *task; switch (type) { case MASTER: pmap_unset (LOSH, MASTER); break; case SLAVE: switch (wait) { case TRUE: stopslave_call (); while (slave -> task_number || slave -> imported_task_number); break; case FALSE: deletetask_broadcast (slave); task = NULL; while (TRUE) { /* Foreach imported task: */ task = (struct task *) list_next (&slave -> imported_tasks, (task == NULL)); if (task == NULL) break; /* Kill it: */ if (task -> pid != -1) { kill (task -> pid, SIGKILL); #ifdef DEBUG printf ("SLAV (info) killed task %d\n", (int) task -> pid); #endif } } break; } removeslave_call (); pmap_unset (LOSH, SLAVE); break; } }
int main(int argc, char **argv) { register SVCXPRT *transp; signal(SIGCHLD, sigchld); (void) pmap_unset(SCSI_PROG, SCSI_VERS); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf(stderr, "cannot create udp service."); exit(1); } if (!svc_register(transp, SCSI_PROG, SCSI_VERS, scsi_prog_1, IPPROTO_UDP)) { fprintf(stderr, "unable to register (SCSI_PROG, SCSI_VERS, udp)."); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf(stderr, "cannot create tcp service."); exit(1); } if (!svc_register(transp, SCSI_PROG, SCSI_VERS, scsi_prog_1, IPPROTO_TCP)) { fprintf(stderr, "unable to register (SCSI_PROG, SCSI_VERS, tcp)."); exit(1); } svc_run(); fprintf(stderr, "svc_run returned"); exit(1); /* NOTREACHED */ }
int main (int argc, char **argv) { register SVCXPRT *transp; pmap_unset (DISPLAY_PRG, DISPLAY_VER); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf (stderr, "%s", "cannot create udp service."); exit(1); } if (!svc_register(transp, DISPLAY_PRG, DISPLAY_VER, display_prg_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (DISPLAY_PRG, DISPLAY_VER, udp)."); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, DISPLAY_PRG, DISPLAY_VER, display_prg_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (DISPLAY_PRG, DISPLAY_VER, tcp)."); exit(1); } svc_run (); fprintf (stderr, "%s", "svc_run returned"); exit (1); /* NOTREACHED */ }
void * rpc2_server() { register SVCXPRT *transp; pmap_unset (RPC2_RPC_PROG, RPC2_RPC_VERS1); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf (stderr, "%s", "cannot create udp service."); exit(1); } if (!svc_register(transp, RPC2_RPC_PROG, RPC2_RPC_VERS1, rpc2_rpc_prog_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (RPC2_RPC_PROG, RPC2_RPC_VERS1, udp)."); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, RPC2_RPC_PROG, RPC2_RPC_VERS1, rpc2_rpc_prog_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (RPC2_RPC_PROG, RPC2_RPC_VERS1, tcp)."); exit(1); } svc_run (); fprintf (stderr, "%s", "svc_run returned"); exit (1); /* NOTREACHED */ }
void register_server(int client_id) { register SVCXPRT *transp; pmap_unset (CALLBACK_SEMAPHORE, V1 + client_id); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf (stderr, "%s", "cannot create udp service."); exit(1); } if (!svc_register(transp, CALLBACK_SEMAPHORE, V1 + client_id, callback_semaphore_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (CALLBACK_SEMAPHORE, V1, udp)."); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, CALLBACK_SEMAPHORE, V1 + client_id, callback_semaphore_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (CALLBACK_SEMAPHORE, V1, tcp)."); exit(1); } //svc_run (); //fprintf (stderr, "%s", "svc_run returned"); //exit (1); }
main() { SVCXPRT *transp; (void)pmap_unset(KUNDENPROG, KUNDENVERS); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { (void)fprintf(stderr, "cannot create udp service.\n"); exit(1); } if (!svc_register(transp, KUNDENPROG, KUNDENVERS, kundenprog_1, IPPROTO_UDP)) { (void)fprintf(stderr, "unable to register (KUNDENPROG, KUNDENVERS, udp).\n"); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { (void)fprintf(stderr, "cannot create tcp service.\n"); exit(1); } if (!svc_register(transp, KUNDENPROG, KUNDENVERS, kundenprog_1, IPPROTO_TCP)) { (void)fprintf(stderr, "unable to register (KUNDENPROG, KUNDENVERS, tcp).\n"); exit(1); } svc_run(); (void)fprintf(stderr, "svc_run returned\n"); exit(1); }
int main (int argc, char **argv) { register SVCXPRT *transp; pmap_unset (NAMENODE, NN); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf (stderr, "%s", "cannot create udp service."); exit(1); } if (!svc_register(transp, NAMENODE, NN, namenode_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (NAMENODE, NN, udp)."); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, NAMENODE, NN, namenode_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (NAMENODE, NN, tcp)."); exit(1); } svc_run (); fprintf (stderr, "%s", "svc_run returned"); exit (1); /* NOTREACHED */ }
/** * nfs_svc_unregister - remove service registrations from local rpcbind database * @program: RPC program number to unregister * @version: RPC version number to unregister * * Removes all registrations for [ @program, @version ] . */ void nfs_svc_unregister(const rpcprog_t program, const rpcvers_t version) { if (pmap_unset((unsigned long)program, (unsigned long)version) == FALSE) xlog(D_GENERAL, "Failed to unregister program %lu, version %lu", (unsigned long)program, (unsigned long)version); }
int main (int argc, char **argv) { register SVCXPRT *transp; pmap_unset (ARRAYSUM_CALC, ARRAYSUM_CALC_1); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf (stderr, "%s", "cannot create udp service."); exit(1); } if (!svc_register(transp, ARRAYSUM_CALC, ARRAYSUM_CALC_1, arraysum_calc_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (ARRAYSUM_CALC, ARRAYSUM_CALC_1, udp)."); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, ARRAYSUM_CALC, ARRAYSUM_CALC_1, arraysum_calc_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (ARRAYSUM_CALC, ARRAYSUM_CALC_1, tcp)."); exit(1); } svc_run (); fprintf (stderr, "%s", "svc_run returned"); exit (1); /* NOTREACHED */ }
/* * Get a UDP socket, bind it, figure out the port, * and advertise the port as program "prog". * * XXX - it would be nice if you could advertise ascii strings. */ int udp_server(u_long prog, int rdwr) { int sock; struct sockaddr_in s; if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { perror("socket"); exit(1); } sock_optimize(sock, rdwr); bzero((void*)&s, sizeof(s)); s.sin_family = AF_INET; #ifdef NO_PORTMAPPER s.sin_port = htons(prog); #endif if (bind(sock, (struct sockaddr*)&s, sizeof(s)) < 0) { perror("bind"); exit(2); } #ifdef PORTMAP (void)pmap_unset(prog, (u_long)1); if (!pmap_set(prog, (u_long)1, (u_long)IPPROTO_UDP, (unsigned short)sockport(sock))) { perror("pmap_set"); exit(5); } #endif return (sock); }
static void signal_int_handler (int sig) { (void) sig; pmap_unset (RPC_PROGNUM, RPC_PROGVER); }
int main (int argc, char **argv) { register SVCXPRT *transp; pmap_unset (WHATSUPPROG, WHATSUPVERS); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf (stderr, "%s", "cannot create udp service."); exit(1); } if (!svc_register(transp, WHATSUPPROG, WHATSUPVERS, whatsupprog_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (WHATSUPPROG, WHATSUPVERS, udp)."); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, WHATSUPPROG, WHATSUPVERS, whatsupprog_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (WHATSUPPROG, WHATSUPVERS, tcp)."); exit(1); } svc_run (); fprintf (stderr, "%s", "svc_run returned"); exit (1); /* NOTREACHED */ }
void ippool_api_init(void) { int result; /* Register RPC interface */ ippool_rpc_xprt = svcudp_create(RPC_ANYSOCK); if (ippool_rpc_xprt == NULL) { ippool_log(LOG_ERR, "unable to register with RPC"); exit(1); } /* FIXME: is this really required? */ svc_unregister(IPPOOL_PROG, IPPOOL_VERSION); /* Note: must call this or the registration fails every other time * the daemon is started. */ (void) pmap_unset(IPPOOL_PROG, IPPOOL_VERSION); result = svc_register(ippool_rpc_xprt, IPPOOL_PROG, IPPOOL_VERSION, ippool_prog_1, IPPROTO_UDP); if (result == 0) { /* UNIX is nice and consistent about error codes ;-) */ ippool_log(LOG_ERR, "unable to register RPC program"); exit(1); } result = usl_fd_add_fd(ippool_rpc_xprt->xp_sock, ippool_api_rpc_msg, ippool_rpc_xprt); if (result < 0) { ippool_log(LOG_ERR, "unable to register RPC handler"); exit(1); } }
int main(void) { #if defined (_WIN32) WSADATA WSAData; #endif int servernumber; #if defined (_WIN32) if (WSAStartup(MAKEWORD(2,2), &WSAData)) { WSACleanup(); return -1; } #endif for(servernumber=0; servernumber<TSP_MAX_SERVER_NUMBER; servernumber++) { svc_unregister (TSP_get_progid(servernumber), TSP_RPC_VERSION_INITIAL); pmap_unset (TSP_get_progid(servernumber), TSP_RPC_VERSION_INITIAL); } #if defined (_WIN32) WSACleanup(); #endif return 0; }
int main (int argc, char **argv) { register SVCXPRT *transp; pmap_unset (COOKIE_JAR, COOKIE_JAR_VERSION); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf (stderr, "%s", "cannot create udp service."); exit(1); } if (!svc_register(transp, COOKIE_JAR, COOKIE_JAR_VERSION, cookie_jar_1, IPPROTO_UDP)) { fprintf (stderr, "%s", "unable to register (COOKIE_JAR, COOKIE_JAR_VERSION, udp)."); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, COOKIE_JAR, COOKIE_JAR_VERSION, cookie_jar_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (COOKIE_JAR, COOKIE_JAR_VERSION, tcp)."); exit(1); } svc_run (); fprintf (stderr, "%s", "svc_run returned"); exit (1); /* NOTREACHED */ }
int main (int argc, char **argv) { thread_opts_t opts; opts.udp_port = 51234; opts.tcp_port = 51234; opts.sock = create_mcast_sock(NULL, opts.udp_port); pthread_t mcast_thread, tcp_thread; pthread_create(&mcast_thread, NULL, start_mcast_thread, &opts); pthread_create(&tcp_thread, NULL, start_tcp_thread, &opts); register SVCXPRT *transp; pmap_unset (OCL_PROG, OCL_VERS); transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, OCL_PROG, OCL_VERS, ocl_prog_1, IPPROTO_TCP)) { fprintf (stderr, "%s", "unable to register (OCL_PROG, OCL_VERS, tcp)."); exit(1); } svc_run (); fprintf (stderr, "%s", "svc_run returned"); exit (1); /* NOTREACHED */ }
int daVarServSet(int prog, int version) { if(prog==0) prog = DAVARSVR; if(version==0) version = DAVARVERS; (void) pmap_unset(prog,version); last_program = prog; last_version = version; udp_transp = (SVCXPRT *) svcudp_create(RPC_ANYSOCK); if (udp_transp == NULL) { fprintf(stderr, "cannot create udp service."); exit(1); } if (!svc_register(udp_transp, prog, version, davarsvr_1, IPPROTO_UDP)) { fprintf(stderr, "unable to register (%d, %d), udp).\n",prog,version); exit(1); } tcp_transp = (SVCXPRT *) svctcp_create(RPC_ANYSOCK, 0, 0); if (tcp_transp == NULL) { fprintf(stderr, "cannot create tcp service.\n"); exit(1); } if (!svc_register(tcp_transp, prog, version, davarsvr_1, IPPROTO_TCP)) { fprintf(stderr, "unable to register (%d, %d), tcp).\n",prog,version); exit(1); } }
void yp_init(struct env *x_env) { struct yp_data *yp; if ((yp = calloc(1, sizeof(*yp))) == NULL) fatal(NULL); TAILQ_INIT(&yp->yd_events); env = x_env; env->sc_yp = yp; (void)pmap_unset(YPPROG, YPVERS); if ((yp->yp_trans_udp = svcudp_create(RPC_ANYSOCK)) == NULL) fatal("cannot create udp service"); if ((yp->yp_trans_tcp = svctcp_create(RPC_ANYSOCK, 0, 0)) == NULL) fatal("cannot create tcp service"); if (!svc_register(yp->yp_trans_udp, YPPROG, YPVERS, yp_dispatch, IPPROTO_UDP)) { fatal("unable to register (YPPROG, YPVERS, udp)"); } if (!svc_register(yp->yp_trans_tcp, YPPROG, YPVERS, yp_dispatch, IPPROTO_TCP)) { fatal("unable to register (YPPROG, YPVERS, tcp)"); } }
/* * Unadvertise the socket */ void udp_done(u_long prog) { #ifdef PORTMAP (void)pmap_unset(prog, (u_long)1); #endif }
main() { SVCXPRT *transp; pw_serv_init(); (void)pmap_unset(payments, paymentsver); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { (void)fprintf(stderr, "cannot create udp service.\n"); exit(1); } (void)fprintf(stdout, "Created udp service.\n"); udp_master = transp; if (!svc_register(transp, payments, paymentsver, payments_1, IPPROTO_UDP)) { (void)fprintf(stderr, "unable to register (payments, paymentsver, udp).\n"); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { (void)fprintf(stderr, "cannot create tcp service.\n"); exit(1); } (void)fprintf(stdout, "Created tcp service.\n"); tcp_master = transp; if (!svc_register(transp, payments, paymentsver, payments_1, IPPROTO_TCP)) { (void)fprintf(stderr, "unable to register (payments, paymentsver, tcp).\n"); exit(1); } pw_serv_mainloop(tcp_master, udp_master, 0, 1); (void)fprintf(stderr, "svc_run returned\n"); exit(1); }
/* * Signal handler. */ static void killer (int sig) { note (N_FATAL, "Caught signal %d, un-registering and exiting.", sig); pmap_unset (SM_PROG, SM_VERS); exit (0); }
void unregister_amq(void) { #ifdef DEBUG amuDebug(D_AMQ) #endif /* DEBUG */ /* find which instance of amd to unregister */ pmap_unset(get_amd_program_number(), AMQ_VERSION); }