require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_NETINET_IN_PCB_H_)) {
    eval 'sub _NETINET_IN_PCB_H_ () {1;}' unless defined(&_NETINET_IN_PCB_H_);
    require 'sys/queue.ph';
    require 'netinet/ip6.ph';
    require 'netinet6/ip6_var.ph';
    require 'netinet/icmp6.ph';
    require 'netinet/ip_ipsp.ph';
    eval 'sub inp_faddr () { ($inp_faddru->{iau_a4u}->{inaddr});}' unless defined(&inp_faddr);
    eval 'sub inp_faddr6 () { ($inp_faddru->{iau_addr6});}' unless defined(&inp_faddr6);
    eval 'sub inp_laddr () { ($inp_laddru->{iau_a4u}->{inaddr});}' unless defined(&inp_laddr);
    eval 'sub inp_laddr6 () { ($inp_laddru->{iau_addr6});}' unless defined(&inp_laddr6);
    eval 'sub inp_route () { ($inp_ru->{ru_route});}' unless defined(&inp_route);
    eval 'sub inp_route6 () { ($inp_ru->{ru_route6});}' unless defined(&inp_route6);
    eval 'sub inp_ip () { ($inp_hu->{hu_ip});}' unless defined(&inp_ip);
    eval 'sub inp_ipv6 () { ($inp_hu->{hu_ipv6});}' unless defined(&inp_ipv6);
    eval 'sub inp_moptions () { ($inp_mou->{mou_mo});}' unless defined(&inp_moptions);
    eval 'sub inp_moptions6 () { ($inp_mou->{mou_mo6});}' unless defined(&inp_moptions6);
    eval 'sub SL_AUTH () {0;}' unless defined(&SL_AUTH);
    eval 'sub SL_ESP_TRANS () {1;}' unless defined(&SL_ESP_TRANS);
    eval 'sub SL_ESP_NETWORK () {2;}' unless defined(&SL_ESP_NETWORK);
    eval 'sub SL_IPCOMP () {3;}' unless defined(&SL_IPCOMP);
    eval 'sub SR_FAILED () {1;}' unless defined(&SR_FAILED);
    eval 'sub SR_SUCCESS () {2;}' unless defined(&SR_SUCCESS);
    eval 'sub SR_WAIT () {3;}' unless defined(&SR_WAIT);
    eval 'sub inp_flowinfo () { ($inp_hu->{hu_ipv6}->{ip6_flow});}' unless defined(&inp_flowinfo);
    unless(defined(&_KERNEL)) {
	eval 'sub inp_csumoffset () { &in6p_cksum;}' unless defined(&inp_csumoffset);
    }
    eval 'sub INP_RECVOPTS () {0x1;}' unless defined(&INP_RECVOPTS);
    eval 'sub INP_RECVRETOPTS () {0x2;}' unless defined(&INP_RECVRETOPTS);
    eval 'sub INP_RECVDSTADDR () {0x4;}' unless defined(&INP_RECVDSTADDR);
    eval 'sub INP_RXDSTOPTS () { &INP_RECVOPTS;}' unless defined(&INP_RXDSTOPTS);
    eval 'sub INP_RXHOPOPTS () { &INP_RECVRETOPTS;}' unless defined(&INP_RXHOPOPTS);
    eval 'sub INP_RXINFO () { &INP_RECVDSTADDR;}' unless defined(&INP_RXINFO);
    eval 'sub INP_RXSRCRT () {0x10;}' unless defined(&INP_RXSRCRT);
    eval 'sub INP_HOPLIMIT () {0x20;}' unless defined(&INP_HOPLIMIT);
    eval 'sub INP_HDRINCL () {0x8;}' unless defined(&INP_HDRINCL);
    eval 'sub INP_HIGHPORT () {0x10;}' unless defined(&INP_HIGHPORT);
    eval 'sub INP_LOWPORT () {0x20;}' unless defined(&INP_LOWPORT);
    eval 'sub INP_RECVIF () {0x80;}' unless defined(&INP_RECVIF);
    eval 'sub INP_RECVTTL () {0x40;}' unless defined(&INP_RECVTTL);
    eval 'sub INP_CONTROLOPTS () {( &INP_RECVOPTS| &INP_RECVRETOPTS| &INP_RECVDSTADDR|  &INP_RXSRCRT| &INP_HOPLIMIT| &INP_RECVIF| &INP_RECVTTL);}' unless defined(&INP_CONTROLOPTS);
    eval 'sub INP_IPV6 () {0x100;}' unless defined(&INP_IPV6);
    if(1) {
	eval 'sub IN6P_HIGHPORT () { &INP_HIGHPORT;}' unless defined(&IN6P_HIGHPORT);
	eval 'sub IN6P_LOWPORT () { &INP_LOWPORT;}' unless defined(&IN6P_LOWPORT);
	eval 'sub IN6P_PKTINFO () {0x10000;}' unless defined(&IN6P_PKTINFO);
	eval 'sub IN6P_HOPLIMIT () {0x20000;}' unless defined(&IN6P_HOPLIMIT);
	eval 'sub IN6P_HOPOPTS () {0x40000;}' unless defined(&IN6P_HOPOPTS);
	eval 'sub IN6P_DSTOPTS () {0x80000;}' unless defined(&IN6P_DSTOPTS);
	eval 'sub IN6P_RTHDR () {0x100000;}' unless defined(&IN6P_RTHDR);
	eval 'sub IN6P_RTHDRDSTOPTS () {0x200000;}' unless defined(&IN6P_RTHDRDSTOPTS);
	eval 'sub IN6P_TCLASS () {0x400000;}' unless defined(&IN6P_TCLASS);
	eval 'sub IN6P_AUTOFLOWLABEL () {0x800000;}' unless defined(&IN6P_AUTOFLOWLABEL);
	eval 'sub IN6P_ANONPORT () {0x4000000;}' unless defined(&IN6P_ANONPORT);
	eval 'sub IN6P_FAITH () {0x8000000;}' unless defined(&IN6P_FAITH);
	eval 'sub IN6P_RFC2292 () {0x40000000;}' unless defined(&IN6P_RFC2292);
	eval 'sub IN6P_MTU () {0x80000000;}' unless defined(&IN6P_MTU);
	eval 'sub IN6P_MINMTU () {0x20000000;}' unless defined(&IN6P_MINMTU);
	eval 'sub IN6P_CONTROLOPTS () {( &IN6P_PKTINFO| &IN6P_HOPLIMIT| &IN6P_HOPOPTS|  &IN6P_DSTOPTS| &IN6P_RTHDR| &IN6P_RTHDRDSTOPTS|  &IN6P_TCLASS| &IN6P_AUTOFLOWLABEL| &IN6P_RFC2292|  &IN6P_MTU);}' unless defined(&IN6P_CONTROLOPTS);
    }
    eval 'sub INPLOOKUP_WILDCARD () {1;}' unless defined(&INPLOOKUP_WILDCARD);
    eval 'sub INPLOOKUP_SETLOCAL () {2;}' unless defined(&INPLOOKUP_SETLOCAL);
    eval 'sub INPLOOKUP_IPV6 () {4;}' unless defined(&INPLOOKUP_IPV6);
    eval 'sub sotoinpcb {
        my($so) = @_;
	    eval q((($so)-> &so_pcb));
    }' unless defined(&sotoinpcb);
    eval 'sub DP_MAPBITS () {($sizeof{ &u_int32_t} *  &NBBY);}' unless defined(&DP_MAPBITS);
    eval 'sub DP_MAPSIZE () {( &howmany( &IPPORT_RESERVED/2,  &DP_MAPBITS));}' unless defined(&DP_MAPSIZE);
    eval 'sub DP_SET {
        my($m, $p) = @_;
	    eval q((($m)[(($p) -  &IPPORT_RESERVED/2) /  &DP_MAPBITS] |= (1<< (($p) %  &DP_MAPBITS))));
    }' unless defined(&DP_SET);
    eval 'sub DP_CLR {
        my($m, $p) = @_;
	    eval q((($m)[(($p) -  &IPPORT_RESERVED/2) /  &DP_MAPBITS] &= ~(1<< (($p) %  &DP_MAPBITS))));
    }' unless defined(&DP_CLR);
    eval 'sub DP_ISSET {
        my($m, $p) = @_;
	    eval q((($m)[(($p) -  &IPPORT_RESERVED/2) /  &DP_MAPBITS] & (1<< (($p) %  &DP_MAPBITS))));
    }' unless defined(&DP_ISSET);
    eval 'sub DEFBADDYNAMICPORTS_TCP () {{ 587, 749, 750, 751, 871, 0};}' unless defined(&DEFBADDYNAMICPORTS_TCP);
    eval 'sub DEFBADDYNAMICPORTS_UDP () {{ 623, 664, 749, 750, 751, 0};}' unless defined(&DEFBADDYNAMICPORTS_UDP);
    if(defined(&_KERNEL)) {
	eval 'sub sotopf {
	    my($so) = @_;
    	    eval q(( ($so->{so_proto}->{pr_domain}->{dom_family})));
	}' unless defined(&sotopf);
	if(defined(&INET6)) {
	}
    }
}
1;
