Passa al contenuto principale

A2.3. Pseudo-Code Example (Esempio di pseudo-codice)

A2.3. Pseudo-Code Example (Esempio di pseudo-codice)

Il seguente pseudo-codice illustra gli algoritmi sopra descritti per i controlli anti-replay e di integrità. I valori per 'Seql', 'Tl', 'Th' e 'W' sono interi senza segno a 32 bit. L'aritmetica è mod 2^32.

     If (Tl >= W - 1)                            Caso A
If (Seql >= Tl - W + 1)
Seqh = Th
If (Seql <= Tl)
If (pass replay check)
If (pass integrity check)
Set bit corresponding to Seql
Pass the packet on
Else reject packet
Else reject packet
Else
If (pass integrity check)
Tl = Seql (shift bits)
Set bit corresponding to Seql
Pass the packet on
Else reject packet
Else
Seqh = Th + 1
If (pass integrity check)
Tl = Seql (shift bits)
Th = Th + 1
Set bit corresponding to Seql
Pass the packet on
Else reject packet
Else Caso B
If (Seql >= Tl - W + 1)
Seqh = Th - 1
If (pass replay check)
If (pass integrity check)
Set the bit corresponding to Seql
Pass packet on
Else reject packet
Else reject packet
Else
Seqh = Th
If (Seql <= Tl)
If (pass replay check)
If (pass integrity check)
Set the bit corresponding to Seql
Pass packet on
Else reject packet
Else reject packet
Else
If (pass integrity check)
Tl = Seql (shift bits)
Set the bit corresponding to Seql
Pass packet on
Else reject packet