# Two-Level Congestion Control Mechanism (2 LCCM) for Information-Centric Networking
## 4 Implementation
### Replica Selection Approach  
The operation of replica selection occurs in two cases. One case is that a replica node needs to be selected to provide data service before the chunk transmission. The other one is that the transmission is interrupted or the link is heavily congested, a replica switching needs to be performed, that is to say, the receiver needs to select an alternative replica node to continue the chunk retrieval.  
The replica selection or switching operation is performed by the IDP according to the packet header information worked at the network layer. The operation process is as follows: (1) a replica switching operation is performed both at the beginning of the chunk transmission and at the time the receiver's transport layer judges the current link under heavy congestion; (2) the transport layer adds the identification information indicating the replica selection (RSI) to the ID packet header at the network layer, the ID packet header is an extension header of IPv6 packets as shown in Figure 2. When the \"Next header\" field of an IPv6 packet is 0x99, the next header represents the ID header. The RSI identifier can be one bit in \"Attribute\" field; (3) the intermediate router performs the replica selection operation locally when it receives a packet carrying this identification, i.e., RSI = 1. Of course, even if there is no identification information in the ID packet header indicating the execution of replica selection, the intermediate routers of the ICN network can also perform the IP address replacement operation according to their scenarios, such as mobility, multicast, multi-homing. We mainly consider here the multi-replica scenario for data acquisition. The IDP works in the network layer, and it decides how to select or replace the replica's IP address in the packet header according to the scenario requirements, packet identification, local information, etc.  
The replica selection is performed through NRS and the local NST. The requestor first obtains the list of IP addresses corresponding to the ID through NRS and then selects a suitable replica according to the NST maintained locally. The entries of NST include the replica node and the node state value as Figure 3 shows.  
Figure 2: The packet format of ID header which is an extension header of IPv6.  
The replica node is uniquely identified and distinguished by the node's network address, and the node state value indicates the ability of the corresponding replica node to provide data services. The calculation of the state value is defined as shown in Equation (5).  
\[\mathrm{value}=\mathrm{F(X)},\;\mathrm{X}=(\mathrm{x}_{1},\mathrm{x}_{2}, \cdots,\mathrm{x}_{\mathrm{h}}) \tag{5}\]  
where X represents the indicators include network distance, RTT, replica node load, link capacity, etc. between the requester and replica nodes. F(X) can be flexibly defined according to the optimization objective.  
In the literature [36], we proposed an enhanced replica selection approach, called ERS. The node state value is calculated using Equation (6), where \(\mathrm{w_{i}}\;(\mathrm{i}=1,\;2,\;3)\) represents the weight assigned to each attribute. The network distance, loads of replica nodes, and path congestion degree are denoted by \(\mathrm{x}_{1},\mathrm{x}_{2},\) and \(\mathrm{x}_{3},\) respectively.  
\[\mathrm{Value}=\sum_{\mathrm{i}=1}^{3}\mathrm{w_{i}}\times\mathrm{x_{i}},\; \mathrm{w_{i}}>0,\;\sum_{\mathrm{i}=1}^{3}\mathrm{w_{i}}=1 \tag{6}\]  
As mentioned in ERS, the network distance (i.e., Hops) is evaluated by a traditional topology-based routing scheme based on shortest path algorithms [37], the load of replica nodes is calculated using the outstanding requests sent by the edge router to the corresponding replica node, and the path congestion degree is measured as \(\mathrm{RTT}-\mathrm{RTT}_{\mathrm{base}}\).