- m->m_next = n;
-
- } else /* nothing in send buffer */
- up->uc_sbuf = n;
-
- if (up->uc_flags & UEOL) { /* set EOL */
- tp->snd_end = last;
- }
-
- if (up->uc_flags & UURG) { /* urgent data */
- tp->snd_urp = last+1;
- tp->snd_urg = TRUE;
- }
-
- send(tp);
-
- return(SAME);
-}
-
-sss_rcv(wp) /* rcv request on open connection (42) */
-struct work *wp;
-{
- register struct tcb *tp;
-
-COUNT(SSS_RCV);
- tp = wp->w_tcb;
-
- send_ctl(tp); /* send new window */
- present_data(tp);
-
- return(SAME);
-}
-
-cls_nsy(wp) /* abort request on unsynced connection (44) */
-struct work *wp;
-{
-
-COUNT(CLS_NSY);
- t_close(wp->w_tcb, UABORT);
-
- return(CLOSED);
-}
-
-cls_syn(wp) /* abort request on synced connection (45) */
-struct work *wp;
-{
- register struct tcb *tp;
-
-COUNT(CLS_SYN);
- tp = wp->w_tcb;
-
- tp->snd_rst = TRUE; /* send reset */
- send_null(tp);
- t_close(tp, UABORT);
-
- return(CLOSED);
-}
-
-cls_act(wp) /* net closing open connection (47) */
-struct work *wp;
-{
-
-COUNT(CLS_ACT);
- t_close(wp->w_tcb, UNETDWN);
-
- return(CLOSED);
-}
-
-cls_err(wp) /* invalid user request in closing states */
-struct work *wp;
-{
-COUNT(CLS_ERR);
- to_user(wp->w_tcb->t_ucb, UCLSERR);
-
- return(SAME);
-}
-
-lis_netr(wp) /* incoming seg in LISTEN (3,4) */
-struct work *wp;
-{
- register struct tcb *tp;
- register struct th *n;
-
-COUNT(LIS_NETR);
- tp = wp->w_tcb;
- n = (struct th *)wp->w_dat;
-
- if (!syn_ok(tp, n)) /* must have good SYN */
- return(EFAILEC);
-
- /* fill in unspecified foreign host address. get/create entry
- in foreign host table. if none available, ignore. probably
- should send reset here. */
-
- if ((tp->t_ucb->uc_host = h_make(&n->t_s)) == NULL)
- return(EFAILEC);
-
- tp->t_fport = n->t_src;
-
- rcv_data(tp, n);
-
- if (!tp->fin_rcvd) { /* no FIN (4) */
-
- /* start init timer now that we have foreign host */
-
- tp->t_init = T_INIT/2;
- return(L_SYN_RCVD);
-
- } else { /* got a FIN, start timer (3) */
- tp->t_finack = T_2ML;
- tp->waited_2_ml = FALSE;
- return(CLOSE_WAIT);
- }
-}
-
-sys_netr(wp) /* incoming segment after SYN sent (8,9,11,32) */
-struct work *wp;
-{
- register struct tcb *tp;
- register struct th *n;
-
-COUNT(SYS_NETR);
- tp = wp->w_tcb;
- n = (struct th *)wp->w_dat;
-
- if (!syn_ok(tp, n)) /* must have good SYN */
- return(EFAILEC);
-
- rcv_data(tp, n);
-
- if (tp->fin_rcvd) { /* got a FIN */
-
- /* if good ACK, present any data */
-
- if (n->t_ack) {
-
- if (n->t_ackno > tp->iss) /* 32 */
- present_data(tp);