require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_RPC_SVC_H_)) {
    eval 'sub _RPC_SVC_H_ () {1;}' unless defined(&_RPC_SVC_H_);
    require 'sys/cdefs.ph';
    require 'sys/select.ph';
    require 'rpc/rpc_com.ph';
    eval 'sub SVCGET_VERSQUIET () {1;}' unless defined(&SVCGET_VERSQUIET);
    eval 'sub SVCSET_VERSQUIET () {2;}' unless defined(&SVCSET_VERSQUIET);
    eval 'sub SVCGET_CONNMAXREC () {3;}' unless defined(&SVCGET_CONNMAXREC);
    eval 'sub SVCSET_CONNMAXREC () {4;}' unless defined(&SVCSET_CONNMAXREC);
    eval("sub XPRT_DIED () { 0; }") unless defined(&XPRT_DIED);
    eval("sub XPRT_MOREREQS () { 1; }") unless defined(&XPRT_MOREREQS);
    eval("sub XPRT_IDLE () { 2; }") unless defined(&XPRT_IDLE);
    eval 'sub svc_getrpccaller {
        my($x) = @_;
	    eval q((($x)-> &xp_rtaddr));
    }' unless defined(&svc_getrpccaller);
    eval 'sub __svc_getcallercreds {
        my($x) = @_;
	    eval q((($x)-> &xp_p2));
    }' unless defined(&__svc_getcallercreds);
    eval 'sub SVC_RECV {
        my($xprt, $msg) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_recv}))(($xprt), ($msg)));
    }' unless defined(&SVC_RECV);
    eval 'sub svc_recv {
        my($xprt, $msg) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_recv}))(($xprt), ($msg)));
    }' unless defined(&svc_recv);
    eval 'sub SVC_STAT {
        my($xprt) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_stat}))($xprt));
    }' unless defined(&SVC_STAT);
    eval 'sub svc_stat {
        my($xprt) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_stat}))($xprt));
    }' unless defined(&svc_stat);
    eval 'sub SVC_GETARGS {
        my($xprt, $xargs, $argsp) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_getargs}))(($xprt), (( &xdrproc_t)($xargs)), ($argsp)));
    }' unless defined(&SVC_GETARGS);
    eval 'sub svc_getargs {
        my($xprt, $xargs, $argsp) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_getargs}))(($xprt), (( &xdrproc_t)($xargs)), ($argsp)));
    }' unless defined(&svc_getargs);
    eval 'sub SVC_REPLY {
        my($xprt, $msg) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_reply})) (($xprt), ($msg)));
    }' unless defined(&SVC_REPLY);
    eval 'sub svc_reply {
        my($xprt, $msg) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_reply})) (($xprt), ($msg)));
    }' unless defined(&svc_reply);
    eval 'sub SVC_FREEARGS {
        my($xprt, $xargs, $argsp) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_freeargs}))(($xprt), (( &xdrproc_t)($xargs)), ($argsp)));
    }' unless defined(&SVC_FREEARGS);
    eval 'sub svc_freeargs {
        my($xprt, $xargs, $argsp) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_freeargs}))(($xprt), (( &xdrproc_t)($xargs)), ($argsp)));
    }' unless defined(&svc_freeargs);
    eval 'sub SVC_DESTROY {
        my($xprt) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_destroy}))($xprt));
    }' unless defined(&SVC_DESTROY);
    eval 'sub svc_destroy {
        my($xprt) = @_;
	    eval q((*($xprt)-> ($xp_ops->{xp_destroy}))($xprt));
    }' unless defined(&svc_destroy);
    eval 'sub SVC_CONTROL {
        my($xprt, $rq, $in) = @_;
	    eval q((*($xprt)-> ($xp_ops2->{xp_control}))(($xprt), ($rq), ($in)));
    }' unless defined(&SVC_CONTROL);
    if(defined(&SVC_LEGACY)) {
    } else {
	eval 'sub svc_maxfd () {(* &svc_fdset_getmax());}' unless defined(&svc_maxfd);
	eval 'sub svc_fdset () {(* &svc_fdset_get());}' unless defined(&svc_fdset);
	eval 'sub svc_pollfd () { &svc_pollfd_get();}' unless defined(&svc_pollfd);
	eval 'sub svc_max_pollfd () {(* &svc_fdset_getmax());}' unless defined(&svc_max_pollfd);
    }
    eval 'sub svc_fds () { ($svc_fdset->{fds_bits[0]});}' unless defined(&svc_fds);
    eval 'sub SVC_FDSET_MT () {1;}' unless defined(&SVC_FDSET_MT);
    eval 'sub SVC_FDSET_POLL () {2;}' unless defined(&SVC_FDSET_POLL);
    eval 'sub RPC_ANYSOCK () {-1;}' unless defined(&RPC_ANYSOCK);
    eval 'sub RPC_ANYFD () { &RPC_ANYSOCK;}' unless defined(&RPC_ANYFD);
    require 'rpc/svc_soc.ph';
}
1;
