/*******************************************/
/* DESCRIPTION */

// This file contains the code for implementing a TCP tunnel
// over an unencrypted TCP channel.


/*******************************************/
/* INCLUDES */

#ifndef __TCP_BY_TCP_TUNNEL_H__
#define __TCP_BY_TCP_TUNNEL_H__

#include "encap.h"


/*******************************************/
/* DEFINES AND ENUM */


/*******************************************/
/* PROTOTYPES */

int transfer_tcp_data(round_buf * in_rb_ptr, round_buf * out_rb_ptr);


class tcp_encoder:public data_stream_encoder {
  public:

    virtual int encode(round_buf * in_rb_ptr, round_buf * out_rb_ptr) {
	return transfer_tcp_data(in_rb_ptr, out_rb_ptr);
    } virtual bool has_unflushed_data() {
	return 0;
    }
};


class tcp_decoder:public data_stream_decoder {
  public:

    virtual int decode(round_buf * in_rb_ptr, round_buf * out_rb_ptr) {
	return transfer_tcp_data(in_rb_ptr, out_rb_ptr);
    } virtual bool has_unflushed_data() {
	return 0;
    }
};

class tcp_by_tcp_tunnel:public tcp_by_generic_tcp {
  public:

    virtual int get_l2r_coder(data_stream_encoder ** encoder,
			      data_stream_decoder ** decoder) {
	*encoder = new tcp_encoder;
	*decoder = new tcp_decoder;

	return 0;
    } virtual int get_r2l_coder(data_stream_encoder ** encoder,
				data_stream_decoder ** decoder) {
	*encoder = new tcp_encoder;
	*decoder = new tcp_decoder;

	return 0;
    }
};



#endif
