Passa al contenuto principale

Appendix E. Event Processing (Elaborazione degli eventi)

Appendix E: Event Processing (Elaborazione degli eventi)

Event Processing (Elaborazione degli eventi)

OPEN Call (Chiamata OPEN)

...
An initial send sequence number (ISS) is selected. Send a SYN
segment of the form:

<SEQ=ISS><CTL=SYN><TSval=my.TSclock><WSopt=Rcv.Wind.Scale>

...

Viene selezionato un numero di sequenza di invio iniziale (ISS). Invia un segmento SYN della forma:

<SEQ=ISS><CTL=SYN><TSval=my.TSclock><WSopt=Rcv.Wind.Scale>

...

SEND Call (Chiamata SEND)

CLOSED STATE (i.e., TCB does not exist)

...

LISTEN STATE

If the foreign socket is specified, then change the connection
from passive to active, select an ISS. Send a SYN segment
containing the options: <TSval=my.TSclock> and
<WSopt=Rcv.Wind.Scale>. Set SND.UNA to ISS, SND.NXT to ISS+1.
Enter SYN-SENT state. ...

Se viene specificato il socket esterno, allora cambia la connessione da passiva ad attiva, seleziona un ISS. Invia un segmento SYN contenente le opzioni: <TSval=my.TSclock> e <WSopt=Rcv.Wind.Scale>. Imposta SND.UNA su ISS, SND.NXT su ISS+1. Entra nello stato SYN-SENT...

SYN-SENT STATE
SYN-RECEIVED STATE

...

ESTABLISHED STATE
CLOSE-WAIT STATE

Segmentize the buffer and send it with a piggybacked
acknowledgment (acknowledgment value = RCV.NXT). ...

If the urgent flag is set ...

If the Snd.TS.OK flag is set, then include the TCP Timestamps
option &lt;TSval=my.TSclock,TSecr=TS.Recent> in each data segment.

Scale the receive window for transmission in the segment header:

SEG.WND = (SND.WND >> Rcv.Wind.Scale).

Segmenta il buffer e invialo con un acknowledgment piggyback (valore acknowledgment = RCV.NXT)...

Se il flag urgente è impostato...

Se il flag Snd.TS.OK è impostato, allora includi l'opzione TCP Timestamps <TSval=my.TSclock,TSecr=TS.Recent> in ogni segmento di dati.

Scala la finestra di ricezione per la trasmissione nell'intestazione del segmento:

SEG.WND = (SND.WND >> Rcv.Wind.Scale).

SEGMENT ARRIVES (Arrivo del segmento)

...

If the state is LISTEN then

first check for an RST

...

second check for an ACK

...

third check for a SYN

if the SYN bit is set, check the security. If the ...

...

If the SEG.PRC is less than the TCB.PRC then continue.

Check for a Window Scale option (WSopt); if one is found, save
SEG.WSopt in Snd.Wind.Scale and set Snd.WS.OK flag on.
Otherwise, set both Snd.Wind.Scale and Rcv.Wind.Scale to zero
and clear Snd.WS.OK flag.

Check for a TSopt option; if one is found, save SEG.TSval in the
variable TS.Recent and turn on the Snd.TS.OK bit.

Set RCV.NXT to SEG.SEQ+1, IRS is set to SEG.SEQ and any other
control or text should be queued for processing later. ISS
should be selected and a SYN segment sent of the form:

&lt;SEQ=ISS>&lt;ACK=RCV.NXT>&lt;CTL=SYN,ACK>

If the Snd.WS.OK bit is on, include a WSopt option
&lt;WSopt=Rcv.Wind.Scale> in this segment. If the Snd.TS.OK bit is
on, include a TSopt &lt;TSval=my.TSclock,TSecr=TS.Recent> in this
segment. Last.ACK.sent is set to RCV.NXT.

SND.NXT is set to ISS+1 and SND.UNA to ISS. The connection
state should be changed to SYN-RECEIVED. Note that any other
incoming control or data (combined with SYN) will be processed
in the SYN-RECEIVED state, but processing of SYN and ACK should
not be repeated. If the listen was not fully specified (i.e.,
the foreign socket was not fully specified), then the
unspecified fields should be filled in now.

...

Se lo stato è LISTEN allora

prima controlla un RST

...

secondo controlla un ACK

...

terzo controlla un SYN

se il bit SYN è impostato, controlla la sicurezza. Se il...

...

Se SEG.PRC è minore di TCB.PRC allora continua.

Controlla un'opzione Window Scale (WSopt); se ne viene trovata una, salva SEG.WSopt in Snd.Wind.Scale e imposta il flag Snd.WS.OK. Altrimenti, imposta sia Snd.Wind.Scale che Rcv.Wind.Scale a zero e cancella il flag Snd.WS.OK.

Controlla un'opzione TSopt; se ne viene trovata una, salva SEG.TSval nella variabile TS.Recent e attiva il bit Snd.TS.OK.

Imposta RCV.NXT su SEG.SEQ+1, IRS è impostato su SEG.SEQ e qualsiasi altro controllo o testo dovrebbe essere messo in coda per l'elaborazione successiva. ISS dovrebbe essere selezionato e un segmento SYN inviato della forma:

&lt;SEQ=ISS>&lt;ACK=RCV.NXT>&lt;CTL=SYN,ACK>

Se il bit Snd.WS.OK è attivo, includi un'opzione WSopt <WSopt=Rcv.Wind.Scale> in questo segmento. Se il bit Snd.TS.OK è attivo, includi una TSopt <TSval=my.TSclock,TSecr=TS.Recent> in questo segmento. Last.ACK.sent è impostato su RCV.NXT.

SND.NXT è impostato su ISS+1 e SND.UNA su ISS. Lo stato della connessione dovrebbe essere cambiato in SYN-RECEIVED. Si noti che qualsiasi altro controllo o dati in arrivo (combinati con SYN) verrà elaborato nello stato SYN-RECEIVED, ma l'elaborazione di SYN e ACK non dovrebbe essere ripetuta. Se il listen non era completamente specificato (cioè, il socket esterno non era completamente specificato), allora i campi non specificati dovrebbero essere compilati ora.

fourth other text or control (quarto altro testo o controllo)

...

If the state is SYN-SENT then

first check the ACK bit

...

fourth check the SYN bit

...

If the SYN bit is on and the security/compartment and precedence
are acceptable then, RCV.NXT is set to SEG.SEQ+1, IRS is set to
SEG.SEQ, and any acknowledgements on the retransmission queue
which are thereby acknowledged should be removed.

Check for a Window Scale option (WSopt); if is found, save
SEG.WSopt in Snd.Wind.Scale; otherwise, set both Snd.Wind.Scale
and Rcv.Wind.Scale to zero.

Check for a TSopt option; if one is found, save SEG.TSval in
variable TS.Recent and turn on the Snd.TS.OK bit in the
connection control block. If the ACK bit is set, use my.TSclock
- SEG.TSecr as the initial RTT estimate.

If SND.UNA > ISS (our SYN has been ACKed), change the connection
state to ESTABLISHED, form an ACK segment:

&lt;SEQ=SND.NXT>&lt;ACK=RCV.NXT>&lt;CTL=ACK>

and send it. If the Snd.Echo.OK bit is on, include a TSopt
option &lt;TSval=my.TSclock,TSecr=TS.Recent> in this ACK segment.
Last.ACK.sent is set to RCV.NXT.

Data or controls which were queued for transmission may be
included. If there are other controls or text in the segment
then continue processing at the sixth step below where the URG
bit is checked, otherwise return.

Otherwise enter SYN-RECEIVED, form a SYN,ACK segment:

&lt;SEQ=ISS>&lt;ACK=RCV.NXT>&lt;CTL=SYN,ACK>

and send it. If the Snd.Echo.OK bit is on, include a TSopt
option &lt;TSval=my.TSclock,TSecr=TS.Recent> in this segment.

...

Se lo stato è SYN-SENT allora

prima controlla il bit ACK

...

quarto controlla il bit SYN

...

Se il bit SYN è attivo e la sicurezza/compartimento e la precedenza sono accettabili allora, RCV.NXT è impostato su SEG.SEQ+1, IRS è impostato su SEG.SEQ, e qualsiasi acknowledgment nella coda di ritrasmissione che viene quindi confermato dovrebbe essere rimosso.

Controlla un'opzione Window Scale (WSopt); se viene trovata, salva SEG.WSopt in Snd.Wind.Scale; altrimenti, imposta sia Snd.Wind.Scale che Rcv.Wind.Scale a zero.

Controlla un'opzione TSopt; se ne viene trovata una, salva SEG.TSval nella variabile TS.Recent e attiva il bit Snd.TS.OK nel blocco di controllo della connessione. Se il bit ACK è impostato, usa my.TSclock - SEG.TSecr come stima RTT iniziale.

Se SND.UNA > ISS (il nostro SYN è stato confermato), cambia lo stato della connessione in ESTABLISHED, forma un segmento ACK:

&lt;SEQ=SND.NXT>&lt;ACK=RCV.NXT>&lt;CTL=ACK>

e invialo. Se il bit Snd.Echo.OK è attivo, includi un'opzione TSopt <TSval=my.TSclock,TSecr=TS.Recent> in questo segmento ACK. Last.ACK.sent è impostato su RCV.NXT.

Dati o controlli che erano in coda per la trasmissione possono essere inclusi. Se ci sono altri controlli o testo nel segmento allora continua l'elaborazione al sesto passaggio sotto dove viene controllato il bit URG, altrimenti ritorna.

Altrimenti entra in SYN-RECEIVED, forma un segmento SYN,ACK:

&lt;SEQ=ISS>&lt;ACK=RCV.NXT>&lt;CTL=SYN,ACK>

e invialo. Se il bit Snd.Echo.OK è attivo, includi un'opzione TSopt <TSval=my.TSclock,TSecr=TS.Recent> in questo segmento.

    If the Snd.WS.OK bit is on, include a WSopt option
&lt;WSopt=Rcv.Wind.Scale> in this segment. Last.ACK.sent is set to
RCV.NXT.

If there are other controls or text in the segment, queue them
for processing after the ESTABLISHED state has been reached,
return.

fifth, if neither of the SYN or RST bits is set then drop the
segment and return.

Se il bit Snd.WS.OK è attivo, includi un'opzione WSopt <WSopt=Rcv.Wind.Scale> in questo segmento. Last.ACK.sent è impostato su RCV.NXT.

Se ci sono altri controlli o testo nel segmento, mettili in coda per l'elaborazione dopo che lo stato ESTABLISHED è stato raggiunto, ritorna.

quinto, se né il bit SYN né il bit RST è impostato allora scarta il segmento e ritorna.

Otherwise, (Altrimenti)

First, check sequence number (Primo, controlla il numero di sequenza)

  SYN-RECEIVED STATE
ESTABLISHED STATE
FIN-WAIT-1 STATE
FIN-WAIT-2 STATE
CLOSE-WAIT STATE
CLOSING STATE
LAST-ACK STATE
TIME-WAIT STATE

Segments are processed in sequence. Initial tests on arrival
are used to discard old duplicates, but further processing is
done in SEG.SEQ order. If a segment's contents straddle the
boundary between old and new, only the new parts should be
processed.

Rescale the received window field:

TrueWindow = SEG.WND &lt;&lt; Snd.Wind.Scale,

and use "TrueWindow" in place of SEG.WND in the following steps.

Check whether the segment contains a Timestamps option and bit
Snd.TS.OK is on. If so:

If SEG.TSval &lt; TS.Recent, then test whether connection has
been idle less than 24 days; if both are true, then the
segment is not acceptable; follow steps below for an
unacceptable segment.

If SEG.SEQ is equal to Last.ACK.sent, then save SEG.ECopt in
variable TS.Recent.

SYN-RECEIVED STATE
ESTABLISHED STATE
FIN-WAIT-1 STATE
FIN-WAIT-2 STATE
CLOSE-WAIT STATE
CLOSING STATE
LAST-ACK STATE
TIME-WAIT STATE

I segmenti vengono elaborati in sequenza. I test iniziali all'arrivo vengono utilizzati per scartare vecchi duplicati, ma l'ulteriore elaborazione viene effettuata in ordine SEG.SEQ. Se il contenuto di un segmento attraversa il confine tra vecchio e nuovo, solo le parti nuove dovrebbero essere elaborate.

Riscala il campo della finestra ricevuta:

TrueWindow = SEG.WND &lt;&lt; Snd.Wind.Scale,

e usa "TrueWindow" al posto di SEG.WND nei passaggi seguenti.

Controlla se il segmento contiene un'opzione Timestamps e il bit Snd.TS.OK è attivo. Se sì:

Se SEG.TSval < TS.Recent, allora testa se la connessione è stata inattiva meno di 24 giorni; se entrambi sono veri, allora il segmento non è accettabile; segui i passaggi sotto per un segmento non accettabile.

Se SEG.SEQ è uguale a Last.ACK.sent, allora salva SEG.ECopt nella variabile TS.Recent.

    There are four cases for the acceptability test for an incoming
segment:

...

If an incoming segment is not acceptable, an acknowledgment
should be sent in reply (unless the RST bit is set, if so drop
the segment and return):

&lt;SEQ=SND.NXT>&lt;ACK=RCV.NXT>&lt;CTL=ACK>

Last.ACK.sent is set to SEG.ACK of the acknowledgment. If the
Snd.Echo.OK bit is on, include the Timestamps option
&lt;TSval=my.TSclock,TSecr=TS.Recent> in this ACK segment. Set
Last.ACK.sent to SEG.ACK and send the ACK segment. After
sending the acknowledgment, drop the unacceptable segment and
return.

...

fifth check the ACK field.

if the ACK bit is off drop the segment and return.

if the ACK bit is on

...

ESTABLISHED STATE

If SND.UNA &lt; SEG.ACK =&lt; SND.NXT then, set SND.UNA &lt;- SEG.ACK.
Also compute a new estimate of round-trip time. If Snd.TS.OK
bit is on, use my.TSclock - SEG.TSecr; otherwise use the
elapsed time since the first segment in the retransmission
queue was sent. Any segments on the retransmission queue
which are thereby entirely acknowledged...

...

Seventh, process the segment text.

ESTABLISHED STATE
FIN-WAIT-1 STATE
FIN-WAIT-2 STATE

...

Send an acknowledgment of the form:

&lt;SEQ=SND.NXT>&lt;ACK=RCV.NXT>&lt;CTL=ACK>

If the Snd.TS.OK bit is on, include Timestamps option
&lt;TSval=my.TSclock,TSecr=TS.Recent> in this ACK segment. Set
Last.ACK.sent to SEG.ACK of the acknowledgment, and send it.
This acknowledgment should be piggy-backed on a segment being
transmitted if possible without incurring undue delay.


...

Ci sono quattro casi per il test di accettabilità per un segmento in arrivo:

...

Se un segmento in arrivo non è accettabile, un acknowledgment dovrebbe essere inviato in risposta (a meno che il bit RST non sia impostato, se sì scarta il segmento e ritorna):

&lt;SEQ=SND.NXT>&lt;ACK=RCV.NXT>&lt;CTL=ACK>

Last.ACK.sent è impostato su SEG.ACK dell'acknowledgment. Se il bit Snd.Echo.OK è attivo, includi l'opzione Timestamps <TSval=my.TSclock,TSecr=TS.Recent> in questo segmento ACK. Imposta Last.ACK.sent su SEG.ACK e invia il segmento ACK. Dopo aver inviato l'acknowledgment, scarta il segmento non accettabile e ritorna.

...

quinto controlla il campo ACK.

se il bit ACK è spento scarta il segmento e ritorna.

se il bit ACK è attivo

...

ESTABLISHED STATE

Se SND.UNA < SEG.ACK =< SND.NXT allora, imposta SND.UNA <- SEG.ACK. Calcola anche una nuova stima del tempo di andata e ritorno. Se il bit Snd.TS.OK è attivo, usa my.TSclock - SEG.TSecr; altrimenti usa il tempo trascorso da quando il primo segmento nella coda di ritrasmissione è stato inviato. Qualsiasi segmento nella coda di ritrasmissione che viene quindi completamente confermato...

...

Settimo, elabora il testo del segmento.

ESTABLISHED STATE
FIN-WAIT-1 STATE
FIN-WAIT-2 STATE

...

Invia un acknowledgment della forma:

&lt;SEQ=SND.NXT>&lt;ACK=RCV.NXT>&lt;CTL=ACK>

Se il bit Snd.TS.OK è attivo, includi l'opzione Timestamps <TSval=my.TSclock,TSecr=TS.Recent> in questo segmento ACK. Imposta Last.ACK.sent su SEG.ACK dell'acknowledgment, e invialo. Questo acknowledgment dovrebbe essere trasportato piggyback su un segmento in trasmissione se possibile senza incorrere in ritardi indebiti.

...