require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NETINET6_IN6_VAR_H_)) {
    eval 'sub _NETINET6_IN6_VAR_H_ () {1;}' unless defined(&_NETINET6_IN6_VAR_H_);
    require 'sys/callout.ph';
    require 'sys/ioccom.ph';
    eval 'sub ia_ifp () { ($ia_ifa->{ifa_ifp});}' unless defined(&ia_ifp);
    eval 'sub ia_flags () { ($ia_ifa->{ifa_flags});}' unless defined(&ia_flags);
    if(defined(&_KERNEL)) {
    }
    if(defined(&_KERNEL)) {
	eval 'sub ia6_acquire {
	    my($ia,$psref) = @_;
    	    eval q({  &KASSERT($ia !=  &NULL);  &ifa_acquire( ($ia->{ia_ifa}), $psref); });
	}' unless defined(&ia6_acquire);
	eval 'sub ia6_release {
	    my($ia,$psref) = @_;
    	    eval q({  &if ($ia ==  &NULL) ;  &ifa_release( ($ia->{ia_ifa}), $psref); });
	}' unless defined(&ia6_release);
    }
    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 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 SIOCGNBRINFO_IN6 () { &_IOWR(ord(\'i\'), 78, \'struct in6_nbrinfo\');}' unless defined(&SIOCGNBRINFO_IN6);
    if(0) {
	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 SIOCGIFALIFETIME_IN6 () { &_IOWR(ord(\'i\'), 106, \'struct in6_ifreq\');}' unless defined(&SIOCGIFALIFETIME_IN6);
    eval 'sub SIOCAIFADDR_IN6 () { &_IOW(ord(\'i\'), 107, \'struct in6_aliasreq\');}' unless defined(&SIOCAIFADDR_IN6);
    eval 'sub SIOCSIFPHYADDR_IN6 () { &_IOW(ord(\'i\'), 110, \'struct in6_aliasreq\');}' unless defined(&SIOCSIFPHYADDR_IN6);
    eval 'sub SIOCGIFINFO_IN6 () { &_IOWR(ord(\'i\'), 113, \'struct in6_ndireq\');}' unless defined(&SIOCGIFINFO_IN6);
    eval 'sub SIOCSIFINFO_IN6 () { &_IOWR(ord(\'i\'), 114, \'struct in6_ndireq\');}' unless defined(&SIOCSIFINFO_IN6);
    eval 'sub SIOCSIFINFO_FLAGS () { &_IOWR(ord(\'i\'), 115, \'struct in6_ndireq\');}' unless defined(&SIOCSIFINFO_FLAGS);
    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 SIOCAADDRCTL_POLICY () { &_IOW(ord(\'u\'), 108, \'struct in6_addrpolicy\');}' unless defined(&SIOCAADDRCTL_POLICY);
    eval 'sub SIOCDADDRCTL_POLICY () { &_IOW(ord(\'u\'), 109, \'struct in6_addrpolicy\');}' unless defined(&SIOCDADDRCTL_POLICY);
    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_TEMPORARY () {0x80;}' unless defined(&IN6_IFF_TEMPORARY);
    eval 'sub IN6_IFFBITS () {"\\020\\1ANYCAST\\2TENTATIVE\\3DUPLICATED\\4DETACHED\\5DEPRECATED\\6NODAD" "\\7AUTOCONF\\10TEMPORARY";}' unless defined(&IN6_IFFBITS);
    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)) {
	require 'sys/mutex.ph';
	require 'sys/pserialize.ph';
	require 'net/pktqueue.ph';
	eval 'sub IN6_ADDRLIST_ENTRY_INIT {
	    my($__ia) = @_;
    	    eval q( &PSLIST_ENTRY_INIT(($__ia),  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_ENTRY_INIT);
	eval 'sub IN6_ADDRLIST_ENTRY_DESTROY {
	    my($__ia) = @_;
    	    eval q( &PSLIST_ENTRY_DESTROY(($__ia),  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_ENTRY_DESTROY);
	eval 'sub IN6_ADDRLIST_READER_EMPTY () {
	    eval q(( &PSLIST_READER_FIRST( &in6_ifaddr_list, \'struct in6_ifaddr\',  &ia6_pslist_entry) ==  &NULL));
	}' unless defined(&IN6_ADDRLIST_READER_EMPTY);
	eval 'sub IN6_ADDRLIST_READER_FIRST () {
	    eval q( &PSLIST_READER_FIRST( &in6_ifaddr_list, \'struct in6_ifaddr\',  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_READER_FIRST);
	eval 'sub IN6_ADDRLIST_READER_NEXT {
	    my($__ia) = @_;
    	    eval q( &PSLIST_READER_NEXT(($__ia), \'struct in6_ifaddr\',  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_READER_NEXT);
	eval 'sub IN6_ADDRLIST_READER_FOREACH {
	    my($__ia) = @_;
    	    eval q( &PSLIST_READER_FOREACH(($__ia),  &in6_ifaddr_list, \'struct in6_ifaddr\',  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_READER_FOREACH);
	eval 'sub IN6_ADDRLIST_WRITER_INSERT_HEAD {
	    my($__ia) = @_;
    	    eval q( &PSLIST_WRITER_INSERT_HEAD( &in6_ifaddr_list, ($__ia),  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_WRITER_INSERT_HEAD);
	eval 'sub IN6_ADDRLIST_WRITER_REMOVE {
	    my($__ia) = @_;
    	    eval q( &PSLIST_WRITER_REMOVE(($__ia),  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_WRITER_REMOVE);
	eval 'sub IN6_ADDRLIST_WRITER_FOREACH {
	    my($__ia) = @_;
    	    eval q( &PSLIST_WRITER_FOREACH(($__ia),  &in6_ifaddr_list, \'struct in6_ifaddr\',  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_WRITER_FOREACH);
	eval 'sub IN6_ADDRLIST_WRITER_FIRST () {
	    eval q( &PSLIST_WRITER_FIRST( &in6_ifaddr_list, \'struct in6_ifaddr\',  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_WRITER_FIRST);
	eval 'sub IN6_ADDRLIST_WRITER_NEXT {
	    my($__ia) = @_;
    	    eval q( &PSLIST_WRITER_NEXT(($__ia), \'struct in6_ifaddr\',  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_WRITER_NEXT);
	eval 'sub IN6_ADDRLIST_WRITER_INSERT_AFTER {
	    my($__ia, $__new) = @_;
    	    eval q( &PSLIST_WRITER_INSERT_AFTER(($__ia), ($__new),  &ia6_pslist_entry));
	}' unless defined(&IN6_ADDRLIST_WRITER_INSERT_AFTER);
	eval 'sub IN6_ADDRLIST_WRITER_EMPTY () {
	    eval q(( &PSLIST_WRITER_FIRST( &in6_ifaddr_list, \'struct in6_ifaddr\',  &ia6_pslist_entry) ==  &NULL));
	}' unless defined(&IN6_ADDRLIST_WRITER_EMPTY);
	eval 'sub IN6_ADDRLIST_WRITER_INSERT_TAIL {
	    my($__new) = @_;
    	    eval q( &do {  &if ( &IN6_ADDRLIST_WRITER_EMPTY()) {  &IN6_ADDRLIST_WRITER_INSERT_HEAD(($__new)); }  &else { \'struct in6_ifaddr\' * &__ia;  &IN6_ADDRLIST_WRITER_FOREACH( &__ia) {  &if ( &IN6_ADDRLIST_WRITER_NEXT( &__ia) ==  &NULL) {  &IN6_ADDRLIST_WRITER_INSERT_AFTER( &__ia, ($__new));  &break; } } } }  &while (0));
	}' unless defined(&IN6_ADDRLIST_WRITER_INSERT_TAIL);
	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 in6_get_ia_from_ifp_psref {
	    my($ifp,$psref) = @_;
    	    eval q({ \'struct in6_ifaddr\' * &ia; \'int\'  &s;  &s =  &pserialize_read_enter();  &ia =  &in6_get_ia_from_ifp($ifp);  &if ( &ia !=  &NULL)  &ia6_acquire( &ia, $psref);  &pserialize_read_exit( &s);  &ia; });
	}' unless defined(&in6_get_ia_from_ifp_psref);
    }
    eval 'sub IN6M_TIMER_UNDEF () {-1;}' unless defined(&IN6M_TIMER_UNDEF);
    if(defined(&_KERNEL)) {
	eval 'sub IN6_IFAUPDATE_DADDELAY () {0x1;}' unless defined(&IN6_IFAUPDATE_DADDELAY);
	if(0) {
	    eval 'sub IN6_LOOKUP_MSHIP {
	        my($__addr, $__ifp, $__imop, $__imm) = @_;
    		eval q( &do { ($__imm) =  &in6_lookup_mship(($__addr), ($__ifp), ($__imop)); }  &while ( 0));
	    }' unless defined(&IN6_LOOKUP_MSHIP);
	}
	eval 'sub LLTABLE6 {
	    my($ifp) = @_;
    	    eval q(((($ifp)-> $if_afdata[ &AF_INET6])-> &lltable));
	}' unless defined(&LLTABLE6);
    }
}
1;
