1. Overview
In this tutorial, we’ll explain the token access control protocol described in IBM’s token ring network article.
2. Controlled Access Protocol
A controlled access protocol is a protocol in which a node has to wait for permission to send data. In contrast, random access protocols allow nodes in the network can send data at will.
In random access protocols, two nodes may collide if they send data simultaneously, which hampers efficiency. Controlled access protocols address this issue by allowing only one node to access the network at a time.
2.1. Token Passing
There are three types of controlled access protocols: reservation, polling, and token passing. The authorization mechanism differs for each protocol type.
The token access control protocol manages the data flow on a ring network. A node network can gain access to the network only if it has the token. Otherwise, it waits to get it.
3. Frame Structures
The token access protocol divides the transferred data into units we call frames. There are two types of frame structures: the data and token frame structures.
3.1. Data Frame Structure
The data frame structure contains a header, information, and trailer:
The physical header is a three-byte field composed of multiple parts:
- The starting delimiter (SD) field is a unique pattern that marks the start of the frame
- The access control (AC) field is a one-byte field used to control access to the network
- The frame control (FC) field has two fields, the frame format indicator and the control indicator. The former determines the type of data in the information field
- The header includes the source and destination addresses of the communicating nodes
- The routing information (RI) field is an optional field used in case the frame must travel across rings to get to the destination node
The information part has two fields: the data link control field and the data field. Higher-level protocols use the data link control field. The data field has a variable length and contains the actual message.
Finally, we have the physical trailer:
- The frame check sequence (FCS) is a four-byte field used for transmission error detection. The FCS is a 32-bit cyclic redundancy check (CRC) computed by the source node
- The ending delimiter (ED) field marks the end of the frame. The ED field contains a 0ne-bit named the error detector (E) bit. The E bit is changed to one by a ring adapter when it finds out the FCS field has an error
- The frame status (FS) field has two sub-fields, the address recognized (A) field and the copied (C) field. The destination node changes the sub-fields once it receives an addressed frame. The A field indicates whether the addressed frame has been received by the destination node. The C field indicates whether the destination node has copied the frame
3.2. Token Frame Structure
The token frame structure used in the token access protocol is visible below:
The priority mode (PM) field combined with the priority reservation (PR) field makes available multiple priority levels.
The monitor count (MC) field has one bit. The MC field, along with the token monitor function, prevents the continuous flow of a frame around the network.
The token bit (T) field is a one-bit token indicator. It denotes if the frame is a token or a data frame.
4. Token Access Mechanism
The first node to connect to the network checks if there’s an active monitor. If not, it takes the role and issues a token.
The token moves around the ring, allowing nodes to send data. Once a node with data to send gets the token, it removes it from the ring and starts sending its data.
The receiving node captures and copies the data, sets the C-bit, and returns the data back to the network. The data then circulates the ring until it gets to the sender, who, in the meantime, is sending idle characters.
As soon as the sending node gets the frame indicating that the receiver copied the data, it will remove the frame it sent and return the token to the ring, giving other nodes a chance to transmit data. Hence, this guarantees that there’s always one token or data frame in the ring.
4.1. Example
Let’s take an example from IBM’s token ring network article.
The ring network consists of five nodes. Initially, a token is issued by one of the nodes:
Node A removes the token from the network, changes the token bit to indicate a data frame, and sets the receiving address to node D’s address. Then, it starts to send its data:
The data circulate around the ring until node D recognizes that the data frame is addressed to it:
Then, node D captures the data, copies them, and sets the C-bit to indicate it has done so. Lastly, it returns the frame back to the network:
The data frame keeps circulating in the network until node A recognizes its source address:
Subsequently, node A removes the data from the network and issues the token:
Other nodes in the ring can now have a turn to gain access to the token.
5. Token Monitor Function
A single node (active monitor) in the network is responsible for the token monitor function. The token monitor function includes monitoring the network for the disappearance of the token or the never-ending circulation of a frame.
The disappearance of the token can happen when the current token-issuing node crashes. The never-ending circulation of a frame can occur if the sending node never recognizes its physical address, and therefore the data frame keeps circulating the ring.
Both situations lead to an inaccessible ring. The active monitor node starts an error recovery procedure once it detects a fault in the network. All the other nodes in the network are ready to become active monitors in case there’s a failure in the current one.
6. Conclusion
In this article, we described the token access protocol. The token frame gives authorization to a network node to send data. A network node cannot gain access to the network unless it has captured the token.