require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NETINET_IP_PROXY_H_)) {
    eval 'sub _NETINET_IP_PROXY_H_ () {1;}' unless defined(&_NETINET_IP_PROXY_H_);
    unless(defined(&SOLARIS)) {
	if((defined(&sun)  && (defined(&__svr4__) || defined(&__SVR4)))) {
	    eval 'sub SOLARIS () {1;}' unless defined(&SOLARIS);
	} else {
	    eval 'sub SOLARIS () {0;}' unless defined(&SOLARIS);
	}
    }
    if(defined(&__STDC__) || defined(&__GNUC__) || defined(&_AIX51)) {
	eval 'sub SIOCPROXY () { &_IOWR(ord(\'r\'), 64, \'struct ap_control\');}' unless defined(&SIOCPROXY);
    } else {
	eval 'sub SIOCPROXY () { &_IOWR("r", 64, \'struct ap_control\');}' unless defined(&SIOCPROXY);
    }
    unless(defined(&APR_LABELLEN)) {
	eval 'sub APR_LABELLEN () {16;}' unless defined(&APR_LABELLEN);
    }
    eval 'sub AP_SESS_SIZE () {53;}' unless defined(&AP_SESS_SIZE);
    eval 'sub aps_sport () { ($aps_un->{apu_tcp}->{apt_sport});}' unless defined(&aps_sport);
    eval 'sub aps_dport () { ($aps_un->{apu_tcp}->{apt_dport});}' unless defined(&aps_dport);
    eval 'sub aps_sel () { ($aps_un->{apu_tcp}->{apt_sel});}' unless defined(&aps_sel);
    eval 'sub aps_seqoff () { ($aps_un->{apu_tcp}->{apt_seqoff});}' unless defined(&aps_seqoff);
    eval 'sub aps_seqmin () { ($aps_un->{apu_tcp}->{apt_seqmin});}' unless defined(&aps_seqmin);
    eval 'sub aps_state () { ($aps_un->{apu_tcp}->{apt_state});}' unless defined(&aps_state);
    eval 'sub aps_ackoff () { ($aps_un->{apu_tcp}->{apt_ackoff});}' unless defined(&aps_ackoff);
    eval 'sub aps_ackmin () { ($aps_un->{apu_tcp}->{apt_ackmin});}' unless defined(&aps_ackmin);
    eval 'sub APC_CMD_ADD () {0;}' unless defined(&APC_CMD_ADD);
    eval 'sub APC_CMD_DEL () {1;}' unless defined(&APC_CMD_DEL);
    eval 'sub APR_DELETE () {1;}' unless defined(&APR_DELETE);
    eval 'sub APR_ERR {
        my($x) = @_;
	    eval q((($x) << 16));
    }' unless defined(&APR_ERR);
    eval 'sub APR_EXIT {
        my($x) = @_;
	    eval q(((($x) >> 16) & 0xffff));
    }' unless defined(&APR_EXIT);
    eval 'sub APR_INC {
        my($x) = @_;
	    eval q((($x) & 0xffff));
    }' unless defined(&APR_INC);
    if(defined(&_KERNEL)) {
	unless(defined(&isdigit)) {
	    eval 'sub isdigit {
	        my($x) = @_;
    		eval q((($x) >= ord(\'0\' && (x) <= \'9\')));
	    }' unless defined(&isdigit);
	}
	unless(defined(&isupper)) {
	    eval 'sub isupper {
	        my($x) = @_;
    		eval q((( >= ord(\'A\') && ((x) <= \'Z\'))));
	    }' unless defined(&isupper);
	}
	unless(defined(&islower)) {
	    eval 'sub islower {
	        my($x) = @_;
    		eval q((( >= ord(\'a\') && ((x) <= \'z\'))));
	    }' unless defined(&islower);
	}
	unless(defined(&isalpha)) {
	    eval 'sub isalpha {
	        my($x) = @_;
    		eval q(( &isupper($x) ||  &islower($x)));
	    }' unless defined(&isalpha);
	}
	unless(defined(&toupper)) {
	    eval 'sub toupper {
	        my($x) = @_;
    		eval q(( &isupper($x) ? ($x) : ($x) - ord(\'a\' + \'A\')));
	    }' unless defined(&toupper);
	}
	unless(defined(&isspace)) {
	    eval 'sub isspace {
	        my($x) = @_;
    		eval q(((($x) == ord(\' \') || ((x) == \'\\\\r\') || ((x) == \'\\\\n\') || 			 ((x) == \'\\\\t\') || ((x) == \'\\\\b\'))));
	    }' unless defined(&isspace);
	}
    }
    eval 'sub FTP_BUFSZ () {160;}' unless defined(&FTP_BUFSZ);
    eval 'sub IPF_FTPBUFSZ () {160;}' unless defined(&IPF_FTPBUFSZ);
    eval 'sub RA_ID_END () {0;}' unless defined(&RA_ID_END);
    eval 'sub RA_ID_UDP () {1;}' unless defined(&RA_ID_UDP);
    eval 'sub RA_ID_ROBUST () {7;}' unless defined(&RA_ID_ROBUST);
    eval 'sub RAP_M_UDP () {1;}' unless defined(&RAP_M_UDP);
    eval 'sub RAP_M_ROBUST () {2;}' unless defined(&RAP_M_ROBUST);
    eval 'sub RAP_M_TCP () {4;}' unless defined(&RAP_M_TCP);
    eval 'sub RAP_M_UDP_ROBUST () {( &RAP_M_UDP| &RAP_M_ROBUST);}' unless defined(&RAP_M_UDP_ROBUST);
    eval 'sub RPCB_MAXMSG () {888;}' unless defined(&RPCB_MAXMSG);
    eval 'sub RPCB_RES_PMAP () {0;}' unless defined(&RPCB_RES_PMAP);
    eval 'sub RPCB_RES_STRING () {1;}' unless defined(&RPCB_RES_STRING);
    eval 'sub RPCB_RES_LIST () {2;}' unless defined(&RPCB_RES_LIST);
    eval 'sub RPCB_MAXREQS () {32;}' unless defined(&RPCB_MAXREQS);
    eval 'sub RPCB_REQMIN () {40;}' unless defined(&RPCB_REQMIN);
    eval 'sub RPCB_REQMAX () {888;}' unless defined(&RPCB_REQMAX);
    eval 'sub RPCB_REPMIN () {20;}' unless defined(&RPCB_REPMIN);
    eval 'sub RPCB_REPMAX () {604;}' unless defined(&RPCB_REPMAX);
    eval 'sub RPCB_BUF_END {
        my($r) = @_;
	    eval q((($r)-> &rm_msgbuf + ($r)-> &rm_buflen));
    }' unless defined(&RPCB_BUF_END);
    eval 'sub RPCB_BUF_GEQ {
        my($r, $p, $l) = @_;
	    eval q((( &RPCB_BUF_END() > )  && (( &RPCB_BUF_END() - ($p)) >= ($l))));
    }' unless defined(&RPCB_BUF_GEQ);
    eval 'sub RPCB_BUF_EQ {
        my($r, $p, $l) = @_;
	    eval q(( &RPCB_BUF_END() == (($p) + ($l))));
    }' unless defined(&RPCB_BUF_EQ);
    eval 'sub RPCB_CALL () {0;}' unless defined(&RPCB_CALL);
    eval 'sub RPCB_REPLY () {1;}' unless defined(&RPCB_REPLY);
    eval 'sub RPCB_MSG_VERSION () {2;}' unless defined(&RPCB_MSG_VERSION);
    eval 'sub RPCB_PROG () {100000;}' unless defined(&RPCB_PROG);
    eval 'sub RPCB_GETPORT () {3;}' unless defined(&RPCB_GETPORT);
    eval 'sub RPCB_GETADDR () {3;}' unless defined(&RPCB_GETADDR);
    eval 'sub RPCB_GETADDRLIST () {11;}' unless defined(&RPCB_GETADDRLIST);
    eval 'sub RPCB_MSG_ACCEPTED () {0;}' unless defined(&RPCB_MSG_ACCEPTED);
    eval 'sub RPCB_MSG_DENIED () {1;}' unless defined(&RPCB_MSG_DENIED);
    eval 'sub xu_xslen () { ($xu_str->{xs_len});}' unless defined(&xu_xslen);
    eval 'sub xu_xsstr () { ($xu_str->{xs_str});}' unless defined(&xu_xsstr);
    eval 'sub xp_xslen () { ($xp_str->{xs_len});}' unless defined(&xp_xslen);
    eval 'sub xp_xsstr () { ($xp_str->{xs_str});}' unless defined(&xp_xsstr);
    eval 'sub rc_pmapargs () { ($rpcb_args->{ra_pmapargs});}' unless defined(&rc_pmapargs);
    eval 'sub rc_rpcbargs () { ($rpcb_args->{ra_rpcbargs});}' unless defined(&rc_rpcbargs);
    eval 'sub rr_v2 () { ($rpcb_reply->{resp_pmap});}' unless defined(&rr_v2);
    eval 'sub rr_v3 () { ($rpcb_reply->{resp_getaddr});}' unless defined(&rr_v3);
    eval 'sub rr_v4 () { ($rpcb_reply->{resp_getaddrlist});}' unless defined(&rr_v4);
    eval 'sub rm_call () { ($rm_body->{rb_call});}' unless defined(&rm_call);
    eval 'sub rm_resp () { ($rm_body->{rb_resp});}' unless defined(&rm_resp);
    eval 'sub XDRALIGN {
        my($x) = @_;
	    eval q((((($x) % 4) != 0) ? (((($x) + 3) / 4) * 4) : ($x)));
    }' unless defined(&XDRALIGN);
}
1;
