-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathL3.cpp
More file actions
56 lines (42 loc) · 1.38 KB
/
L3.cpp
File metadata and controls
56 lines (42 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "L3.h"
#include "L2.h"
using namespace std;
/*
L3 constructor, use it to initiate variables and data structure that you wish to use.
Should remain empty by default (if no global class variables are beeing used).
*/
L3::L3(bool debug){ this->debug = debug; }
/*
sendToL3 is called by the upper layer via the upper layer's L3 pointer.
sendData is the pointer to the data L4 wish to send.
sendDataLen is the length of that data.
srcIP is the machines IP address that L4 supplied.
destIP is the destination IP address that L4 supplied.
debug is to enable print (use true)
*/
int L3::sendToL3(byte *sendData, size_t sendDataLen, std::string srcIP, std::string destIP){
/* ADD YOUR IMPLEMENTATION HERE*/
return 0;
}
/*
recvFromL3 is called by the upper layer via the upper layer's L3 pointer.
recvData is the pointer to the data L4 wish to receive.
recvDataLen is the length of that data.
debug is to enable print (use true)
*/
int L3::recvFromL3(byte *recvData, size_t recvDataLen){
/* ADD YOUR IMPLEMENTATION HERE*/
return 0;
}
/*
Implemented for you
*/
void L3::setLowerInterface(L2* lowerInterface){ this->lowerInterface = lowerInterface; }
/*
Implemented for you
*/
void L3::setUpperInterface(L4* upperInterface){ this->upperInterface = upperInterface; }
/*
Implemented for you
*/
std::string L3::getLowestInterface(){ return lowerInterface->getLowestInterface(); }