require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NETINET_IP_ENCAP_H_)) {
    eval 'sub _NETINET_IP_ENCAP_H_ () {1;}' unless defined(&_NETINET_IP_ENCAP_H_);
    if(defined(&_KERNEL)) {
	require 'sys/pslist.ph';
	require 'sys/psref.ph';
	eval 'sub encapsw4 () { ($encapsw46->{_encapsw4});}' unless defined(&encapsw4);
	eval 'sub encapsw6 () { ($encapsw46->{_encapsw6});}' unless defined(&encapsw6);
	eval 'sub local_sa () { ($local_u->{local_u_sa});}' unless defined(&local_sa);
	eval 'sub local_sin () { ($local_u->{local_u_sin});}' unless defined(&local_sin);
	eval 'sub local_sin6 () { ($local_u->{local_u_sin6});}' unless defined(&local_sin6);
	eval 'sub remote_sa () { ($remote_u->{remote_u_sa});}' unless defined(&remote_sa);
	eval 'sub remote_sin () { ($remote_u->{remote_u_sin});}' unless defined(&remote_sin);
	eval 'sub remote_sin6 () { ($remote_u->{remote_u_sin6});}' unless defined(&remote_sin6);
	eval 'sub IP_ENCAP_ADDR_ENABLE () { &__BIT(0);}' unless defined(&IP_ENCAP_ADDR_ENABLE);
	eval 'sub ENCAP_PR_WRAP_CTLINPUT {
	    my($name) = @_;
    	    eval q( &static  &void * $name &_wrapper(\'int\'  &a,  &const \'struct sockaddr\' * &b,  &void * &c,  &void * &d) {  &void * &rv;  &KERNEL_LOCK(1,  &NULL);  &rv = $name( &a,  &b,  &c,  &d);  &KERNEL_UNLOCK_ONE( &NULL);  &return  &rv; });
	}' unless defined(&ENCAP_PR_WRAP_CTLINPUT);
    }
}
1;
