require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_NETINET6_IN6_VAR_H_)) {
    eval 'sub _NETINET6_IN6_VAR_H_ () {1;}' unless defined(&_NETINET6_IN6_VAR_H_);
    eval 'sub ia_ifp () { ($ia_ifa->{ifa_ifp});}' unless defined(&ia_ifp);
    eval 'sub ia_flags () { ($ia_ifa->{ifa_flags});}' unless defined(&ia_flags);
    eval 'sub IN6_PREFIX_ND () {1;}' unless defined(&IN6_PREFIX_ND);
    eval 'sub IN6_PREFIX_RR () {2;}' unless defined(&IN6_PREFIX_RR);
    eval 'sub PR_ORIG_RA () {0;}' unless defined(&PR_ORIG_RA);
    eval 'sub PR_ORIG_RR () {1;}' unless defined(&PR_ORIG_RR);
    eval 'sub PR_ORIG_STATIC () {2;}' unless defined(&PR_ORIG_STATIC);
    eval 'sub PR_ORIG_KERNEL () {3;}' unless defined(&PR_ORIG_KERNEL);
    eval 'sub ipr_raf_onlink () { ($ipr_flags->{prf_ra}->{onlink});}' unless defined(&ipr_raf_onlink);
    eval 'sub ipr_raf_auto () { ($ipr_flags->{prf_ra}->{autonomous});}' unless defined(&ipr_raf_auto);
    eval 'sub ipr_statef_onlink () { ($ipr_flags->{prf_state}->{onlink});}' unless defined(&ipr_statef_onlink);
    eval 'sub ipr_rrf_decrvalid () { ($ipr_flags->{prf_rr}->{decrvalid});}' unless defined(&ipr_rrf_decrvalid);
    eval 'sub ipr_rrf_decrprefd () { ($ipr_flags->{prf_rr}->{decrprefd});}' unless defined(&ipr_rrf_decrprefd);
    eval 'sub irr_raf_mask_onlink () { ($irr_raflagmask->{onlink});}' unless defined(&irr_raf_mask_onlink);
    eval 'sub irr_raf_mask_auto () { ($irr_raflagmask->{autonomous});}' unless defined(&irr_raf_mask_auto);
    eval 'sub irr_raf_mask_reserved () { ($irr_raflagmask->{reserved});}' unless defined(&irr_raf_mask_reserved);
    eval 'sub irr_raf_onlink () { ($irr_flags->{prf_ra}->{onlink});}' unless defined(&irr_raf_onlink);
    eval 'sub irr_raf_auto () { ($irr_flags->{prf_ra}->{autonomous});}' unless defined(&irr_raf_auto);
    eval 'sub irr_statef_onlink () { ($irr_flags->{prf_state}->{onlink});}' unless defined(&irr_statef_onlink);
    eval 'sub irr_rrf () { ($irr_flags->{prf_rr});}' unless defined(&irr_rrf);
    eval 'sub irr_rrf_decrvalid () { ($irr_flags->{prf_rr}->{decrvalid});}' unless defined(&irr_rrf_decrvalid);
    eval 'sub irr_rrf_decrprefd () { ($irr_flags->{prf_rr}->{decrprefd});}' unless defined(&irr_rrf_decrprefd);
    eval 'sub IA6_IN6 {
        my($ia) = @_;
	    eval q(((($ia)-> ($ia_addr->{sin6_addr}))));
    }' unless defined(&IA6_IN6);
    eval 'sub IA6_DSTIN6 {
        my($ia) = @_;
	    eval q(((($ia)-> ($ia_dstaddr->{sin6_addr}))));
    }' unless defined(&IA6_DSTIN6);
    eval 'sub IA6_MASKIN6 {
        my($ia) = @_;
	    eval q(((($ia)-> ($ia_prefixmask->{sin6_addr}))));
    }' unless defined(&IA6_MASKIN6);
    eval 'sub IA6_SIN6 {
        my($ia) = @_;
	    eval q(((($ia)-> &ia_addr)));
    }' unless defined(&IA6_SIN6);
    eval 'sub IA6_DSTSIN6 {
        my($ia) = @_;
	    eval q(((($ia)-> &ia_dstaddr)));
    }' unless defined(&IA6_DSTSIN6);
    eval 'sub IFA_IN6 {
        my($x) = @_;
	    eval q((((($x)-> &ifa_addr))-> &sin6_addr));
    }' unless defined(&IFA_IN6);
    eval 'sub IFA_DSTIN6 {
        my($x) = @_;
	    eval q((((($x)-> &ifa_dstaddr))-> &sin6_addr));
    }' unless defined(&IFA_DSTIN6);
    if(defined(&_KERNEL)) {
	eval 'sub IN6_ARE_MASKED_ADDR_EQUAL {
	    my($d, $a, $m) = @_;
    	    eval q(( ((($d)-> $s6_addr32[0] ^ ($a)-> $s6_addr32[0]) & ($m)-> $s6_addr32[0]) == 0 && ((($d)-> $s6_addr32[1] ^ ($a)-> $s6_addr32[1]) & ($m)-> $s6_addr32[1]) == 0 && ((($d)-> $s6_addr32[2] ^ ($a)-> $s6_addr32[2]) & ($m)-> $s6_addr32[2]) == 0 && ((($d)-> $s6_addr32[3] ^ ($a)-> $s6_addr32[3]) & ($m)-> $s6_addr32[3]) == 0));
	}' unless defined(&IN6_ARE_MASKED_ADDR_EQUAL);
    }
    eval 'sub SIOCSIFADDR_IN6 () { &_IOW(ord(\'i\'), 12, \'struct in6_ifreq\');}' unless defined(&SIOCSIFADDR_IN6);
    eval 'sub SIOCGIFADDR_IN6 () { &_IOWR(ord(\'i\'), 33, \'struct in6_ifreq\');}' unless defined(&SIOCGIFADDR_IN6);
    if(defined(&_KERNEL)) {
	eval 'sub SIOCSIFDSTADDR_IN6 () { &_IOW(ord(\'i\'), 14, \'struct in6_ifreq\');}' unless defined(&SIOCSIFDSTADDR_IN6);
	eval 'sub SIOCSIFNETMASK_IN6 () { &_IOW(ord(\'i\'), 22, \'struct in6_ifreq\');}' unless defined(&SIOCSIFNETMASK_IN6);
    }
    eval 'sub SIOCGIFDSTADDR_IN6 () { &_IOWR(ord(\'i\'), 34, \'struct in6_ifreq\');}' unless defined(&SIOCGIFDSTADDR_IN6);
    eval 'sub SIOCGIFNETMASK_IN6 () { &_IOWR(ord(\'i\'), 37, \'struct in6_ifreq\');}' unless defined(&SIOCGIFNETMASK_IN6);
    eval 'sub SIOCDIFADDR_IN6 () { &_IOW(ord(\'i\'), 25, \'struct in6_ifreq\');}' unless defined(&SIOCDIFADDR_IN6);
    eval 'sub SIOCAIFADDR_IN6 () { &_IOW(ord(\'i\'), 26, \'struct in6_aliasreq\');}' unless defined(&SIOCAIFADDR_IN6);
    eval 'sub SIOCSIFPHYADDR_IN6 () { &_IOW(ord(\'i\'), 70, \'struct in6_aliasreq\');}' unless defined(&SIOCSIFPHYADDR_IN6);
    eval 'sub SIOCGIFPSRCADDR_IN6 () { &_IOWR(ord(\'i\'), 71, \'struct in6_ifreq\');}' unless defined(&SIOCGIFPSRCADDR_IN6);
    eval 'sub SIOCGIFPDSTADDR_IN6 () { &_IOWR(ord(\'i\'), 72, \'struct in6_ifreq\');}' unless defined(&SIOCGIFPDSTADDR_IN6);
    eval 'sub SIOCGIFAFLAG_IN6 () { &_IOWR(ord(\'i\'), 73, \'struct in6_ifreq\');}' unless defined(&SIOCGIFAFLAG_IN6);
    eval 'sub SIOCGDRLST_IN6 () { &_IOWR(ord(\'i\'), 74, \'struct in6_drlist\');}' unless defined(&SIOCGDRLST_IN6);
    eval 'sub SIOCGPRLST_IN6 () { &_IOWR(ord(\'i\'), 75, \'struct in6_prlist\');}' unless defined(&SIOCGPRLST_IN6);
    if(defined(&_KERNEL)) {
	eval 'sub OSIOCGIFINFO_IN6 () { &_IOWR(ord(\'i\'), 76, \'struct in6_ondireq\');}' unless defined(&OSIOCGIFINFO_IN6);
    }
    eval 'sub SIOCGIFINFO_IN6 () { &_IOWR(ord(\'i\'), 108, \'struct in6_ndireq\');}' unless defined(&SIOCGIFINFO_IN6);
    eval 'sub SIOCSNDFLUSH_IN6 () { &_IOWR(ord(\'i\'), 77, \'struct in6_ifreq\');}' unless defined(&SIOCSNDFLUSH_IN6);
    eval 'sub SIOCGNBRINFO_IN6 () { &_IOWR(ord(\'i\'), 78, \'struct in6_nbrinfo\');}' unless defined(&SIOCGNBRINFO_IN6);
    eval 'sub SIOCSPFXFLUSH_IN6 () { &_IOWR(ord(\'i\'), 79, \'struct in6_ifreq\');}' unless defined(&SIOCSPFXFLUSH_IN6);
    eval 'sub SIOCSRTRFLUSH_IN6 () { &_IOWR(ord(\'i\'), 80, \'struct in6_ifreq\');}' unless defined(&SIOCSRTRFLUSH_IN6);
    eval 'sub SIOCGIFALIFETIME_IN6 () { &_IOWR(ord(\'i\'), 81, \'struct in6_ifreq\');}' unless defined(&SIOCGIFALIFETIME_IN6);
    eval 'sub SIOCSIFALIFETIME_IN6 () { &_IOWR(ord(\'i\'), 82, \'struct in6_ifreq\');}' unless defined(&SIOCSIFALIFETIME_IN6);
    eval 'sub SIOCGIFSTAT_IN6 () { &_IOWR(ord(\'i\'), 83, \'struct in6_ifreq\');}' unless defined(&SIOCGIFSTAT_IN6);
    eval 'sub SIOCGIFSTAT_ICMP6 () { &_IOWR(ord(\'i\'), 84, \'struct in6_ifreq\');}' unless defined(&SIOCGIFSTAT_ICMP6);
    eval 'sub SIOCSDEFIFACE_IN6 () { &_IOWR(ord(\'i\'), 85, \'struct in6_ndifreq\');}' unless defined(&SIOCSDEFIFACE_IN6);
    eval 'sub SIOCGDEFIFACE_IN6 () { &_IOWR(ord(\'i\'), 86, \'struct in6_ndifreq\');}' unless defined(&SIOCGDEFIFACE_IN6);
    eval 'sub SIOCSIFINFO_FLAGS () { &_IOWR(ord(\'i\'), 87, \'struct in6_ndireq\');}' unless defined(&SIOCSIFINFO_FLAGS);
    eval 'sub SIOCSIFPREFIX_IN6 () { &_IOW(ord(\'i\'), 100, \'struct in6_prefixreq\');}' unless defined(&SIOCSIFPREFIX_IN6);
    eval 'sub SIOCGIFPREFIX_IN6 () { &_IOWR(ord(\'i\'), 101, \'struct in6_prefixreq\');}' unless defined(&SIOCGIFPREFIX_IN6);
    eval 'sub SIOCDIFPREFIX_IN6 () { &_IOW(ord(\'i\'), 102, \'struct in6_prefixreq\');}' unless defined(&SIOCDIFPREFIX_IN6);
    eval 'sub SIOCAIFPREFIX_IN6 () { &_IOW(ord(\'i\'), 103, \'struct in6_rrenumreq\');}' unless defined(&SIOCAIFPREFIX_IN6);
    eval 'sub SIOCCIFPREFIX_IN6 () { &_IOW(ord(\'i\'), 104, \'struct in6_rrenumreq\');}' unless defined(&SIOCCIFPREFIX_IN6);
    eval 'sub SIOCSGIFPREFIX_IN6 () { &_IOW(ord(\'i\'), 105, \'struct in6_rrenumreq\');}' unless defined(&SIOCSGIFPREFIX_IN6);
    eval 'sub SIOCGETSGCNT_IN6 () { &_IOWR(ord(\'u\'), 106, \'struct sioc_sg_req6\');}' unless defined(&SIOCGETSGCNT_IN6);
    eval 'sub SIOCGETMIFCNT_IN6 () { &_IOWR(ord(\'u\'), 107, \'struct sioc_mif_req6\');}' unless defined(&SIOCGETMIFCNT_IN6);
    eval 'sub IN6_IFF_ANYCAST () {0x1;}' unless defined(&IN6_IFF_ANYCAST);
    eval 'sub IN6_IFF_TENTATIVE () {0x2;}' unless defined(&IN6_IFF_TENTATIVE);
    eval 'sub IN6_IFF_DUPLICATED () {0x4;}' unless defined(&IN6_IFF_DUPLICATED);
    eval 'sub IN6_IFF_DETACHED () {0x8;}' unless defined(&IN6_IFF_DETACHED);
    eval 'sub IN6_IFF_DEPRECATED () {0x10;}' unless defined(&IN6_IFF_DEPRECATED);
    eval 'sub IN6_IFF_NODAD () {0x20;}' unless defined(&IN6_IFF_NODAD);
    eval 'sub IN6_IFF_AUTOCONF () {0x40;}' unless defined(&IN6_IFF_AUTOCONF);
    eval 'sub IN6_IFF_NOTREADY () {( &IN6_IFF_TENTATIVE| &IN6_IFF_DUPLICATED);}' unless defined(&IN6_IFF_NOTREADY);
    if(defined(&_KERNEL)) {
	eval 'sub IN6_ARE_SCOPE_CMP {
	    my($a,$b) = @_;
    	    eval q((($a)-($b)));
	}' unless defined(&IN6_ARE_SCOPE_CMP);
	eval 'sub IN6_ARE_SCOPE_EQUAL {
	    my($a,$b) = @_;
    	    eval q((($a)==($b)));
	}' unless defined(&IN6_ARE_SCOPE_EQUAL);
    }
    if(defined(&_KERNEL)) {
	eval 'sub in6_ifstat_inc {
	    my($ifp, $tag) = @_;
    	    eval q( &do {  &if ($ifp) ((($ifp)-> $if_afdata[ &AF_INET6]))-> ($in6_ifstat->{tag})++; }  &while (0));
	}' unless defined(&in6_ifstat_inc);
	eval 'sub IFP_TO_IA6 {
	    my($ifp, $ia) = @_;
    	    eval q( &do { \'struct ifaddr\' * &ifa;  &TAILQ_FOREACH( &ifa, ($ifp)-> &if_addrlist,  &ifa_list) {  &if (! ($ifa->{ifa_addr}))  &continue;  &if ( ($ifa->{ifa_addr}->{sa_family}) ==  &AF_INET6)  &break; } ($ia) =  &ifa; }  &while (0));
	}' unless defined(&IFP_TO_IA6);
    }
    if(defined(&_KERNEL)) {
	eval 'sub IN6_LOOKUP_MULTI {
	    my($addr, $ifp, $in6m) = @_;
    	    eval q( &do { \'struct in6_ifaddr\' * &ia;  &IFP_TO_IA6(($ifp),  &ia);  &if ( &ia ==  &NULL) ($in6m) =  &NULL;  &else  &for (($in6m) =  &LIST_FIRST( ($ia->{ia6_multiaddrs})); ($in6m) !=  &LIST_END( ($ia->{ia6_multiaddrs}))  && ! &IN6_ARE_ADDR_EQUAL(($in6m)-> &in6m_addr, ($addr)); ($in6m) =  &LIST_NEXT(($in6m),  &in6m_entry))  &continue; }  &while (0));
	}' unless defined(&IN6_LOOKUP_MULTI);
	eval 'sub IN6_NEXT_MULTI {
	    my($step, $in6m) = @_;
    	    eval q( &do {  &if ((($in6m) = ($step). &i_in6m) !=  &NULL) ($step). &i_in6m =  &LIST_NEXT(($in6m),  &in6m_entry);  &else  &while (($step). &i_ia !=  &NULL) { ($in6m) =  &LIST_FIRST(($step). ($i_ia->{ia6_multiaddrs})); ($step). &i_ia = ($step). ($i_ia->{ia_next});  &if (($in6m) !=  &NULL) { ($step). &i_in6m =  &LIST_NEXT(($in6m),  &in6m_entry);  &break; } } }  &while (0));
	}' unless defined(&IN6_NEXT_MULTI);
	eval 'sub IN6_FIRST_MULTI {
	    my($step, $in6m) = @_;
    	    eval q( &do { ($step). &i_ia =  &in6_ifaddr; ($step). &i_in6m =  &NULL;  &IN6_NEXT_MULTI(($step), ($in6m)); }  &while (0));
	}' unless defined(&IN6_FIRST_MULTI);
    }
}
1;
