require '_h2ph_pre.ph';

unless(defined(&__IP_NAT_H__)) {
    eval 'sub __IP_NAT_H__ () {1;}' unless defined(&__IP_NAT_H__);
    unless(defined(&SOLARIS)) {
	eval 'sub SOLARIS () {(defined( &sun)  && (defined( &__svr4__) || defined( &__SVR4)));}' unless defined(&SOLARIS);
    }
    if(defined( &__STDC__) || defined( &__GNUC__)) {
	eval 'sub SIOCADNAT () { &_IOW(ord(\'r\'), 60, \'struct ipnat\' *);}' unless defined(&SIOCADNAT);
	eval 'sub SIOCRMNAT () { &_IOW(ord(\'r\'), 61, \'struct ipnat\' *);}' unless defined(&SIOCRMNAT);
	eval 'sub SIOCGNATS () { &_IOWR(ord(\'r\'), 62, \'struct natstat\' *);}' unless defined(&SIOCGNATS);
	eval 'sub SIOCGNATL () { &_IOWR(ord(\'r\'), 63, \'struct natlookup\' *);}' unless defined(&SIOCGNATL);
    } else {
	eval 'sub SIOCADNAT () { &_IOW("r", 60, \'struct ipnat\' *);}' unless defined(&SIOCADNAT);
	eval 'sub SIOCRMNAT () { &_IOW("r", 61, \'struct ipnat\' *);}' unless defined(&SIOCRMNAT);
	eval 'sub SIOCGNATS () { &_IOWR("r", 62, \'struct natstat\' *);}' unless defined(&SIOCGNATS);
	eval 'sub SIOCGNATL () { &_IOWR("r", 63, \'struct natlookup\' *);}' unless defined(&SIOCGNATL);
    }
    undef(&LARGE_NAT) if defined(&LARGE_NAT);
    eval 'sub NAT_SIZE () {127;}' unless defined(&NAT_SIZE);
    eval 'sub RDR_SIZE () {127;}' unless defined(&RDR_SIZE);
    eval 'sub HOSTMAP_SIZE () {127;}' unless defined(&HOSTMAP_SIZE);
    eval 'sub NAT_TABLE_SZ () {127;}' unless defined(&NAT_TABLE_SZ);
    if(defined(&LARGE_NAT)) {
	undef(&NAT_SIZE) if defined(&NAT_SIZE);
	undef(&RDR_SIZE) if defined(&RDR_SIZE);
	undef(&NAT_TABLE_SZ) if defined(&NAT_TABLE_SZ);
	undef(&HOSTMAP_SIZE) if defined(&HOSTMAP_SIZE);
	eval 'sub NAT_SIZE () {2047;}' unless defined(&NAT_SIZE);
	eval 'sub RDR_SIZE () {2047;}' unless defined(&RDR_SIZE);
	eval 'sub NAT_TABLE_SZ () {16383;}' unless defined(&NAT_TABLE_SZ);
	eval 'sub HOSTMAP_SIZE () {8191;}' unless defined(&HOSTMAP_SIZE);
    }
    unless(defined(&APR_LABELLEN)) {
	eval 'sub APR_LABELLEN () {16;}' unless defined(&APR_LABELLEN);
    }
    eval 'sub NAT_HW_CKSUM () {0x80000000;}' unless defined(&NAT_HW_CKSUM);
    eval 'sub DEF_NAT_AGE () {1200;}' unless defined(&DEF_NAT_AGE);
    if((defined(&SOLARIS) ? &SOLARIS : 0) || defined( &__sgi)) {
    }
    eval 'sub in_pmin () { $in_port[0];}' unless defined(&in_pmin);
    eval 'sub in_pmax () { $in_port[1];}' unless defined(&in_pmax);
    eval 'sub in_nip () { ($in_nextip->{s_addr});}' unless defined(&in_nip);
    eval 'sub in_inip () { ($in_in[0]->{s_addr});}' unless defined(&in_inip);
    eval 'sub in_inmsk () { ($in_in[1]->{s_addr});}' unless defined(&in_inmsk);
    eval 'sub in_outip () { ($in_out[0]->{s_addr});}' unless defined(&in_outip);
    eval 'sub in_outmsk () { ($in_out[1]->{s_addr});}' unless defined(&in_outmsk);
    eval 'sub in_srcip () { ($in_src[0]->{s_addr});}' unless defined(&in_srcip);
    eval 'sub in_srcmsk () { ($in_src[1]->{s_addr});}' unless defined(&in_srcmsk);
    eval 'sub in_scmp () { ($in_tuc->{ftu_scmp});}' unless defined(&in_scmp);
    eval 'sub in_dcmp () { ($in_tuc->{ftu_dcmp});}' unless defined(&in_dcmp);
    eval 'sub in_stop () { ($in_tuc->{ftu_stop});}' unless defined(&in_stop);
    eval 'sub in_dtop () { ($in_tuc->{ftu_dtop});}' unless defined(&in_dtop);
    eval 'sub in_sport () { ($in_tuc->{ftu_sport});}' unless defined(&in_sport);
    eval 'sub in_dport () { ($in_tuc->{ftu_dport});}' unless defined(&in_dport);
    eval 'sub NAT_OUTBOUND () {0;}' unless defined(&NAT_OUTBOUND);
    eval 'sub NAT_INBOUND () {1;}' unless defined(&NAT_INBOUND);
    eval 'sub NAT_MAP () {0x01;}' unless defined(&NAT_MAP);
    eval 'sub NAT_REDIRECT () {0x02;}' unless defined(&NAT_REDIRECT);
    eval 'sub NAT_BIMAP () {( &NAT_MAP| &NAT_REDIRECT);}' unless defined(&NAT_BIMAP);
    eval 'sub NAT_MAPBLK () {0x04;}' unless defined(&NAT_MAPBLK);
    eval 'sub MAPBLK_MINPORT () {1024;}' unless defined(&MAPBLK_MINPORT);
    eval 'sub USABLE_PORTS () {(65536-  &MAPBLK_MINPORT);}' unless defined(&USABLE_PORTS);
    eval 'sub IPN_CMPSIZ () {($sizeof{ &ipnat_t} -  &offsetof( &ipnat_t,  &in_flags));}' unless defined(&IPN_CMPSIZ);
    eval 'sub ipn_rule () { ($ipn_nat->{nat_fr});}' unless defined(&ipn_rule);
    eval 'sub IPN_ANY () {0x000;}' unless defined(&IPN_ANY);
    eval 'sub IPN_TCP () {0x001;}' unless defined(&IPN_TCP);
    eval 'sub IPN_UDP () {0x002;}' unless defined(&IPN_UDP);
    eval 'sub IPN_TCPUDP () {( &IPN_TCP| &IPN_UDP);}' unless defined(&IPN_TCPUDP);
    eval 'sub IPN_DELETE () {0x004;}' unless defined(&IPN_DELETE);
    eval 'sub IPN_ICMPERR () {0x008;}' unless defined(&IPN_ICMPERR);
    eval 'sub IPN_RF () {( &IPN_TCPUDP| &IPN_DELETE| &IPN_ICMPERR);}' unless defined(&IPN_RF);
    eval 'sub IPN_AUTOPORTMAP () {0x010;}' unless defined(&IPN_AUTOPORTMAP);
    eval 'sub IPN_IPRANGE () {0x020;}' unless defined(&IPN_IPRANGE);
    eval 'sub IPN_USERFLAGS () {( &IPN_TCPUDP| &IPN_AUTOPORTMAP| &IPN_IPRANGE| &IPN_SPLIT|  &IPN_ROUNDR| &IPN_FILTER| &IPN_NOTSRC| &IPN_NOTDST);}' unless defined(&IPN_USERFLAGS);
    eval 'sub IPN_FILTER () {0x040;}' unless defined(&IPN_FILTER);
    eval 'sub IPN_SPLIT () {0x080;}' unless defined(&IPN_SPLIT);
    eval 'sub IPN_ROUNDR () {0x100;}' unless defined(&IPN_ROUNDR);
    eval 'sub IPN_NOTSRC () {0x080000;}' unless defined(&IPN_NOTSRC);
    eval 'sub IPN_NOTDST () {0x100000;}' unless defined(&IPN_NOTDST);
    eval 'sub NL_NEWMAP () { &NAT_MAP;}' unless defined(&NL_NEWMAP);
    eval 'sub NL_NEWRDR () { &NAT_REDIRECT;}' unless defined(&NL_NEWRDR);
    eval 'sub NL_NEWBIMAP () { &NAT_BIMAP;}' unless defined(&NL_NEWBIMAP);
    eval 'sub NL_NEWBLOCK () { &NAT_MAPBLK;}' unless defined(&NL_NEWBLOCK);
    eval 'sub NL_FLUSH () {0xfffe;}' unless defined(&NL_FLUSH);
    eval 'sub NL_EXPIRE () {0xffff;}' unless defined(&NL_EXPIRE);
    eval 'sub NAT_HASH_FN {
        local($k,$l,$m) = @_;
	    eval q(((($k) + (($k) >> 12) + $l) % ($m)));
    }' unless defined(&NAT_HASH_FN);
    eval 'sub LONG_SUM {
        local($in) = @_;
	    eval q(((($in) & 0xffff) + (($in) >> 16)));
    }' unless defined(&LONG_SUM);
    eval 'sub CALC_SUMD {
        local($s1, $s2, $sd) = @_;
	    eval q({ ($s1) = (($s1) & 0xffff) + (($s1) >> 16); ($s2) = (($s2) & 0xffff) + (($s2) >> 16); ($s1) = (($s1) & 0xffff) + (($s1) >> 16); ($s2) = (($s2) & 0xffff) + (($s2) >> 16);  &if (($s1) > ($s2)) ($s2)--; ($sd) = ($s2) - ($s1); ($sd) = (($sd) & 0xffff) + (($sd) >> 16); });
    }' unless defined(&CALC_SUMD);
    if(defined( &__NetBSD__) || defined( &__OpenBSD__) || ((defined(&__FreeBSD_version) ? &__FreeBSD_version : 0) >= 300003)) {
    } else {
    }
}
1;
