summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/netinet/tcp.h33
-rw-r--r--sys/netinet/tcp_seq.h27
-rw-r--r--sys/netinet/tcp_timer.h6
-rw-r--r--sys/netinet/tcp_var.h88
-rw-r--r--sys/netinet/tcpip.h12
5 files changed, 157 insertions, 9 deletions
diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h
index 03b8e53..c72ef48 100644
--- a/sys/netinet/tcp.h
+++ b/sys/netinet/tcp.h
@@ -31,13 +31,17 @@
* SUCH DAMAGE.
*
* @(#)tcp.h 8.1 (Berkeley) 6/10/93
- * $Id: tcp.h,v 1.2 1994/08/02 07:48:52 davidg Exp $
+ * $Id: tcp.h,v 1.3 1994/08/21 05:27:34 paul Exp $
*/
#ifndef _NETINET_TCP_H_
#define _NETINET_TCP_H_
typedef u_long tcp_seq;
+#ifdef TTCP
+typedef u_long tcp_cc; /* connection count per rfc1644 */
+#endif
+
/*
* TCP header.
* Per RFC 793, September, 1981.
@@ -62,6 +66,9 @@ struct tcphdr {
#define TH_PUSH 0x08
#define TH_ACK 0x10
#define TH_URG 0x20
+#ifdef TTCP
+#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG)
+#endif
u_short th_win; /* window */
u_short th_sum; /* checksum */
u_short th_urp; /* urgent pointer */
@@ -79,10 +86,19 @@ struct tcphdr {
#define TCPOPT_TIMESTAMP 8
#define TCPOLEN_TIMESTAMP 10
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
-
-#define TCPOPT_TSTAMP_HDR \
+#define TCPOPT_TSTAMP_HDR \
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
+#ifdef TTCP
+#define TCPOPT_CC 11 /* CC options: RFC-1644 */
+#define TCPOPT_CCNEW 12
+#define TCPOPT_CCECHO 13
+#define TCPOLEN_CC 6
+#define TCPOLEN_CC_APPA (TCPOLEN_CC+2)
+#define TCPOPT_CC_HDR(ccopt) \
+ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC)
+#endif
+
/*
* Default maximum segment size for TCP.
* With an IP MSS of 576, this is 536,
@@ -92,13 +108,24 @@ struct tcphdr {
#define TCP_MSS 512
#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
+#ifdef TTCP
+#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */
+#endif
#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
+#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */
+#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr))
+ /* max space left for options */
+
/*
* User-settable options (used with setsockopt).
*/
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
#define TCP_MAXSEG 0x02 /* set maximum segment size */
+#ifdef TTCP
+#define TCP_NOPUSH 0x04 /* don't push last block of write */
+#define TCP_NOOPT 0x08 /* don't use TCP options */
+#endif
#endif
diff --git a/sys/netinet/tcp_seq.h b/sys/netinet/tcp_seq.h
index d6dc919..257e417 100644
--- a/sys/netinet/tcp_seq.h
+++ b/sys/netinet/tcp_seq.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_seq.h 8.1 (Berkeley) 6/10/93
- * $Id: tcp_seq.h,v 1.2 1994/08/02 07:49:06 davidg Exp $
+ * $Id: tcp_seq.h,v 1.3 1994/08/21 05:27:37 paul Exp $
*/
#ifndef _NETINET_TCP_SEQ_H_
@@ -46,6 +46,25 @@
#define SEQ_GT(a,b) ((int)((a)-(b)) > 0)
#define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0)
+/* for modulo comparisons of timestamps */
+#define TSTMP_LT(a,b) ((int)((a)-(b)) < 0)
+#define TSTMP_GEQ(a,b) ((int)((a)-(b)) >= 0)
+
+#ifdef TTCP
+/*
+ * TCP connection counts are 32 bit integers operated
+ * on with modular arithmetic. These macros can be
+ * used to compare such integers.
+ */
+#define CC_LT(a,b) ((int)((a)-(b)) < 0)
+#define CC_LEQ(a,b) ((int)((a)-(b)) <= 0)
+#define CC_GT(a,b) ((int)((a)-(b)) > 0)
+#define CC_GEQ(a,b) ((int)((a)-(b)) >= 0)
+
+/* Macro to increment a CC: skip 0 which has a special meaning */
+#define CC_INC(c) (++(c) == 0 ? ++(c) : (c))
+#endif
+
/*
* Macros to initialize tcp sequence numbers for
* send and receive from initial send and receive
@@ -60,7 +79,13 @@
#define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */
+#define TCP_PAWS_IDLE (24 * 24 * 60 * 60 * PR_SLOWHZ)
+ /* timestamp wrap-around time */
+
#ifdef KERNEL
tcp_seq tcp_iss; /* tcp initial send seq # */
+#ifdef TTCP
+tcp_cc tcp_ccgen; /* global connection count */
+#endif
#endif
#endif
diff --git a/sys/netinet/tcp_timer.h b/sys/netinet/tcp_timer.h
index d96ddc4..b3ae822 100644
--- a/sys/netinet/tcp_timer.h
+++ b/sys/netinet/tcp_timer.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93
- * $Id: tcp_timer.h,v 1.3 1994/08/02 07:49:12 davidg Exp $
+ * $Id: tcp_timer.h,v 1.4 1994/08/21 05:27:38 paul Exp $
*/
#ifndef _NETINET_TCP_TIMER_H_
@@ -103,6 +103,10 @@
#define TCPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */
#define TCPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */
+#ifdef TTCP
+#define TCPTV_TWTRUNC 8 /* RTO factor to truncate TW */
+#endif
+
#define TCP_LINGERTIME 120 /* linger at most 2 minutes */
#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 7e4192e..4fbe4e7 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_var.h 8.3 (Berkeley) 4/10/94
- * $Id: tcp_var.h,v 1.2 1994/08/02 07:49:17 davidg Exp $
+ * $Id: tcp_var.h,v 1.3 1994/08/21 05:27:39 paul Exp $
*/
#ifndef _NETINET_TCP_VAR_H_
@@ -52,6 +52,7 @@ struct tcpcb {
short t_rxtcur; /* current retransmit value */
short t_dupacks; /* consecutive dup acks recd */
u_short t_maxseg; /* maximum segment size */
+ u_short t_maxopd; /* mss plus options */
char t_force; /* 1 if forcing out a byte */
u_short t_flags;
#define TF_ACKNOW 0x0001 /* ack peer immediately */
@@ -64,6 +65,13 @@ struct tcpcb {
#define TF_REQ_TSTMP 0x0080 /* have/will request timestamps */
#define TF_RCVD_TSTMP 0x0100 /* a timestamp was received in SYN */
#define TF_SACK_PERMIT 0x0200 /* other side said I could SACK */
+#ifdef TTCP
+#define TF_NEEDSYN 0x0400 /* send SYN (implicit state) */
+#define TF_NEEDFIN 0x0800 /* send FIN (implicit state) */
+#define TF_NOPUSH 0x1000 /* don't push */
+#define TF_REQ_CC 0x2000 /* have/will request CC */
+#define TF_RCVD_CC 0x4000 /* a CC was received in SYN */
+#endif
struct tcpiphdr *t_template; /* skeletal packet for transmit */
struct inpcb *t_inpcb; /* back pointer to internet pcb */
@@ -126,11 +134,54 @@ struct tcpcb {
u_long ts_recent; /* timestamp echo data */
u_long ts_recent_age; /* when last updated */
tcp_seq last_ack_sent;
+#ifdef TTCP
+/* RFC 1644 variables */
+ tcp_cc cc_send; /* send connection count */
+ tcp_cc cc_recv; /* receive connection count */
+ u_long t_duration; /* connection duration */
+#endif /* TTCP */
/* TUBA stuff */
caddr_t t_tuba_pcb; /* next level down pcb for TCP over z */
};
+#ifdef TTCP
+/*
+ * Structure to hold TCP options that are only used during segment
+ * processing (in tcp_input), but not held in the tcpcb.
+ * It's basically used to reduce the number of parameters
+ * to tcp_dooptions.
+ */
+struct tcpopt {
+ u_long to_flag; /* which options are present */
+#define TOF_TS 0x0001 /* timestamp */
+#define TOF_CC 0x0002 /* CC and CCnew are exclusive */
+#define TOF_CCNEW 0x0004
+#define TOF_CCECHO 0x0008
+ u_long to_tsval;
+ u_long to_tsecr;
+ tcp_cc to_cc; /* holds CC or CCnew */
+ tcp_cc to_ccecho;
+};
+
+/*
+ * The TAO cache entry which is stored in the protocol family specific
+ * portion of the route metrics.
+ */
+struct rmxp_tao {
+ tcp_cc tao_cc; /* latest CC in valid SYN */
+ tcp_cc tao_ccsent; /* latest CC sent to peer */
+ u_short tao_mssopt; /* peer's cached MSS */
+#ifdef notyet
+ u_short tao_flags; /* cache status flags */
+#define TAOF_DONT 0x0001 /* peer doesn't understand rfc1644 */
+#define TAOF_OK 0x0002 /* peer does understand rfc1644 */
+#define TAOF_UNDEF 0 /* we don't know yet */
+#endif /* notyet */
+};
+#define rmx_taop(r) ((struct rmxp_tao *)&(r).rmx_pspec)
+#endif /* TTCP */
+
#define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb)
#define sototcpcb(so) (intotcpcb(sotoinpcb(so)))
@@ -146,7 +197,7 @@ struct tcpcb {
#define TCP_RTT_SCALE 8 /* multiplier for srtt; 3 bits frac. */
#define TCP_RTT_SHIFT 3 /* shift for srtt; 3 bits frac. */
#define TCP_RTTVAR_SCALE 4 /* multiplier for rttvar; 2 bits */
-#define TCP_RTTVAR_SHIFT 2 /* multiplier for rttvar; 2 bits */
+#define TCP_RTTVAR_SHIFT 2 /* shift for rttvar; 2 bits */
/*
* The initial retransmission should happen at rtt + 4 * rttvar.
@@ -234,6 +285,21 @@ struct tcpstat {
u_long tcps_pcbcachemiss;
};
+/*
+ * Names for TCP sysctl objects
+ */
+#define TCPCTL_DO_RFC1323 1 /* use RFC-1323 extensions */
+#define TCPCTL_DO_RFC1644 2 /* use RFC-1644 extensions */
+#define TCPCTL_MSSDFLT 3 /* MSS default */
+#define TCPCTL_MAXID 4
+
+#define TCPCTL_NAMES { \
+ { 0, 0 }, \
+ { "do_rfc1323", CTLTYPE_INT }, \
+ { "do_rfc1644", CTLTYPE_INT }, \
+ { "mssdflt", CTLTYPE_INT }, \
+}
+
#ifdef KERNEL
struct inpcb tcb; /* head of queue of active tcpcb's */
struct tcpstat tcpstat; /* tcp statistics */
@@ -243,19 +309,32 @@ int tcp_attach __P((struct socket *));
void tcp_canceltimers __P((struct tcpcb *));
struct tcpcb *
tcp_close __P((struct tcpcb *));
+#ifdef TTCP
+int tcp_connect __P((struct tcpcb *, struct mbuf *));
+#endif
void tcp_ctlinput __P((int, struct sockaddr *, struct ip *));
int tcp_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
struct tcpcb *
tcp_disconnect __P((struct tcpcb *));
struct tcpcb *
tcp_drop __P((struct tcpcb *, int));
+#ifdef TTCP
+void tcp_dooptions __P((struct tcpcb *,
+ u_char *, int, struct tcpiphdr *, struct tcpopt *));
+#else
void tcp_dooptions __P((struct tcpcb *,
u_char *, int, struct tcpiphdr *, int *, u_long *, u_long *));
+#endif
void tcp_drain __P((void));
void tcp_fasttimo __P((void));
+#ifdef TTCP
+struct rmxp_tao *
+ tcp_gettaocache __P((struct inpcb *));
+#endif
void tcp_init __P((void));
void tcp_input __P((struct mbuf *, int));
-int tcp_mss __P((struct tcpcb *, u_int));
+void tcp_mss __P((struct tcpcb *, int));
+int tcp_mssopt __P((struct tcpcb *));
struct tcpcb *
tcp_newtcpcb __P((struct inpcb *));
void tcp_notify __P((struct inpcb *, int));
@@ -266,8 +345,11 @@ void tcp_quench __P((struct inpcb *, int));
int tcp_reass __P((struct tcpcb *, struct tcpiphdr *, struct mbuf *));
void tcp_respond __P((struct tcpcb *,
struct tcpiphdr *, struct mbuf *, u_long, u_long, int));
+struct rtentry *
+ tcp_rtlookup __P((struct inpcb *));
void tcp_setpersist __P((struct tcpcb *));
void tcp_slowtimo __P((void));
+int tcp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
struct tcpiphdr *
tcp_template __P((struct tcpcb *));
struct tcpcb *
diff --git a/sys/netinet/tcpip.h b/sys/netinet/tcpip.h
index a8a876c..bc71fbc 100644
--- a/sys/netinet/tcpip.h
+++ b/sys/netinet/tcpip.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcpip.h 8.1 (Berkeley) 6/10/93
- * $Id: tcpip.h,v 1.2 1994/08/02 07:49:19 davidg Exp $
+ * $Id: tcpip.h,v 1.3 1994/08/21 05:27:40 paul Exp $
*/
#ifndef _NETINET_TCPIP_H_
@@ -44,6 +44,16 @@ struct tcpiphdr {
struct ipovly ti_i; /* overlaid ip structure */
struct tcphdr ti_t; /* tcp header */
};
+#ifdef notyet
+/*
+ * Tcp+ip header, after ip options removed but including TCP options.
+ */
+struct full_tcpiphdr {
+ struct ipovly ti_i; /* overlaid ip structure */
+ struct tcphdr ti_t; /* tcp header */
+ char ti_o[TCP_MAXOLEN]; /* space for tcp options */
+};
+#endif /* notyet */
#define ti_next ti_i.ih_next
#define ti_prev ti_i.ih_prev
#define ti_x1 ti_i.ih_x1
OpenPOWER on IntegriCloud