require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_NET_TRUNK_H)) {
    eval 'sub _NET_TRUNK_H () {1;}' unless defined(&_NET_TRUNK_H);
    eval 'sub TRUNK_MAX_PORTS () {32;}' unless defined(&TRUNK_MAX_PORTS);
    eval 'sub TRUNK_MAX_NAMESIZE () {32;}' unless defined(&TRUNK_MAX_NAMESIZE);
    eval 'sub TRUNK_MAX_STACKING () {4;}' unless defined(&TRUNK_MAX_STACKING);
    eval 'sub TRUNK_PORT_SLAVE () {0x;}' unless defined(&TRUNK_PORT_SLAVE);
    eval 'sub TRUNK_PORT_MASTER () {0x1;}' unless defined(&TRUNK_PORT_MASTER);
    eval 'sub TRUNK_PORT_STACK () {0x2;}' unless defined(&TRUNK_PORT_STACK);
    eval 'sub TRUNK_PORT_ACTIVE () {0x4;}' unless defined(&TRUNK_PORT_ACTIVE);
    eval 'sub TRUNK_PORT_GLOBAL () {0x80000000;}' unless defined(&TRUNK_PORT_GLOBAL);
    eval 'sub TRUNK_PORT_BITS () {"\\20\\01MASTER\\02STACK\\03ACTIVE";}' unless defined(&TRUNK_PORT_BITS);
    eval("sub TRUNK_PROTO_NONE () { 0; }") unless defined(&TRUNK_PROTO_NONE);
    eval("sub TRUNK_PROTO_ROUNDROBIN () { 1; }") unless defined(&TRUNK_PROTO_ROUNDROBIN);
    eval("sub TRUNK_PROTO_FAILOVER () { 2; }") unless defined(&TRUNK_PROTO_FAILOVER);
    eval("sub TRUNK_PROTO_LOADBALANCE () { 3; }") unless defined(&TRUNK_PROTO_LOADBALANCE);
    eval("sub TRUNK_PROTO_MAX () { 4; }") unless defined(&TRUNK_PROTO_MAX);
    eval 'sub TRUNK_PROTO_DEFAULT () { &TRUNK_PROTO_ROUNDROBIN;}' unless defined(&TRUNK_PROTO_DEFAULT);
    eval 'sub TRUNK_PROTOS () {{ { "roundrobin",  &TRUNK_PROTO_ROUNDROBIN }, { "failover",  &TRUNK_PROTO_FAILOVER }, { "loadbalance",  &TRUNK_PROTO_LOADBALANCE }, { "none",  &TRUNK_PROTO_NONE }, { "default",  &TRUNK_PROTO_DEFAULT } };}' unless defined(&TRUNK_PROTOS);
    eval 'sub SIOCGTRUNKPORT () { &_IOWR(ord(\'i\'), 140, \'struct trunk_reqport\');}' unless defined(&SIOCGTRUNKPORT);
    eval 'sub SIOCSTRUNKPORT () { &_IOW(ord(\'i\'), 141, \'struct trunk_reqport\');}' unless defined(&SIOCSTRUNKPORT);
    eval 'sub SIOCSTRUNKDELPORT () { &_IOW(ord(\'i\'), 142, \'struct trunk_reqport\');}' unless defined(&SIOCSTRUNKDELPORT);
    eval 'sub SIOCGTRUNK () { &_IOWR(ord(\'i\'), 143, \'struct trunk_reqall\');}' unless defined(&SIOCGTRUNK);
    eval 'sub SIOCSTRUNK () { &_IOW(ord(\'i\'), 144, \'struct trunk_reqall\');}' unless defined(&SIOCSTRUNK);
    if(defined(&_KERNEL)) {
	eval 'sub tp_ifname () { ($tp_if->{if_xname});}' unless defined(&tp_ifname);
	eval 'sub tp_ifflags () { ($tp_if->{if_flags});}' unless defined(&tp_ifflags);
	eval 'sub tp_link_state () { ($tp_if->{if_link_state});}' unless defined(&tp_link_state);
	eval 'sub tp_capabilities () { ($tp_if->{if_capabilities});}' unless defined(&tp_capabilities);
	eval 'sub TRUNK_PORTACTIVE {
	    my($_tp) = @_;
    	    eval q(( ( &LINK_STATE_IS_UP(($_tp)-> &tp_link_state))  && (($_tp)-> &tp_ifflags &  &IFF_UP) ));
	}' unless defined(&TRUNK_PORTACTIVE);
	eval 'sub mc_enm () { ($mc_u->{mcu_enm});}' unless defined(&mc_enm);
	eval 'sub tr_ifflags () { ($tr_ac->{ac_if}->{if_flags});}' unless defined(&tr_ifflags);
	eval 'sub tr_ifname () { ($tr_ac->{ac_if}->{if_xname});}' unless defined(&tr_ifname);
	eval 'sub tr_capabilities () { ($tr_ac->{ac_if}->{if_capabilities});}' unless defined(&tr_capabilities);
	eval 'sub IFCAP_TRUNK_MASK () {0xffff0000;}' unless defined(&IFCAP_TRUNK_MASK);
	eval 'sub IFCAP_TRUNK_FULLDUPLEX () {0x10000;}' unless defined(&IFCAP_TRUNK_FULLDUPLEX);
	eval 'sub TRUNK_LB_MAXKEYS () {8;}' unless defined(&TRUNK_LB_MAXKEYS);
    }
}
1;
