C++ Use a linked list to simulate 3 TCP/IP packest. Ech packet should have sourc
ID: 3829744 • Letter: C
Question
C++Use a linked list to simulate 3 TCP/IP packest. Ech packet should have source IP, destination IP, and data (20 characters). Search each packet for suspicious IP that starts with 000. Also check data for cypher subtract 1 from ASCII of first 8 to see if JOHN JAY is the data. Your program should simulate processing six packest in 2 groups of 3. Check 3 packets (nodes) then change IP and data in each and check again. You can get extra credit if you SUCESDSFULLY use a QUEUE for this instead pof a linked list.. But the QUEUE must have the same data. Since we haven't covered QUEUE yet, you'll have to work on your own. C++
Use a linked list to simulate 3 TCP/IP packest. Ech packet should have source IP, destination IP, and data (20 characters). Search each packet for suspicious IP that starts with 000. Also check data for cypher subtract 1 from ASCII of first 8 to see if JOHN JAY is the data. Your program should simulate processing six packest in 2 groups of 3. Check 3 packets (nodes) then change IP and data in each and check again. You can get extra credit if you SUCESDSFULLY use a QUEUE for this instead pof a linked list.. But the QUEUE must have the same data. Since we haven't covered QUEUE yet, you'll have to work on your own.
Use a linked list to simulate 3 TCP/IP packest. Ech packet should have source IP, destination IP, and data (20 characters). Search each packet for suspicious IP that starts with 000. Also check data for cypher subtract 1 from ASCII of first 8 to see if JOHN JAY is the data. Your program should simulate processing six packest in 2 groups of 3. Check 3 packets (nodes) then change IP and data in each and check again. You can get extra credit if you SUCESDSFULLY use a QUEUE for this instead pof a linked list.. But the QUEUE must have the same data. Since we haven't covered QUEUE yet, you'll have to work on your own. Use a linked list to simulate 3 TCP/IP packest. Ech packet should have source IP, destination IP, and data (20 characters). Search each packet for suspicious IP that starts with 000. Also check data for cypher subtract 1 from ASCII of first 8 to see if JOHN JAY is the data. Your program should simulate processing six packest in 2 groups of 3. Check 3 packets (nodes) then change IP and data in each and check again. You can get extra credit if you SUCESDSFULLY use a QUEUE for this instead pof a linked list.. But the QUEUE must have the same data. Since we haven't covered QUEUE yet, you'll have to work on your own.
Explanation / Answer
#include<bits/stdc++.h>
using namespace std;
struct node
{
string sourceIP;
string destinationIP;
string data;
struct node *next;
};
void searchPacket(struct node x)
{
if(x.sourceIP[0]=='0' && x.sourceIP[1]=='0' && x.sourceIP[2]=='0')
cout<<"Source IP is suspicious.";
if(x.destinationIP[0]=='0' && x.destinationIP[1]=='0' && x.destinationIP[2]=='0')
cout<<"Destination IP is suspicious.";
}
bool cyphertext(struct node x)
{
for(int i=0;i<8;i++)
x.data[i] -= 1;
if(strncmp(x.data,"JOHN JAY",8))
cout<<"The data contains JOHN JAY";
}
int main()
{
node abc[2][3];
for(int i=0;i<2;i++)
for(int j=0;j<3<j++)
{
cin>>abc[i][j].sourceIP;
cin>>abc[i][j].destinationIP;
cin>>abc[i][j].data;
if(j==2)
abc[i][j].next = NULL;
else
abc[i][j].next = abc[i][j+1];
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.