コード例 #1
0
ファイル: ypserv_proc.c プロジェクト: andreiw/polaris
void
ypoldnext(SVCXPRT *transp)
{
	bool dbmop_ok = TRUE;
	struct yprequest req;
	struct ypresponse resp;
	char *fun = "ypoldnext";
	DBM *fdb;

	memset((void *) &req, 0, sizeof (req));
	memset((void *) &resp, 0, sizeof (resp));

	if (!svc_getargs(transp,
				(xdrproc_t)_xdr_yprequest,
				(caddr_t)&req)) {
		svcerr_decode(transp);
		return;
	}

	if (req.yp_reqtype != YPNEXT_REQTYPE) {
		resp.ypnext_resp_status = (unsigned)YP_BADARGS;
		dbmop_ok = FALSE;
	}

	if (dbmop_ok &&
		((fdb = ypset_current_map(req.ypnext_req_map,
					req.ypnext_req_domain,
					&resp.ypnext_resp_status)) != NULL &&
		yp_map_access(transp, &resp.ypnext_resp_status, fdb))) {

		resp.ypnext_resp_keydat = dbm_nextkey(fdb);

		if (resp.ypnext_resp_keyptr != NULL) {
			resp.ypnext_resp_valdat =
			dbm_fetch(fdb, resp.ypnext_resp_keydat);

			if (resp.ypnext_resp_valptr != NULL) {
				resp.ypnext_resp_status = YP_TRUE;
			} else {
				resp.ypnext_resp_status = (unsigned)YP_BADDB;
			}
		} else {
			resp.ypnext_resp_status = (unsigned)YP_NOMORE;
		}
	}

	resp.yp_resptype = YPNEXT_RESPTYPE;

	if (!svc_sendreply(transp,
				(xdrproc_t)_xdr_ypresponse,
				(caddr_t)&resp)) {
		RESPOND_ERR;
	}

	if (!svc_freeargs(transp,
				(xdrproc_t)_xdr_yprequest,
				(caddr_t)&req)) {
		FREE_ERR;
	}
}
コード例 #2
0
ファイル: scsi_svc.c プロジェクト: LFenske/LFscsi
static void
scsi_prog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		send_cdb_params send_cdb_1_arg;
		char *reset_1_arg;
	} argument;
	char *result;
	xdrproc_t xdr_argument, xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case SEND_CDB:
		xdr_argument = (xdrproc_t) xdr_send_cdb_params;
		xdr_result = (xdrproc_t) xdr_send_cdb_retval;
		local = (char *(*)(char *, struct svc_req *)) send_cdb_1_svc;
		break;

	case RESET:
		xdr_argument = (xdrproc_t) xdr_wrapstring;
		xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) reset_1_svc;
		break;

	default:
		svcerr_noproc(transp);
		return;
	}
	if (USE_CHILDREN) {
		pid_t pid;
		pid = fork();
		if (pid > 0)
			return;
		if (pid < 0) {
			perror("fork");
			return;
		}
	}
	(void) memset((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
		svcerr_decode(transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
		svcerr_systemerr(transp);
	}
	if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
		fprintf(stderr, "unable to free arguments");
		exit(1);
	}
	if (USE_CHILDREN)
		_exit(0);
	else
		return;
}
コード例 #3
0
ファイル: rdict_svc.c プロジェクト: Antonhansel/CS435
static void
rdictprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		char *insertw_1_arg;
		char *deletew_1_arg;
		char *lookupw_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case INITW:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) initw_1_svc;
		break;

	case INSERTW:
		_xdr_argument = (xdrproc_t) xdr_wrapstring;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) insertw_1_svc;
		break;

	case DELETEW:
		_xdr_argument = (xdrproc_t) xdr_wrapstring;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) deletew_1_svc;
		break;

	case LOOKUPW:
		_xdr_argument = (xdrproc_t) xdr_wrapstring;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) lookupw_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #4
0
ファイル: ypserv_proc.c プロジェクト: andreiw/polaris
/*
 * This implements the yp "get next" function.
 */
void
ypnext(SVCXPRT *transp)
{
	struct ypreq_key req;
	struct ypresp_key_val resp;
	char *fun = "ypnext";
	DBM *fdb;

	memset(&req, 0, sizeof (req));
	memset(&resp, 0, sizeof (resp));

	if (!svc_getargs(transp, (xdrproc_t)xdr_ypreq_key, (char *)&req)) {
		svcerr_decode(transp);
		return;
	}

	if ((fdb = ypset_current_map(req.map, req.domain,
					&resp.status)) != NULL &&
		yp_map_access(transp, &resp.status, fdb)) {
		ypfilter(fdb, &req.keydat,
			&resp.keydat, &resp.valdat, &resp.status, FALSE);
	}

	if (!svc_sendreply(transp,
				(xdrproc_t)xdr_ypresp_key_val,
				(char *)&resp)) {
		RESPOND_ERR;
	}

	if (!svc_freeargs(transp,
				(xdrproc_t)xdr_ypreq_key,
				(char *)&req)) {
		FREE_ERR;
	}
}
コード例 #5
0
ファイル: ldm_server.c プロジェクト: khallock/LDM
int *is_alive_6_svc(
        unsigned *id,
        struct svc_req *rqstp)
{
    static int alive;
    SVCXPRT * const xprt = rqstp->rq_xprt;
    int error = 0;

    alive = cps_contains((pid_t) *id);

    if (ulogIsDebug()) {
        udebug("LDM %u is %s", *id, alive ? "alive" : "dead");
    }

    if (!svc_sendreply(xprt, (xdrproc_t) xdr_bool, (caddr_t) &alive)) {
        svcerr_systemerr(xprt);

        error = 1;
    }

    if (!svc_freeargs(xprt, xdr_u_int, (caddr_t)id)) {
        uerror("Couldn't free arguments");

        error = 1;
    }

    svc_destroy(xprt);
    exit(error);

    /*NOTREACHED*/

    return NULL ;
}
コード例 #6
0
ファイル: centro_svc.c プロジェクト: ale7714/redes-proyecto2
/*  Función: centro_prog_1
    Entrada:
        rqstp: Apuntador a la structura svc_req
        transp: Apuntador al registro SVCXPRT
    Salida:
        N/A 
    Función que gestiona las funciones del RPC del lado del servidor
*/
static void centro_prog_1(struct svc_req *rqstp, register SVCXPRT *transp){

	union {
		datos solicitar_desafio_1_arg;
		datos respodnder_desafio_1_arg;
		char *solicitar_tiempo_1_arg;
		char *solicitar_gasolina_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case SOLICITAR_DESAFIO:
		_xdr_argument = (xdrproc_t) xdr_datos;
		_xdr_result = (xdrproc_t) xdr_wrapstring;
		local = (char *(*)(char *, struct svc_req *)) solicitar_desafio_1_svc;
		break;

	case RESPODNDER_DESAFIO:
		_xdr_argument = (xdrproc_t) xdr_datos;
		_xdr_result = (xdrproc_t) xdr_wrapstring;
		local = (char *(*)(char *, struct svc_req *)) respodnder_desafio_1_svc;
		break;

	case SOLICITAR_TIEMPO:
		_xdr_argument = (xdrproc_t) xdr_wrapstring;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) solicitar_tiempo_1_svc;
		break;

	case SOLICITAR_GASOLINA:
		_xdr_argument = (xdrproc_t) xdr_wrapstring;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) solicitar_gasolina_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #7
0
ファイル: mountd.c プロジェクト: andreiw/polaris
/*
 * Remove an entry from mounted list
 */
static void
umount(struct svc_req *rqstp)
{
	char *host, *path, *remove_path;
	char rpath[MAXPATHLEN];
	struct nd_hostservlist *clnames = NULL;
	SVCXPRT *transp;
	struct netbuf *nb;

	transp = rqstp->rq_xprt;
	path = NULL;
	if (!svc_getargs(transp, xdr_dirpath, (caddr_t)&path)) {
		svcerr_decode(transp);
		return;
	}
	errno = 0;
	if (!svc_sendreply(transp, xdr_void, (char *)NULL))
		log_cant_reply(transp);

	getclientsnames(transp, &nb, &clnames);
	if (clnames == NULL) {
		/*
		 * Without the hostname we can't do audit or delete
		 * this host from the mount entries.
		 */
		svc_freeargs(transp, xdr_dirpath, (caddr_t)&path);
		return;
	}
	host = clnames->h_hostservs[0].h_host;

	if (verbose)
		syslog(LOG_NOTICE, "UNMOUNT: %s unmounted %s", host, path);

	audit_mountd_umount(host, path);

	remove_path = rpath;	/* assume we will use the cannonical path */
	if (realpath(path, rpath) == NULL) {
		if (verbose)
			syslog(LOG_WARNING, "UNMOUNT: realpath: %s: %m ", path);
		remove_path = path;	/* use path provided instead */
	}

	mntlist_delete(host, remove_path);	/* remove from mount list */

	svc_freeargs(transp, xdr_dirpath, (caddr_t)&path);
	netdir_free(clnames, ND_HOSTSERVLIST);
}
コード例 #8
0
//****************************************//
//***       Dispatch Function          ***//
//****************************************//
static void exm_proc(struct svc_req *rqstp, SVCXPRT *transp)
{
	//printf("* in Dispatch Func.\n");
	union {
		int varIn;
	} argument;

	char *result;
	xdrproc_t xdr_argument;
	xdrproc_t xdr_result;
	char *(*proc)(char *);

	switch (rqstp->rq_proc)
	{
		case PROCSIMPLEPING:
		{
			//printf("** in PROCPONG dispatch Func.\n");
			xdr_argument = (xdrproc_t)xdr_int;
			xdr_result   = (xdrproc_t)xdr_int;
			proc         = (char *(*)(char *))simplePing;
			break;
		}
		case PROGSYSERROR:
		{
			//Simulate an error
			svcerr_systemerr(transp);
			return;
		}
		case PROGAUTHERROR:
		{
			//Simulate an authentification error
			svcerr_weakauth(transp);
			return;
		}
		default:
		{
			//Proc is unavaible
      		svcerr_noproc(transp);
      		return;
      	}
	}
	memset((char *)&argument, (int)0, sizeof(argument));
	if (svc_getargs(transp, xdr_argument, (char *)&argument) == FALSE)
	{
		svcerr_decode(transp);
		return;
	}

	result = (char *)(*proc)((char *)&argument);

	if ((result != NULL) && (svc_sendreply(transp, xdr_result, (char *)result) == FALSE))
	{
		svcerr_systemerr(transp);
	}
	if (svc_freeargs(transp, xdr_argument, (char *)&argument) == FALSE) {
		(void)fprintf(stderr, "unable to free arguments\n");
		exit(1);
	}
}
コード例 #9
0
ファイル: hw7_svc.c プロジェクト: hne3/OS
static void
serverprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		int get_1_arg;
		Message put_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case get:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) get_1_svc;
		break;

	case put:
		_xdr_argument = (xdrproc_t) xdr_Message;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) put_1_svc;
		break;

	case initialize:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) initialize_1_svc;
		break;

	case teardown:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) teardown_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #10
0
void
l2tp_event_prog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		l2tp_session_ppp_updown_ind_1_argument l2tp_session_ppp_updown_ind_1_arg;
		l2tp_session_ppp_status_ind_1_argument l2tp_session_ppp_status_ind_1_arg;
		l2tp_session_ppp_accm_ind_1_argument l2tp_session_ppp_accm_ind_1_arg;
	} argument;
	union {
	} result;
	bool_t retval;
	xdrproc_t _xdr_argument, _xdr_result;
	bool_t (*local)(char *, void *, struct svc_req *);

	if (l2tp_api_rpc_check_request(transp) < 0) return; switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case L2TP_SESSION_PPP_UPDOWN_IND:
		_xdr_argument = (xdrproc_t) xdr_l2tp_session_ppp_updown_ind_1_argument;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_ppp_updown_ind_1;
		break;

	case L2TP_SESSION_PPP_STATUS_IND:
		_xdr_argument = (xdrproc_t) xdr_l2tp_session_ppp_status_ind_1_argument;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_ppp_status_ind_1;
		break;

	case L2TP_SESSION_PPP_ACCM_IND:
		_xdr_argument = (xdrproc_t) xdr_l2tp_session_ppp_accm_ind_1_argument;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_ppp_accm_ind_1;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
	if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		syslog (LOG_ERR, "%s", "unable to free arguments");
		exit (1);
	}
	if (!l2tp_event_prog_1_freeresult (transp, _xdr_result, (caddr_t) &result))
		syslog (LOG_ERR, "%s", "unable to free results");

	return;
}
コード例 #11
0
ファイル: notifyme.c プロジェクト: Unidata/LDM
/*
 * The RPC dispatch routine for this program.
 * Registered as a callback by svc_register() below.
 * Note that only NULLPROC and NOTIFICATION rpc procs are
 * handled by this program.
 */
static void
notifymeprog_5(struct svc_req *rqstp, SVCXPRT *transp)
{
        prod_info notice;

        switch (rqstp->rq_proc) {

        case NULLPROC:
                (void)svc_sendreply(transp, (xdrproc_t)xdr_void, (caddr_t)NULL);
                return;

        case NOTIFICATION:
                (void) memset((char*)&notice, 0, sizeof(notice));
                if (!svc_getargs(transp, (xdrproc_t)xdr_prod_info,
                    (caddr_t)&notice))
                {
                        svcerr_decode(transp);
                        return;
                }

                (void)exitIfDone(0);

                /*
                 * Update the request filter with the timestamp
                 * we just recieved.
                 * N.B.: There can still be duplicates after
                 * a reconnect.
                 */
                clss.from = notice.arrival;
                timestamp_incr(&clss.from);


                /* 
                 * your code here, example just logs it 
                 */
                log_info_q("%s", s_prod_info(NULL, 0, &notice,
                        log_is_enabled_debug));


                if(!svc_sendreply(transp, (xdrproc_t)xdr_ldm_replyt,
                    (caddr_t) &reply))
                {
                        svcerr_systemerr(transp);
                }

                (void)exitIfDone(0);

                if(!svc_freeargs(transp, xdr_prod_info, (caddr_t) &notice)) {
                        log_error_q("unable to free arguments");
                        exit(1);
                }
                /* no break */

        default:
                svcerr_noproc(transp);
                return;
        }
}
コード例 #12
0
static void
numeradorcliente_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		int devolveridcliente_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case OBTENERIDCLIENTE:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_retorno;
		local = (char *(*)(char *, struct svc_req *)) obteneridcliente_1_svc;
		break;

	case DEVOLVERIDCLIENTE:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) devolveridcliente_1_svc;
		break;

	case RESETEARCLIENTES:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) resetearclientes_1_svc;
		break;

	case LISTADOCLIENTES:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_retorno;
		local = (char *(*)(char *, struct svc_req *)) listadoclientes_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #13
0
static void
universal (struct svc_req *rqstp, SVCXPRT *transp_l)
{
  int prog, proc;
  char *outdata;
  char xdrbuf[UDPMSGSIZE];
  struct proglst_ *pl;
  char *buf = NULL;

  /*
   * enforce "procnum 0 is echo" convention
   */
  if (rqstp->rq_proc == NULLPROC)
    {
      if (svc_sendreply (transp_l, (xdrproc_t)xdr_void, (char *) NULL) == FALSE)
	{
	  write (STDERR_FILENO, "xxx\n", 4);
	  exit (1);
	}
      return;
    }
  prog = rqstp->rq_prog;
  proc = rqstp->rq_proc;
  for (pl = proglst; pl != NULL; pl = pl->p_nxt)
    if (pl->p_prognum == prog && pl->p_procnum == proc)
      {
	/* decode arguments into a CLEAN buffer */
	memset (xdrbuf, 0, sizeof (xdrbuf));	/* required ! */
	if (!svc_getargs (transp_l, pl->p_inproc, xdrbuf))
	  {
	    svcerr_decode (transp_l);
	    return;
	  }
	outdata = (*(pl->p_progname)) (xdrbuf);
	if (outdata == NULL && pl->p_outproc != (xdrproc_t)xdr_void)
	  /* there was an error */
	  return;
	if (!svc_sendreply (transp_l, pl->p_outproc, outdata))
	  {
	    (void) asprintf (&buf,
			       _("trouble replying to prog %d\n"),
			       pl->p_prognum);
	    exit (1);
	  }
	/* free the decoded arguments */
	(void) svc_freeargs (transp_l, pl->p_inproc, xdrbuf);
	return;
      }
  (void) asprintf (&buf, _("never registered prog %d\n"), prog);
#ifdef USE_IN_LIBIO
  if (_IO_fwide (stderr, 0) > 0)
    __fwprintf (stderr, L"%s", buf);
  else
#endif
    fputs (buf, stderr);
  free (buf);
  exit (1);
}
コード例 #14
0
ファイル: calc_svc.c プロジェクト: matheusdarosa/CBCAST
static void
calcula_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		int start_servers_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case START_SERVERS:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) start_servers_1_svc;
		break;

	case PASS_TOKEN:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) pass_token_1_svc;
		break;

	case P:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) p_1_svc;
		break;

	case V:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) v_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #15
0
ファイル: svc_simple.c プロジェクト: OSLL/elfperf
static void
universal (struct svc_req *rqstp, SVCXPRT *transp_l)
{
  int prog, proc;
  char *outdata;
  char xdrbuf[UDPMSGSIZE];
  struct proglst_ *pl;
  char *buf = NULL;

  /*
   * enforce "procnum 0 is echo" convention
   */
  if (rqstp->rq_proc == NULLPROC)
    {
      if (INTUSE(svc_sendreply) (transp_l, (xdrproc_t)INTUSE(xdr_void),
				 (char *) NULL) == FALSE)
	{
	  __write (STDERR_FILENO, "xxx\n", 4);
	  exit (1);
	}
      return;
    }
  prog = rqstp->rq_prog;
  proc = rqstp->rq_proc;
  for (pl = proglst; pl != NULL; pl = pl->p_nxt)
    if (pl->p_prognum == prog && pl->p_procnum == proc)
      {
	/* decode arguments into a CLEAN buffer */
	__bzero (xdrbuf, sizeof (xdrbuf));	/* required ! */
	if (!svc_getargs (transp_l, pl->p_inproc, xdrbuf))
	  {
	    INTUSE(svcerr_decode) (transp_l);
	    return;
	  }
	outdata = (*(pl->p_progname)) (xdrbuf);
	if (outdata == NULL && pl->p_outproc != (xdrproc_t)INTUSE(xdr_void))
	  /* there was an error */
	  return;
	if (!INTUSE(svc_sendreply) (transp_l, pl->p_outproc, outdata))
	  {
	    if (__asprintf (&buf, _("trouble replying to prog %d\n"),
			    pl->p_prognum) < 0)
	      buf = NULL;
	    goto err_out2;
	  }
	/* free the decoded arguments */
	(void) svc_freeargs (transp_l, pl->p_inproc, xdrbuf);
	return;
      }
  if (__asprintf (&buf, _("never registered prog %d\n"), prog) < 0)
    buf = NULL;
 err_out2:
  if (buf == NULL)
    exit (1);
  __fxprintf (NULL, "%s", buf);
  free (buf);
  exit (1);
}
コード例 #16
0
void
storcli_program_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		storcli_write_arg_t storcli_write_1_arg;
		storcli_read_arg_t storcli_read_1_arg;
		storcli_truncate_arg_t storcli_truncate_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case STORCLI_NULL:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) storcli_null_1_svc;
		break;

	case STORCLI_WRITE:
		_xdr_argument = (xdrproc_t) xdr_storcli_write_arg_t;
		_xdr_result = (xdrproc_t) xdr_storcli_status_ret_t;
		local = (char *(*)(char *, struct svc_req *)) storcli_write_1_svc;
		break;

	case STORCLI_READ:
		_xdr_argument = (xdrproc_t) xdr_storcli_read_arg_t;
		_xdr_result = (xdrproc_t) xdr_storcli_read_ret_t;
		local = (char *(*)(char *, struct svc_req *)) storcli_read_1_svc;
		break;

	case STORCLI_TRUNCATE:
		_xdr_argument = (xdrproc_t) xdr_storcli_truncate_arg_t;
		_xdr_result = (xdrproc_t) xdr_storcli_status_ret_t;
		local = (char *(*)(char *, struct svc_req *)) storcli_truncate_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #17
0
ファイル: ypserv_proc.c プロジェクト: andreiw/polaris
void
ypoldget(SVCXPRT *transp)
{
	struct yprequest req;
	struct ypresp_val resp;
	pid_t pid = -1;
	char *fun = "ypoldget";
	DBM *fdb;

	memset((void *) &req, 0, sizeof (req));

	if (!svc_getargs(transp,
				(xdrproc_t)_xdr_yprequest,
				(caddr_t)&req)) {
		svcerr_decode(transp);
		return;
	}

	if (!svc_sendreply(transp, xdr_void, 0)) {
		RESPOND_ERR;
	}

	if (req.yp_reqtype == YPGET_REQTYPE) {

		if (((fdb = ypset_current_map(req.ypget_req_map,
						req.ypget_req_domain,
						&resp.status)) == NULL) ||
			(yp_map_access(transp, &resp.status, fdb))) {

			pid = vfork();
		}

		if (pid == -1) {
			FORK_ERR;
		} else if (pid == 0) {

			ypclr_current_map();

			if (execl(ypxfr_proc, "ypxfr", "-d",
					req.ypget_req_domain, "-h",
					req.ypget_req_owner,
					req.ypget_req_map, NULL)) {

				EXEC_ERR;
			}
			_exit(1);
		}
	}

	if (!svc_freeargs(transp,
				(xdrproc_t)_xdr_yprequest,
				(caddr_t)&req)) {
		RESPOND_ERR;
	}
}
コード例 #18
0
ファイル: calccomplexe_svc.c プロジェクト: jianfeipan/TB
static void
calccompprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		complexe add_1_arg;
		complexe mul_1_arg;
		complexe init_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case ADD:
		_xdr_argument = (xdrproc_t) xdr_complexe;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) add_1_svc;
		break;

	case MUL:
		_xdr_argument = (xdrproc_t) xdr_complexe;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) mul_1_svc;
		break;

	case INIT:
		_xdr_argument = (xdrproc_t) xdr_complexe;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) init_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #19
0
ファイル: geometrie_svc.c プロジェクト: Doelia/M1-Semestre1
static void
geom_prog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		rectangle surface_rectangle_1_arg;
		coordonnees creer_rectangle_1_arg;
		param_inclus inclus_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case SURFACE_RECTANGLE:
		_xdr_argument = (xdrproc_t) xdr_rectangle;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) surface_rectangle_1_svc;
		break;

	case CREER_RECTANGLE:
		_xdr_argument = (xdrproc_t) xdr_coordonnees;
		_xdr_result = (xdrproc_t) xdr_rectangle;
		local = (char *(*)(char *, struct svc_req *)) creer_rectangle_1_svc;
		break;

	case INCLUS:
		_xdr_argument = (xdrproc_t) xdr_param_inclus;
		_xdr_result = (xdrproc_t) xdr_booleen;
		local = (char *(*)(char *, struct svc_req *)) inclus_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #20
0
ファイル: bank_svc.c プロジェクト: AmeyRuikar/RPC
static void
bank_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		usr_pass init_1_arg;
		usr_pass verify_1_arg;
		double balance_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case INIT:
		_xdr_argument = (xdrproc_t) xdr_usr_pass;
		_xdr_result = (xdrproc_t) xdr_double;
		local = (char *(*)(char *, struct svc_req *)) init_1_svc;
		break;

	case VERIFY:
		_xdr_argument = (xdrproc_t) xdr_usr_pass;
		_xdr_result = (xdrproc_t) xdr_double;
		local = (char *(*)(char *, struct svc_req *)) verify_1_svc;
		break;

	case BALANCE:
		_xdr_argument = (xdrproc_t) xdr_double;
		_xdr_result = (xdrproc_t) xdr_double;
		local = (char *(*)(char *, struct svc_req *)) balance_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #21
0
ファイル: smoker_svc.c プロジェクト: wesrupert/eecs338
static void
smoker_prog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		struct smoker_id smoker_start_1_arg;
		struct smoker_info smoker_proc_1_arg;
		struct smoker_id smoker_exit_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case SMOKER_START:
		_xdr_argument = (xdrproc_t) xdr_smoker_id;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) smoker_start_1_svc;
		break;

	case SMOKER_PROC:
		_xdr_argument = (xdrproc_t) xdr_smoker_info;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) smoker_proc_1_svc;
		break;

	case SMOKER_EXIT:
		_xdr_argument = (xdrproc_t) xdr_smoker_id;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) smoker_exit_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #22
0
ファイル: ldm_svc.c プロジェクト: rmlawton/LDM
void
ldmprog_7(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		char subscribe_7_arg;
		VcmtpFileId request_product_7_arg;
		MissedProduct deliver_product_7_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case SUBSCRIBE:
		_xdr_argument = (xdrproc_t) xdr_char;
		_xdr_result = (xdrproc_t) xdr_SubscriptionReply;
		local = (char *(*)(char *, struct svc_req *)) subscribe_7_svc;
		break;

	case REQUEST_PRODUCT:
		_xdr_argument = (xdrproc_t) xdr_VcmtpFileId;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) request_product_7_svc;
		break;

	case DELIVER_PRODUCT:
		_xdr_argument = (xdrproc_t) xdr_MissedProduct;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) deliver_product_7_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #23
0
ファイル: train_svc.c プロジェクト: ccruzp/Redes
static void
train_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		seat is_seat_taken_1_arg;
		seat reserve_seat_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case is_wagon_full:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) is_wagon_full_1_svc;
		break;

	case is_seat_taken:
		_xdr_argument = (xdrproc_t) xdr_seat;
		_xdr_result = (xdrproc_t) xdr_available;
		local = (char *(*)(char *, struct svc_req *)) is_seat_taken_1_svc;
		break;

	case reserve_seat:
		_xdr_argument = (xdrproc_t) xdr_seat;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) reserve_seat_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #24
0
ファイル: bootparam_prot_svc.c プロジェクト: andreiw/polaris
static void
bootparamprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		bp_whoami_arg bootparamproc_whoami_1_arg;
		bp_getfile_arg bootparamproc_getfile_1_arg;
	} argument;
	char *result;
	bool_t (*xdr_argument)(), (*xdr_result)();
	char *(*local)();

	_rpcsvcdirty = 1;
	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply(transp, xdr_void, (char *)NULL);
		_rpcsvcdirty = 0;
		return;

	case BOOTPARAMPROC_WHOAMI:
		xdr_argument = xdr_bp_whoami_arg;
		xdr_result = xdr_bp_whoami_res;
		local = (char *(*)()) bootparamproc_whoami_1;
		break;

	case BOOTPARAMPROC_GETFILE:
		xdr_argument = xdr_bp_getfile_arg;
		xdr_result = xdr_bp_getfile_res;
		local = (char *(*)()) bootparamproc_getfile_1;
		break;

	default:
		svcerr_noproc(transp);
		_rpcsvcdirty = 0;
		return;
	}
	(void) memset((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs(transp, xdr_argument, (caddr_t)&argument)) {
		svcerr_decode(transp);
		_rpcsvcdirty = 0;
		return;
	}
	result = (*local)(&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
		svcerr_systemerr(transp);
	}
	if (!svc_freeargs(transp, xdr_argument, (caddr_t)&argument)) {
		msgout("unable to free arguments");
		exit(EXIT_FAILURE);
	}
	_rpcsvcdirty = 0;
}
コード例 #25
0
void torredecontrolprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{

   
	union {
		Operandos asignar_vuelo_1_arg;
		int desasignar_vuelo_1_arg;
		int get_zona_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case ASIGNAR_VUELO:
		_xdr_argument = (xdrproc_t) xdr_Operandos;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) asignar_vuelo_1_svc;
		break;

	case DESASIGNAR_VUELO:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) desasignar_vuelo_1_svc;
		break;

	case GET_ZONA:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) get_zona_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}
コード例 #26
0
ファイル: ypserv_proc.c プロジェクト: andreiw/polaris
void
ypoldpush(SVCXPRT *transp)
{
	struct yprequest req;
	struct ypresp_val resp;
	pid_t pid = -1;
	char *fun = "ypoldpush";
	DBM *fdb;

	memset((void *) &req, 0, sizeof (req));

	if (!svc_getargs(transp,
				(xdrproc_t)_xdr_yprequest,
				(caddr_t)&req)) {
		svcerr_decode(transp);
		return;
	}

	if (((fdb = ypset_current_map(req.yppush_req_map,
					req.yppush_req_domain,
					&resp.status)) != NULL) &&
		(yp_map_access(transp, &resp.status, fdb))) {

		pid = vfork();
	}

	if (pid == -1) {
		FORK_ERR;
	} else if (pid == 0) {
		ypclr_current_map();

		if (execl(yppush_proc, "yppush", "-d", req.yppush_req_domain,
				req.yppush_req_map, NULL)) {
			EXEC_ERR;
		}
		_exit(1);
	}

	if (!svc_sendreply(transp,
				(xdrproc_t)xdr_void,
				(caddr_t)NULL)) {
		RESPOND_ERR;
	}

	if (!svc_freeargs(transp,
				(xdrproc_t)_xdr_yprequest,
				(caddr_t)&req)) {
		FREE_ERR;
	}
}
コード例 #27
0
ファイル: svc.c プロジェクト: shubmit/shub-ltp
//****************************************//
//***       Dispatch Function          ***//
//****************************************//
void rcp_service(register struct svc_req *rqstp, register SVCXPRT *transp)
{
	char *result;
	xdrproc_t xdr_argument;
	xdrproc_t xdr_result;
	char *(*proc)(int , SVCXPRT *);
	int test_status = 1;

    switch (rqstp->rq_proc)
    {
		case PROCSIMPLEPING:
		{
			//printf("** in PROCPONG dispatch Func.\n");
			xdr_argument = (xdrproc_t)xdr_int;
			xdr_result   = (xdrproc_t)xdr_int;
			proc         = (char *(*)(int, SVCXPRT *))simplePing;
			break;
		}
    }

    memset((char *)&argument, (int)0, sizeof(argument));
	if (svc_getargs(transp, xdr_argument, (char *)&argument) == FALSE)
	{
		svcerr_decode(transp);
		return;
	}

	result = (char *)(*proc)(argument, transp);

	if ((result != NULL) && (svc_sendreply(transp, xdr_result, result) == FALSE))
	{
		svcerr_systemerr(transp);
	}
	if (svc_freeargs(transp, xdr_argument, (char *)&argument) == FALSE)
	{
		//Test has failed
		test_status = 1;
	}
	else
	{
		//Test succeeds
		test_status = 0;
	}

	//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);

	exit (test_status);
}
コード例 #28
0
ファイル: svc_simple.c プロジェクト: ArmstrongJ/MiNTLib
static void
universal (struct svc_req *rqstp, SVCXPRT *transp)
{
  int prog, proc;
  char *outdata;
  char xdrbuf[UDPMSGSIZE];
  struct proglst *pl;

  /*
   * enforce "procnum 0 is echo" convention
   */
  if (rqstp->rq_proc == NULLPROC)
    {
      if (svc_sendreply (transp, (xdrproc_t)xdr_void, (char *) NULL) == FALSE)
	{
	  (void) fprintf (stderr, "xxx\n");
	  exit (1);
	}
      return;
    }
  prog = rqstp->rq_prog;
  proc = rqstp->rq_proc;
  for (pl = proglst; pl != NULL; pl = pl->p_nxt)
    if (pl->p_prognum == prog && pl->p_procnum == proc)
      {
	/* decode arguments into a CLEAN buffer */
	__bzero (xdrbuf, sizeof (xdrbuf));	/* required ! */
	if (!svc_getargs (transp, pl->p_inproc, xdrbuf))
	  {
	    svcerr_decode (transp);
	    return;
	  }
	outdata = (*(pl->p_progname)) (xdrbuf);
	if (outdata == NULL && pl->p_outproc != (xdrproc_t)xdr_void)
	  /* there was an error */
	  return;
	if (!svc_sendreply (transp, pl->p_outproc, outdata))
	  {
	    (void) fprintf (stderr,
			    _ ("trouble replying to prog %d\n"),
			    pl->p_prognum);
	    exit (1);
	  }
	/* free the decoded arguments */
	(void) svc_freeargs (transp, pl->p_inproc, xdrbuf);
	return;
      }
  (void) fprintf (stderr, _ ("never registered prog %d\n"), prog);
  exit (1);
}
コード例 #29
0
ファイル: stub_svc.c プロジェクト: carriercomm/DPDK-Graph
static void
osdprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		data_arg date_write_1_arg;
		data_req date_read_1_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case DATE_WRITE:
		_xdr_argument = (xdrproc_t) xdr_data_arg;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) date_write_1_svc;
		break;

	case DATE_READ:
		_xdr_argument = (xdrproc_t) xdr_data_req;
		_xdr_result = (xdrproc_t) xdr_data_arg;
		local = (char *(*)(char *, struct svc_req *)) date_read_1_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}

	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	free(result);
	return;
}
コード例 #30
0
ファイル: ldm_server.c プロジェクト: khallock/LDM
/**
 * Notifies a downstream LDM of subscribed-to data-products.
 * <p>
 * This function will not normally return unless the request necessitates a
 * reply (e.g., RECLASS).
 */
fornme_reply_t *notifyme_6_svc(
        prod_class_t* want,
        struct svc_req* rqstp)
{
    SVCXPRT* const xprt = rqstp->rq_xprt;
    fornme_reply_t* reply = feed_or_notify(xprt, want, 1, 0);

    if (!svc_freeargs(xprt, xdr_prod_class, (caddr_t)want)) {
        uerror("Couldn't free arguments");
        svc_destroy(xprt);
        exit(1);
    }

    return reply;
}