/* 
 * btcp.h
 *
 * x-kernel v3.3
 *
 * Copyright (c) 1996,1993,1991,1990  Arizona Board of Regents
 */

#ifndef btcp_h
#define btcp_h

/*
 * Flags for modifications to the original BSD Lite TCP code
 *
 * FIX_0  A minor bug (> rather than >=) when reseting congestion window
 *        after it is inflated.
 * FIX_1  Fixes bug in header prediction code. The original code would not
 *        reset the congestion window when doing header prediction after
 *        it was inflated by the Fast Retransmit code.
 * FIX_2  Modifies the timeout code to be more accurate.
 * FIX_3  Turns off PAWS as a test of fixing acking frequency. When PAWS
 *        are being used, it only acks every three packets.
 * FIX_4  Doesn't use the extra 1/8th of a maximum window size when
 *        increasing the congestion window with each ACK.
 * FIX_5  Forces an ACK/packet rather than the usual ACK/2 packets. This
 *        is used for experimenting.
 * FIX_6  Modification to prevent sending too much data at once when
 *        receiving large ACKs. For experimenting.
 * FIX_7  Makes TCP send two packets at the beginning of slow-start (instead
 *        of just one).
 * VERS   Version of TCP (which fixes).
 */

#define MAIN_FIX
/* #define ACK_EVERY */
#define VERS 0

#ifdef MAIN_FIX
#define FIX_0
#define FIX_1
#define FIX_2
#define FIX_3
#define FIX_4
#undef VERS
#define VERS 4
#endif

#ifdef ACK_EVERY
#define FIX_5
#undef VERS
#define VERS 5
#endif

/*
 * btcp_subr.c
 */
struct tcpiphdr *btcp_template(struct tcpcb *);
struct tcpcb    *btcp_newtcpcp(PSTATE *, struct inpcb *);
struct tcpcb    *btcp_drop(struct tcpcb *, int);
struct tcpcb    *btcp_destroy(struct tcpcb *);
void            btcp_notify(struct inpcb *, int);
void            btcp_quench(struct inpcb *);
void btcp_respond(Protl, struct tcpcb *, struct tcphdr *, IPpseudoHdr *,
		  tcp_seq, tcp_seq, int);

/* 
 * btcp_timer.c
 */
void         btcp_fasttimo(Event, VOID *);
void         btcp_slowtimo(Event, VOID *);
void         btcp_canceltimers(struct tcpcb *);
struct tcpcb *btcp_timers(struct tcpcb *, int, void *);

/*
 * btcp_x.c
 */
Sessn btcp_sonewconn(Protl, Protl, Protl, IPhost *, IPhost *, int, int);

/*
 * btcp_output.c
 */
int btcp_output(struct tcpcb *);

/*
 * btcp_usrreq.c
 */
int          btcp_attach(PSTATE *, Sessn);
int          btcp_usrreq(Sessn, int, Msg *, Msg *);
struct tcpcb *btcp_disconnect(struct tcpcb *);
struct tcpcb  *btcp_usrclosed(struct tcpcb *);

/* 
 * btcp_input.c
 */
XkReturn btcp_input(Protl, Sessn, Msg *);
XkReturn btcpPop(Sessn, Sessn, Msg *, void *);

#endif /* btcp_h */
