tcpstart()

tcpstart()

概要

引数

実装

  853: /*
  854:  *  called with s qlocked
  855:  */
  856: void
  857: tcpstart(Conv *s, int mode)
  858: {
  859:         Tcpctl *tcb;
  860:         Tcppriv *tpriv;
  861:         char kpname[KNAMELEN];
  862: 
  863:         tpriv = s->p->priv;
  864: 
  865:         if(tpriv->ackprocstarted == 0){
  866:                 qlock(&tpriv->apl);
  867:                 if(tpriv->ackprocstarted == 0){
  868:                         sprint(kpname, "#I%dtcpack", s->p->f->dev);
  869:                         kproc(kpname, tcpackproc, s->p);
  870:                         tpriv->ackprocstarted = 1;
  871:                 }
  872:                 qunlock(&tpriv->apl);
  873:         }
  874: 
  875:         tcb = (Tcpctl*)s->ptcl;
  876: 
  877:         inittcpctl(s, mode);
  878: 
  879:         iphtadd(&tpriv->ht, s);
  880:         switch(mode) {
  881:         case TCP_LISTEN:
  882:                 tpriv->stats[PassiveOpens]++;
  883:                 tcb->flags |= CLONE;
  884:                 tcpsetstate(s, Listen);
  885:                 break;
  886: 
  887:         case TCP_CONNECT:
  888:                 tpriv->stats[ActiveOpens]++;
  889:                 tcb->flags |= ACTIVE;
  890:                 tcpsndsyn(s, tcb);
  891:                 tcpsetstate(s, Syn_sent);
  892:                 tcpoutput(s);
  893:                 break;
  894:         }
  895: }