require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_NETINET_IP6_H_)) {
    eval 'sub _NETINET_IP6_H_ () {1;}' unless defined(&_NETINET_IP6_H_);
    eval 'sub ip6_vfc () { ($ip6_ctlun->{ip6_un2_vfc});}' unless defined(&ip6_vfc);
    eval 'sub ip6_flow () { ($ip6_ctlun->{ip6_un1}->{ip6_un1_flow});}' unless defined(&ip6_flow);
    eval 'sub ip6_plen () { ($ip6_ctlun->{ip6_un1}->{ip6_un1_plen});}' unless defined(&ip6_plen);
    eval 'sub ip6_nxt () { ($ip6_ctlun->{ip6_un1}->{ip6_un1_nxt});}' unless defined(&ip6_nxt);
    eval 'sub ip6_hlim () { ($ip6_ctlun->{ip6_un1}->{ip6_un1_hlim});}' unless defined(&ip6_hlim);
    eval 'sub ip6_hops () { ($ip6_ctlun->{ip6_un1}->{ip6_un1_hlim});}' unless defined(&ip6_hops);
    eval 'sub IPV6_VERSION () {0x60;}' unless defined(&IPV6_VERSION);
    eval 'sub IPV6_VERSION_MASK () {0xf0;}' unless defined(&IPV6_VERSION_MASK);
    if((defined(&_BYTE_ORDER) ? &_BYTE_ORDER : 0) == (defined(&_BIG_ENDIAN) ? &_BIG_ENDIAN : 0)) {
	eval 'sub IPV6_FLOWINFO_MASK () {0xfffffff;}' unless defined(&IPV6_FLOWINFO_MASK);
	eval 'sub IPV6_FLOWLABEL_MASK () {0xfffff;}' unless defined(&IPV6_FLOWLABEL_MASK);
    } else {
	if((defined(&_BYTE_ORDER) ? &_BYTE_ORDER : 0) == (defined(&_LITTLE_ENDIAN) ? &_LITTLE_ENDIAN : 0)) {
	    eval 'sub IPV6_FLOWINFO_MASK () {0xffffff0f;}' unless defined(&IPV6_FLOWINFO_MASK);
	    eval 'sub IPV6_FLOWLABEL_MASK () {0xffff0f00;}' unless defined(&IPV6_FLOWLABEL_MASK);
	}
    }
    if(1) {
	eval 'sub IP6TOS_CE () {0x1;}' unless defined(&IP6TOS_CE);
	eval 'sub IP6TOS_ECT () {0x2;}' unless defined(&IP6TOS_ECT);
    }
    if(defined(&_KERNEL)) {
    }
    eval 'sub IP6OPT_PAD1 () {0x;}' unless defined(&IP6OPT_PAD1);
    eval 'sub IP6OPT_PADN () {0x1;}' unless defined(&IP6OPT_PADN);
    eval 'sub IP6OPT_JUMBO () {0xc2;}' unless defined(&IP6OPT_JUMBO);
    eval 'sub IP6OPT_NSAP_ADDR () {0xc3;}' unless defined(&IP6OPT_NSAP_ADDR);
    eval 'sub IP6OPT_TUNNEL_LIMIT () {0x4;}' unless defined(&IP6OPT_TUNNEL_LIMIT);
    eval 'sub IP6OPT_ROUTER_ALERT () {0x5;}' unless defined(&IP6OPT_ROUTER_ALERT);
    eval 'sub IP6OPT_RTALERT_LEN () {4;}' unless defined(&IP6OPT_RTALERT_LEN);
    eval 'sub IP6OPT_RTALERT_MLD () {0;}' unless defined(&IP6OPT_RTALERT_MLD);
    eval 'sub IP6OPT_RTALERT_RSVP () {1;}' unless defined(&IP6OPT_RTALERT_RSVP);
    eval 'sub IP6OPT_RTALERT_ACTNET () {2;}' unless defined(&IP6OPT_RTALERT_ACTNET);
    eval 'sub IP6OPT_MINLEN () {2;}' unless defined(&IP6OPT_MINLEN);
    eval 'sub IP6OPT_TYPE {
        my($o) = @_;
	    eval q((($o) & 0xc0));
    }' unless defined(&IP6OPT_TYPE);
    eval 'sub IP6OPT_TYPE_SKIP () {0x;}' unless defined(&IP6OPT_TYPE_SKIP);
    eval 'sub IP6OPT_TYPE_DISCARD () {0x40;}' unless defined(&IP6OPT_TYPE_DISCARD);
    eval 'sub IP6OPT_TYPE_FORCEICMP () {0x80;}' unless defined(&IP6OPT_TYPE_FORCEICMP);
    eval 'sub IP6OPT_TYPE_ICMP () {0xc0;}' unless defined(&IP6OPT_TYPE_ICMP);
    eval 'sub IP6OPT_MUTABLE () {0x20;}' unless defined(&IP6OPT_MUTABLE);
    eval 'sub IP6OPT_JUMBO_LEN () {6;}' unless defined(&IP6OPT_JUMBO_LEN);
    if((defined(&_BYTE_ORDER) ? &_BYTE_ORDER : 0) == (defined(&_BIG_ENDIAN) ? &_BIG_ENDIAN : 0)) {
	eval 'sub IP6_ALERT_MLD () {0x;}' unless defined(&IP6_ALERT_MLD);
	eval 'sub IP6_ALERT_RSVP () {0x1;}' unless defined(&IP6_ALERT_RSVP);
	eval 'sub IP6_ALERT_AN () {0x2;}' unless defined(&IP6_ALERT_AN);
    } else {
	if((defined(&_BYTE_ORDER) ? &_BYTE_ORDER : 0) == (defined(&_LITTLE_ENDIAN) ? &_LITTLE_ENDIAN : 0)) {
	    eval 'sub IP6_ALERT_MLD () {0x;}' unless defined(&IP6_ALERT_MLD);
	    eval 'sub IP6_ALERT_RSVP () {0x100;}' unless defined(&IP6_ALERT_RSVP);
	    eval 'sub IP6_ALERT_AN () {0x200;}' unless defined(&IP6_ALERT_AN);
	}
    }
    if((defined(&_BYTE_ORDER) ? &_BYTE_ORDER : 0) == (defined(&_BIG_ENDIAN) ? &_BIG_ENDIAN : 0)) {
	eval 'sub IP6F_OFF_MASK () {0xfff8;}' unless defined(&IP6F_OFF_MASK);
	eval 'sub IP6F_RESERVED_MASK () {0x6;}' unless defined(&IP6F_RESERVED_MASK);
	eval 'sub IP6F_MORE_FRAG () {0x1;}' unless defined(&IP6F_MORE_FRAG);
    } else {
	eval 'sub IP6F_OFF_MASK () {0xf8ff;}' unless defined(&IP6F_OFF_MASK);
	eval 'sub IP6F_RESERVED_MASK () {0x600;}' unless defined(&IP6F_RESERVED_MASK);
	eval 'sub IP6F_MORE_FRAG () {0x100;}' unless defined(&IP6F_MORE_FRAG);
    }
    eval 'sub IPV6_MAXHLIM () {255;}' unless defined(&IPV6_MAXHLIM);
    eval 'sub IPV6_DEFHLIM () {64;}' unless defined(&IPV6_DEFHLIM);
    eval 'sub IPV6_FRAGTTL () {120;}' unless defined(&IPV6_FRAGTTL);
    eval 'sub IPV6_HLIMDEC () {1;}' unless defined(&IPV6_HLIMDEC);
    eval 'sub IPV6_MMTU () {1280;}' unless defined(&IPV6_MMTU);
    eval 'sub IPV6_MAXPACKET () {65535;}' unless defined(&IPV6_MAXPACKET);
    if(defined(&_KERNEL)) {
	eval 'sub IP6_EXTHDR_GET {
	    my($val, $typ, $m, $off, $len) = @_;
    	    eval q( &do { \'struct mbuf\' * &t; \'int\'  &tmp;  &if (($m)-> &m_len >= ($off) + ($len)) ($val) = ($typ)( &mtod(($m), \'caddr_t\') + ($off));  &else {  &t =  &m_pulldown(($m), ($off), ($len),  &tmp);  &if ( &t) {  &if ( ($t->{m_len}) <  &tmp + ($len))  &panic(\\"m_pulldown malfunction\\"); ($val) = ($typ)( &mtod( &t, \'caddr_t\') +  &tmp); }  &else { ($val) = ($typ) &NULL; ($m) =  &NULL; } } }  &while (0));
	}' unless defined(&IP6_EXTHDR_GET);
	eval 'sub IP6_EXTHDR_GET0 {
	    my($val, $typ, $m, $off, $len) = @_;
    	    eval q( &do { \'struct mbuf\' * &t;  &if (($off) == 0 && ($m)-> &m_len >= $len) ($val) = ($typ) &mtod(($m), \'caddr_t\');  &else {  &t =  &m_pulldown(($m), ($off), ($len),  &NULL);  &if ( &t) {  &if ( ($t->{m_len}) < ($len))  &panic(\\"m_pulldown malfunction\\"); ($val) = ($typ) &mtod( &t, \'caddr_t\'); }  &else { ($val) = ($typ) &NULL; ($m) =  &NULL; } } }  &while (0));
	}' unless defined(&IP6_EXTHDR_GET0);
    }
}
1;
