| java.lang.Object sun.security.jgss.TokenTracker
TokenTracker | public class TokenTracker (Code) | | A utility class that implements a number list that keeps track of which
tokens have arrived by storing their token numbers in the list. It helps
detect old tokens, out of sequence tokens, and duplicate tokens.
Each element of the list is an interval [a, b]. Its existence in the
list implies that all token numbers in the range a, a+1, ..., b-1, b
have arrived. Gaps in arrived token numbers are represented by the
numbers that fall in between two elements of the list. eg. {[a,b],
[c,d]} indicates that the token numbers b+1, ..., c-1 have not arrived
yet.
The maximum number of intervals that we keep track of is
MAX_INTERVALS. Thus if there are too many gaps, then some of the older
sequence numbers are deleted from the list. The earliest sequence number
that exists in the list is the windowStart. The next expected sequence
number, or expectedNumber, is one greater than the latest sequence
number in the list.
The list keeps track the first token number that should have arrived
(initNumber) so that it is able to detect if certain numbers occur after
the first valid token number but before windowStart. That would happen
if the number of elements (intervals) exceeds MAX_INTERVALS and some
initial elements had to be deleted.
The working of the list is optimized for the normal case where the
tokens arrive in sequence.
author: Mayank Upadhyay version: 1.15, 05/05/07 since: 1.4 |
Method Summary | |
final public synchronized void | getProps(int number, MessageProp prop) Sets the sequencing and replay information for the given token
number.
The following represents the number line with positions of
initNumber, windowStart, expectedNumber marked on it. | public String | toString() |
MAX_INTERVALS | final static int MAX_INTERVALS(Code) | | |
TokenTracker | public TokenTracker(int initNumber)(Code) | | |
getProps | final public synchronized void getProps(int number, MessageProp prop)(Code) | | Sets the sequencing and replay information for the given token
number.
The following represents the number line with positions of
initNumber, windowStart, expectedNumber marked on it. Regions in
between them show the different sequencing and replay state
possibilites for tokens that fall in there.
(1) windowStart
initNumber expectedNumber
| |
---|---------------------------|---
GAP | DUP/UNSEQ | GAP
(2) initNumber windowStart expectedNumber
| | |
---|---------------|--------------|---
GAP | OLD | DUP/UNSEQ | GAP
(3) windowStart
expectedNumber initNumber
| |
---|---------------------------|---
DUP/UNSEQ | GAP | DUP/UNSEQ
(4) expectedNumber initNumber windowStart
| | |
---|---------------|--------------|---
DUP/UNSEQ | GAP | OLD | DUP/UNSEQ
(5) windowStart expectedNumber initNumber
| | |
---|---------------|--------------|---
OLD | DUP/UNSEQ | GAP | OLD
(This analysis leaves out the possibility that expectedNumber passes
initNumber after wrapping around. That may be added later.)
|
|
|