/* Create template to be used to send tcp packets on a connection. Call after host entry created, fills in a skeletal tcp/ip header, minimizing the amount of work necessary when the connection is used.  */
void tcp_template(struct tcpcb *tp)
/* Create template to be used to send tcp packets on a connection. Call after host entry created, fills in a skeletal tcp/ip header, minimizing the amount of work necessary when the connection is used.  */
void tcp_template(struct tcpcb *tp)
{
	struct socket *so = tp->t_socket;
	register struct tcpiphdr *n = &tp->t_template;
	n->ti_mbuf = NULL;
	n->ti_x1 = 0;
	n->ti_pr = IPPROTO_TCP;
	n->ti_len = htons(sizeof (struct tcpiphdr) - sizeof (struct ip));
	n->ti_src = so->so_faddr;
	n->ti_dst = so->so_laddr;
	n->ti_sport = so->so_fport;
	n->ti_dport = so->so_lport;
	n->ti_seq = 0;
	n->ti_ack = 0;
	n->ti_x2 = 0;
	n->ti_off = 5;
	n->ti_flags = 0;
	n->ti_win = 0;
	n->ti_sum = 0;
	n->ti_urp = 0;
}