require '_h2ph_pre.ph';

unless(defined(&_LINUX_TCP_H)) {
    eval 'sub _LINUX_TCP_H () {1;}' unless defined(&_LINUX_TCP_H);
    require 'linux/types.ph';
    require 'asm/byteorder.ph';
    if(defined( &__LITTLE_ENDIAN_BITFIELD)) {
    }
 elsif(defined( &__BIG_ENDIAN_BITFIELD)) {
    } else {
	die("Adjust your <asm/byteorder.h> defines");
    }
    eval("sub TCP_ESTABLISHED () { 1; }") unless defined(&TCP_ESTABLISHED);
    eval("sub TCP_SYN_SENT () { 2; }") unless defined(&TCP_SYN_SENT);
    eval("sub TCP_SYN_RECV () { 3; }") unless defined(&TCP_SYN_RECV);
    eval("sub TCP_FIN_WAIT1 () { 4; }") unless defined(&TCP_FIN_WAIT1);
    eval("sub TCP_FIN_WAIT2 () { 5; }") unless defined(&TCP_FIN_WAIT2);
    eval("sub TCP_TIME_WAIT () { 6; }") unless defined(&TCP_TIME_WAIT);
    eval("sub TCP_CLOSE () { 7; }") unless defined(&TCP_CLOSE);
    eval("sub TCP_CLOSE_WAIT () { 8; }") unless defined(&TCP_CLOSE_WAIT);
    eval("sub TCP_LAST_ACK () { 9; }") unless defined(&TCP_LAST_ACK);
    eval("sub TCP_LISTEN () { 10; }") unless defined(&TCP_LISTEN);
    eval("sub TCP_CLOSING () { 11; }") unless defined(&TCP_CLOSING);
    eval("sub TCP_MAX_STATES () { 12; }") unless defined(&TCP_MAX_STATES);
    eval 'sub TCP_STATE_MASK () {0xf;}' unless defined(&TCP_STATE_MASK);
    eval 'sub TCP_ACTION_FIN () {(1<< 7);}' unless defined(&TCP_ACTION_FIN);
    eval("sub TCPF_ESTABLISHED () { (1<<1); }") unless defined(&TCPF_ESTABLISHED);
    eval("sub TCPF_SYN_SENT () { (1<<2); }") unless defined(&TCPF_SYN_SENT);
    eval("sub TCPF_SYN_RECV () { (1<<3); }") unless defined(&TCPF_SYN_RECV);
    eval("sub TCPF_FIN_WAIT1 () { (1<<4); }") unless defined(&TCPF_FIN_WAIT1);
    eval("sub TCPF_FIN_WAIT2 () { (1<<5); }") unless defined(&TCPF_FIN_WAIT2);
    eval("sub TCPF_TIME_WAIT () { (1<<6); }") unless defined(&TCPF_TIME_WAIT);
    eval("sub TCPF_CLOSE () { (1<<7); }") unless defined(&TCPF_CLOSE);
    eval("sub TCPF_CLOSE_WAIT () { (1<<8); }") unless defined(&TCPF_CLOSE_WAIT);
    eval("sub TCPF_LAST_ACK () { (1<<9); }") unless defined(&TCPF_LAST_ACK);
    eval("sub TCPF_LISTEN () { (1<<10); }") unless defined(&TCPF_LISTEN);
    eval("sub TCPF_CLOSING () { (1<<11); }") unless defined(&TCPF_CLOSING);
    eval 'sub tcp_flag_word {
        local($tp) = @_;
	    eval q(( (($tp))-> &words [3]));
    }' unless defined(&tcp_flag_word);
    eval("sub TCP_FLAG_CWR () { __constant_htonl(0x00800000); }") unless defined(&TCP_FLAG_CWR);
    eval("sub TCP_FLAG_ECE () { __constant_htonl(0x00400000); }") unless defined(&TCP_FLAG_ECE);
    eval("sub TCP_FLAG_URG () { __constant_htonl(0x00200000); }") unless defined(&TCP_FLAG_URG);
    eval("sub TCP_FLAG_ACK () { __constant_htonl(0x00100000); }") unless defined(&TCP_FLAG_ACK);
    eval("sub TCP_FLAG_PSH () { __constant_htonl(0x00080000); }") unless defined(&TCP_FLAG_PSH);
    eval("sub TCP_FLAG_RST () { __constant_htonl(0x00040000); }") unless defined(&TCP_FLAG_RST);
    eval("sub TCP_FLAG_SYN () { __constant_htonl(0x00020000); }") unless defined(&TCP_FLAG_SYN);
    eval("sub TCP_FLAG_FIN () { __constant_htonl(0x00010000); }") unless defined(&TCP_FLAG_FIN);
    eval("sub TCP_RESERVED_BITS () { __constant_htonl(0x0FC00000); }") unless defined(&TCP_RESERVED_BITS);
    eval("sub TCP_DATA_OFFSET () { __constant_htonl(0xF0000000); }") unless defined(&TCP_DATA_OFFSET);
    eval 'sub TCP_NODELAY () {1;}' unless defined(&TCP_NODELAY);
    eval 'sub TCP_MAXSEG () {2;}' unless defined(&TCP_MAXSEG);
    eval 'sub TCP_CORK () {3;}' unless defined(&TCP_CORK);
    eval 'sub TCP_KEEPIDLE () {4;}' unless defined(&TCP_KEEPIDLE);
    eval 'sub TCP_KEEPINTVL () {5;}' unless defined(&TCP_KEEPINTVL);
    eval 'sub TCP_KEEPCNT () {6;}' unless defined(&TCP_KEEPCNT);
    eval 'sub TCP_SYNCNT () {7;}' unless defined(&TCP_SYNCNT);
    eval 'sub TCP_LINGER2 () {8;}' unless defined(&TCP_LINGER2);
    eval 'sub TCP_DEFER_ACCEPT () {9;}' unless defined(&TCP_DEFER_ACCEPT);
    eval 'sub TCP_WINDOW_CLAMP () {10;}' unless defined(&TCP_WINDOW_CLAMP);
    eval 'sub TCP_INFO () {11;}' unless defined(&TCP_INFO);
    eval 'sub TCP_QUICKACK () {12;}' unless defined(&TCP_QUICKACK);
    eval 'sub TCPI_OPT_TIMESTAMPS () {1;}' unless defined(&TCPI_OPT_TIMESTAMPS);
    eval 'sub TCPI_OPT_SACK () {2;}' unless defined(&TCPI_OPT_SACK);
    eval 'sub TCPI_OPT_WSCALE () {4;}' unless defined(&TCPI_OPT_WSCALE);
    eval 'sub TCPI_OPT_ECN () {8;}' unless defined(&TCPI_OPT_ECN);
    eval("sub TCP_CA_Open () { 0; }") unless defined(&TCP_CA_Open);
    eval("sub  () { 1; }") unless defined(&);
    eval("sub  () { 2; }") unless defined(&);
    eval("sub  () { 3; }") unless defined(&);
    eval("sub  () { 4; }") unless defined(&);
}
1;
