require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NETINET_TCP_VTW_H)) {
    eval 'sub _NETINET_TCP_VTW_H () {1;}' unless defined(&_NETINET_TCP_VTW_H);
    require 'sys/types.ph';
    require 'sys/socket.ph';
    require 'sys/sysctl.ph';
    require 'net/if.ph';
    require 'netinet/in.ph';
    require 'netinet/in_systm.ph';
    require 'netinet/ip.ph';
    require 'netinet/in_pcb.ph';
    require 'netinet/in_var.ph';
    require 'netinet/ip_var.ph';
    require 'netinet/in.ph';
    require 'netinet/tcp.ph';
    require 'netinet/tcp_timer.ph';
    require 'netinet/tcp_var.ph';
    require 'netinet6/in6.ph';
    require 'netinet/ip6.ph';
    require 'netinet6/ip6_var.ph';
    require 'netinet6/in6_pcb.ph';
    require 'netinet6/ip6_var.ph';
    require 'netinet6/in6_var.ph';
    require 'netinet/icmp6.ph';
    eval 'sub VTW_NCLASS () {(1+3);}' unless defined(&VTW_NCLASS);
    if((defined(&CACHE_LINE_SIZE) ? &CACHE_LINE_SIZE : undef) == 128) {
    } else {
    }
    eval 'sub FATP_NTAGS () {( &CACHE_LINE_SIZE / $sizeof{ &fatp_word_t} - 1);}' unless defined(&FATP_NTAGS);
    eval 'sub FATP_NXT_WIDTH () {($sizeof{ &fatp_word_t} *  &NBBY -  &FATP_NTAGS);}' unless defined(&FATP_NXT_WIDTH);
    eval 'sub FATP_MAX () {(1<< ( &FATP_NXT_WIDTH < 31?  &FATP_NXT_WIDTH : 31));}' unless defined(&FATP_MAX);
    eval 'sub fatp_ntags {
        my($void) = @_;
	    eval q({  &FATP_NTAGS; });
    }' unless defined(&fatp_ntags);
    eval 'sub fatp_full {
        my($fp) = @_;
	    eval q({  &fatp_t  &full;  ($full->{inuse}) = (1 <<  &FATP_NTAGS) - 1; ( ($fp->{inuse}) ==  ($full->{inuse})); });
    }' unless defined(&fatp_full);
    eval 'sub v4_tag {
        my($faddr,$fport,$laddr,$lport) = @_;
	    eval q({ ( &ntohl($faddr) +  &ntohs($fport) +  &ntohl($laddr) +  &ntohs($lport)); });
    }' unless defined(&v4_tag);
# some #ifdef were dropped here -- fill in the blanks
    eval 'sub v6_tag {
        my($faddr,$fport,$laddr,$lport) = @_;
	    eval q({ });
    }' unless defined(&v6_tag);
    eval 'sub v4_port_tag {
        my($lport) = @_;
	    eval q({  &uint32_t  &tag = $lport ^ ($lport << 11);  &tag ^=  &tag << 3;  &tag +=  &tag >> 5;  &tag ^=  &tag << 4;  &tag +=  &tag >> 17;  &tag ^=  &tag << 25;  &tag +=  &tag >> 6;  &tag; });
    }' unless defined(&v4_port_tag);
    eval 'sub v6_port_tag {
        my($lport) = @_;
	    eval q({  &v4_port_tag($lport); });
    }' unless defined(&v6_port_tag);
    if(defined(&_KERNEL)) {
    }
    if(defined(&VTW_DEBUG)) {
    }
}
1;
