# Neighbor Session Solutions for Integrated Routing Protocols
## 4 Modeling Protocol Integration Solution Classes
### PISC 3--L3 Transport, Multiple Adjacencies
#### 4.1.1 Sending Part
If the sent message has a set acknowledge number, we reset the sequence number in the neighbor table (we confirmed the receipt of the message to the neighbor). An IPv4 packet, which is represented by the color PACKET (Added L3 place, shown in Figure 3) is defined in the CPN ML as follows:

colset PACKET = record srcadd:INT * dstadd:INT * payload:RoutePACKET; where srcadd is the source IPv4 address, dstadd is the destination IPv4 address, and payload represents the packet body that contains the routing message being sent. The subsequent encapsulation of an IPv4 packet into a frame is represented by the Encapsulate L2 transition, which takes as input an IPv4 packet from the Added L3 place and outputs a frame that is stored in the Added L2 place. The frame itself is defined using the CPN ML language as follows:

colset FRAME = record srcadd:INT * dstadd:INT * payload:L3 PACKET; where srcaddr represents the source MAC address in the frame, dstadd is the destination MAC address, and payload represents the body of the frame, represented by the color L3 PACKET. L3 PACKET is defined as follows:

colset L3 PACKET = union IPv4:PACKET + IPv6:PACKET6; while its definition will allow us to save an IPv4 and an IPv6 packet in the body of the frame. For example, on the edge leading from the Encapsulate L2 transition to the Added L2 place, a frame is formed by the expression

{srcadd=1,dstadd=2, payload=(IPv4 pack)} indicating the presence of an IPv4 packet in the frame. From the definition of the packet and the frame, it is clear that addresses (both IP and MAC) are represented by the color INT, which is an integer value. To make the simulation and the model clearer, the IP and MAC addresses are set as follows: the left router in the model has a value of 1, and the right router has a value of 2. Subsequently, the frame is sent through the network to the second router. #### 4.1.2 Network Between Routers

The part of the model that represents the network transmitting frames between routers is shown in Figure 4. Each direction is represented by two transitions and one place. The direction from router A to router B is modeled as follows: The transition Send A->net

Figure 3: PASC 3—encapsulation of IPv4 packet and frame. has as input a frame from router A from the place Added L2, and the output is a frame subsequently stored in Net A->B. Then, the frame from the network is forwarded to router B to L2 Frame B place using the Send net1->B transition. The direction from router B to router A is modeled equivalently, consisting of the transitions Send net->A and Send B->net and the place Net B->A. #### 4.1.3 Receiving Part

The receiving part of the created model is responsible for frame reception, decapsulation, and processing. The part of the model responsible for frame decapsulation is shown in the Figure 5. First, the frame received from the network is stored in the L2 Frame place. It is then processed by the Decapsulate L2 transition, which extracts the IP packet from the frame and stores it in the L3 Packet place. If it is an IPv4 packet, it is subsequently processed by the Decapsulate L3 transition. When activating the Decapsulate L2 transition, the neighbor table is also modified with the following function:

if (#l2 add neigh)=(#srcadd frame) then neigh else {id=1, l2 add=(#srcadd frame), l3 add=0, seq=0, ack=0, neighborhd=false, route=false} The purpose of this function is to create a neighbor entry with the neighbor ID and MAC address received from the other router if there is no neighbor entry in the neighbor table. The Decapsulate L3 transition processes the IPv4 packet by extracting a routing message from it and storing it in the received place. If the neighbor record does not yet have an IPv4 address set, after activating this transition, it will be set to the value of the source address from the packet with the expression

if (#l3 add neigh)=(#srcadd pack) then neigh else NEIGHBOR.set_l3 add neigh (#srcadd pack)

Figure 4: PISC 3—network representation.