a
CSI 2310/5006 – Data Structures
Project 1 (Prj1)
Connects to the following learning outcomes:
Implement / use linked lists, binary trees, stacks, queues, priority queues.
Points:
6 points. Contributes to the assessment item “homework”, which has a total weight of 30% of the
grade.
Due date:
October 10th, at 23:59:59 PM.
Description
A network intrusion detection system (NIDS) analyzes all incoming and outgoing traffic for signs of
intrusion. More specifically, a NIDS extracts the payload part of each network packet, and compares it
with rules that are called vulnerability signatures. The payload is the actual data part of a network
packet. Attackers have adapted their exploit techniques to try to evade the various checks that are
performed by a NIDS.
Attackers split the attack data into multiple network packets. That way, a single packet payload does
not match any vulnerability signatures. On the other hand, defenders have improved the code of NIDS
by reassembling fragmented network packets before analyzing them, so that their payloads are merged
and analyzed as a single piece of data.
NIDS uses a linked list to store network packets in ascending order based on TCP sequence numbers.
When a new network packet arrives, the NIDS needs to insert it in the linked list at a position that does
not break the ascending order of the nodes. Furthermore, if the linked list already contains a node, i.e. a
packet, that has the same TCP sequence number as the new packet, then the NIDS does the following:
1) Removes the existing node from the linked list.
2) Extracts its payload and appends it to the payload of the new packet.
3) Inserts the revised new packet in the linked list at the appropriate position.
In this project, we do not implement step 2 given that it is not pertinent to linked lists.
This project consists of NIDS code written in Java that organizes network packets into a linked list in
ascending order and without duplicates. This project description is accompanied by a zip archive named
Code.zip, which contains two Java files, namely intrusionDetectorClass.java and IntNode.java.
Students are required to implement the methods of the IntNode class. The intrusionDetectorClass
simply uses the methods of the IntNode class to create and maintain the linked list of network packets.
Students can verify the correctness of their IntNode class by comparing their output with the following
output:
Prj1 is running.
The (sequence number, data) pairs in the linked list are: (13,230185386)
Running removeDuplicate() on target 13
The linked list is empty.
Running addNodeInOrder() on target 13 and data 308329763
The (sequence number, data) pairs in the linked list are: (13,308329763)
Running removeDuplicate() on target 14
The (sequence number, data) pairs in the linked list are: (13,308329763)
Running addNodeInOrder() on target 14 and data 248041794
The (sequence number, data) pairs in the linked list are: (13,308329763) (14,248041794)
Running removeDuplicate() on target 14
The (sequence number, data) pairs in the linked list are: (13,308329763)
Running addNodeInOrder() on target 14 and data 295106305
The (sequence number, data) pairs in the linked list are: (13,308329763) (14,295106305)
Running removeDuplicate() on target 15
The (sequence number, data) pairs in the linked list are: (13,308329763) (14,295106305)
Running addNodeInOrder() on target 15 and data 325615905
The (sequence number, data) pairs in the linked list are: (13,308329763) (14,295106305)
(15,325615905)
Running removeDuplicate() on target 16
The (sequence number, data) pairs in the linked list are: (13,308329763) (14,295106305)
(15,325615905)
Running addNodeInOrder() on target 16 and data 652976466
The (sequence number, data) pairs in the linked list are: (13,308329763) (14,295106305)
(15,325615905) (16,652976466)
Running removeDuplicate() on target 17
The (sequence number, data) pairs in the linked list are: (13,308329763) (14,295106305)
(15,325615905) (16,652976466)
Running addNodeInOrder() on target 17 and data 847897267
The (sequence number, data) pairs in the linked list are: (13,308329763) (14,295106305)
(15,325615905) (16,652976466) (17,847897267)
Running removeDuplicate() on target 17
The (sequence number, data) pairs in the linked list are: (13,308329763) (14,295106305)
(15,325615905) (16,652976466)
Running addNodeInOrder() on target 17 and data 927847798
The (sequence number, data) pairs in the linked list are: (13,308329763) (14,295106305)
(15,325615905) (16,652976466) (17,927847798)
End of run.
Deliverable
A fully implemented IntNode class, which students shall submit on Moodle.
Grading Rubric:
The following rubric details how your submission will be graded:
Accomplishment Points
The NIDS correctly creates and maintains a
linked list of network packets in ascending
order and without duplicates.
6
The NIDS correctly creates and maintains a
linked list of network packets in ascending
order, but is unable to remove duplicates.
4
The NIDS creates and maintains a linked
list of network packets, but is unable to
keep nodes in ascending order and remove
duplicates.
2
The NIDS is unable to create and maintain a
linked list of network packets in any way.
0
import library.IntNode;
public class intrusionDetectorClass {
static IntNode head = null;
public static void main(String[] args) {
System.out.println(“Prj1 is running.n”);
head = new IntNode(13, 230185386, head);
head.displayNodeData(head);
removeDuplicate(13);
if (head != null)
head.displayNodeData(head);
else
{
System.out.print(“The linked list is empty.n”);
System.out.print(” n”);
}
addNodeInOder(13, 308329763);
head.displayNodeData(head);
removeDuplicate(14);
head.displayNodeData(head);
addNodeInOder(14, 248041794);
head.displayNodeData(head);
removeDuplicate(14);
head.displayNodeData(head);
addNodeInOder(14, 295106305);
head.displayNodeData(head);
removeDuplicate(15);
head.displayNodeData(head);
addNodeInOder(15, 325615905);
head.displayNodeData(head);
removeDuplicate(16);
head.displayNodeData(head);
addNodeInOder(16, 652976466);
head.displayNodeData(head);
removeDuplicate(17);
head.displayNodeData(head);
addNodeInOder(17, 847897267);
head.displayNodeData(head);
removeDuplicate(17);
head.displayNodeData(head);
addNodeInOder(17, 927847798);
head.displayNodeData(head);
System.out.println(“End of run.n”);
}
// Precondition: head refers the first node in the linked list, or is null when the linked list is empty.
// The linked list contains at least one element.
// Postcondition: If the linked list contains a node with sequenceNumber equal to target,
// then that node is removed from the linked list. Otherwise, no changes are made.
public static IntNode removeDuplicate(int target)
{
if (head == null)
return head;
System.out.println(“Running removeDuplicate() on target ” + target + “n”);
IntNode previous = null;
if (target == head.getsequenceNumber())
{
head = head.getLink();
}
else
previous = head.findPrevious(head, target);
if (previous != null)
previous.removeNodeAfter();
return head;
}
// Precondition: head refers the first node in the linked list, or is null when the linked list is empty.
// Postcondition: A new node with attributes target and data is created. Target serves as sequenceNumber.
// The new node is added to the linked list so that its sequenceNumber preserves the ascending order of the linked list
// relative to the sequenceNumber.
public static IntNode addNodeInOder(int target, int data)
{
IntNode previous = null;
System.out.println(“Running addNodeInOrder() on target ” + target + ” and data ” + data + “n”);
if (head == null)
{
head = new IntNode(target, data, head);
return head;
}
if (target < head.getsequenceNumber()) head = new IntNode(target, data, head); else previous = head.locatePredecessor(head, target); if (previous != null) previous.addNodeAfter(target, data); return head; } } package library; public class IntNode { private int sequenceNumber; private int data; private IntNode link; // Precondition: // Postcondition: All instance variables of the IntNode class are initialized in order. public IntNode(int initialsequenceNumber, int initialdata, IntNode initialLink) { // Implement me. } // Precondition: This instance of the IntNode class exists. // In other words, the object whose method is activated exists as a node in the linked list. // Postcondition: A new node with attributes item and data is created. Item serves as sequenceNumber. // The new node is added to the linked list at a position that comes immediately after the node whose method is activated. public void addNodeAfter(int item, int data) { // Implement me. } // Precondition: This instance of the IntNode class exists. // In other words, the object whose method is activated exists as a node in the linked list. // Postcondition: The specific node, which comes immediately after the node whose method is activated, // is removed from the linked list. public void removeNodeAfter( ) { // Implement me. } // Precondition: This instance of the IntNode class exists. // Postcondition: The sequenceNumber of this node is returned. public int getsequenceNumber( ) { // Implement me. } // Precondition: This instance of the IntNode class exists. // Postcondition: The link of this node is returned. public IntNode getLink( ) { // Implement me. } // Precondition: The linked list contains at least one element. // Postcondition: The (sequence number, data) pairs of each node in the linked list, starting with the head, // are displayed on the monitor. public void displayNodeData(IntNode head) { // Implement me. } // Precondition: The head of the linked list is different than null, and its sequenceNumber is different than target. // Postcondition: The link to the specific node, which comes before the node whose sequenceNumber is equal to target, // is returned. If the linked list does not contain a node with sequenceNumber equal to target, then null is returned. public IntNode findPrevious(IntNode head, int target) { // Implement me. } // Precondition: The head of the linked list is different than null, and its sequenceNumber is smaller than target. // Postcondition: The link to the specific node, which comes before the node that is the first in the linked list // to have a sequenceNumber greater than target, is returned. // If no such node is found, the link to the last node in the linked list is returned. public IntNode locatePredecessor(IntNode head, int target) { // Implement me. } }
Why Choose Us
- 100% non-plagiarized Papers
- 24/7 /365 Service Available
- Affordable Prices
- Any Paper, Urgency, and Subject
- Will complete your papers in 6 hours
- On-time Delivery
- Money-back and Privacy guarantees
- Unlimited Amendments upon request
- Satisfaction guarantee
How it Works
- Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
- Fill in your paper’s requirements in the "PAPER DETAILS" section.
- Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
- Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
- From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.