CSE247 on YouTube

(Layered Architecture) Learn communication in layered environment OMNet

Computer Networks Lab · OMNeT++ · The LNMIIT
Lab Assignment 7 — Layered Network Architecture
Network Layer Data Link Layer PDU Encapsulation OMNeT++ Simulation
Objective
Learn communication in a layered environment — create a 2-node network where each node has a Network Layer and Data Link Layer, and both layers communicate via Protocol Data Units (PDUs).
Task 1 — Network Design
Task 1.1
Create a network named Comp_network with two nodes, each having two layers: Network Layer and Data Link Layer. Both nodes connected with a 100ms delay channel.
Task 1.2
Each layer communicates through PDUs — Network Layer uses Nl_pkt, Data Link Layer uses Dll_pkt.
Task 1.3
Communication starts from Network Layer of Source Node → passed down to DLL → transferred to Destination Node via the channel.
Solution Files Overview
NED
Nl_node.ned
Network Layer module
NED
Dll_node.ned
Data Link Layer module
NED
Comp.ned
Compound node module
NED
Comp_network.ned
Full network definition
MSG
Nl_pkt.msg
Network layer PDU
MSG
Dll_pkt.msg
Data link layer PDU
C++
nl_node.h / .cpp
NL logic
C++
dll_node.h / .cpp
DLL logic
INI
omnetpp.ini
Simulation config
Bugs Fixed — Summary
✓ memory leak fixed ✓ decapsulate() return used ✓ 200ms time unit fixed ✓ off-by-one fixed ✓ unused variables removed
File Bug / Issue Fix Applied
nl_node.h cGate* in — never used Removed from header
nl_node.cpp in = gate("nl_in") — dead code Removed
nl_node.cpp Self-message never deleted (memory leak) delete msg added first
nl_node.cpp remaining_packets-- inline — off-by-one Set id first, then decrement
nl_node.cpp scheduleAt(+200) — 200 seconds not ms Changed to 0.2 (200ms)
dll_node.cpp decapsulate() return discarded Captured as cPacket* inner
dll_node.cpp Sent outer Dll_pkt instead of inner Nl_pkt send(inner, out_n)
dll_node.cpp Outer Dll_pkt never deleted delete message added
Comp_network.ned source & dest declared but unused parameters block removed
omnetpp.ini **.dest = 2 — no module reads it Removed
Source Code
NED Nl_node.ned
simple Nl_node
{
    parameters:
        int nl_id;
        int remaining_packets;
        int source;

    gates:
        input  nl_in;
        output nl_out;
}

No comments:

Powered by Blogger.