|
|
|
|
136
|
|
136
|
|
137
|
1. Open the file `Filter.cpp`. In this exercise you will complete the following functions that can be found in the file:
|
137
|
1. Open the file `Filter.cpp`. In this exercise you will complete the following functions that can be found in the file:
|
138
|
|
138
|
|
139
|
- * `FilterBySrcAddr`
|
|
|
140
|
- * `FilterByDstAddr`
|
|
|
141
|
- * `FilterBySrcPort`
|
|
|
142
|
- * `FilterByDstPort`
|
|
|
|
|
139
|
+ * `FilterBySrcAddr`
|
|
|
140
|
+ * `FilterByDstAddr`
|
|
|
141
|
+ * `FilterBySrcPort`
|
|
|
142
|
+ * `FilterByDstPort`
|
143
|
|
143
|
|
144
|
- Each one of the functions receives a vector of objects of class `Packet` and a search key. Each function (notice their names) is related to an attribute of the `Packet` class and should filter the packets in the vector that correspond to the key. To filter these packets you will use a modified version of the linear search algorithm that consists of a sequential search to find each occurrence of a particular record of data. In each of the functions, the algorithm must search through all the packets in the vector and disable the packets that are not equal to the search key. To deactivate the packet use the `disable()` method of the `Packet` class. The filter consists of keeping only the packets that correspond to the key.
|
|
|
|
|
144
|
+ Each one of the functions receives a vector of objects of class `Packet` and a search key. Each function (notice their names) is related to an attribute of the `Packet` class and should filter the packets in the vector that correspond to the key. To filter these packets you will use a modified version of the linear search algorithm that consists of a sequential search to find each occurrence of a particular record of data. In each of the functions, the algorithm must search through all the packets in the vector and disable the packets that are not equal to the search key. To deactivate the packet use the `disable()` method of the `Packet` class. The filter consists of keeping only the packets that correspond to the key.
|
145
|
|
145
|
|
146
|
- For instance, if you are filtering by `Source Address` and the search key is 136.145.181.130, the `FilterBySrcAddr` function will keep only the packets in the vector whose `Source Address` is 136.145.181.130 and deactivate the others.
|
|
|
|
|
146
|
+ For instance, if you are filtering by `Source Address` and the search key is 136.145.181.130, the `FilterBySrcAddr` function will keep only the packets in the vector whose `Source Address` is 136.145.181.130 and deactivate the others.
|
147
|
|
147
|
|
148
|
- The following figure is an screenshot of the application interface after filtering the data by `Source Address` with search key 136.145.181.130.
|
|
|
|
|
148
|
+ The following figure is an screenshot of the application interface after filtering the data by `Source Address` with search key 136.145.181.130.
|
149
|
|
149
|
|
150
|
- ---
|
|
|
|
|
150
|
+ ---
|
151
|
|
151
|
|
152
|
- ![figure3.png](images/figure3.png)
|
|
|
|
|
152
|
+ ![figure3.png](images/figure3.png)
|
153
|
|
153
|
|
154
|
- **Figure 3.** Interface of the *Network Analyzer* application with the network flow packets filtered by `Source Address` with the key 136.145.181.130.
|
|
|
|
|
154
|
+ **Figure 3.** Interface of the *Network Analyzer* application with the network flow packets filtered by `Source Address` with the key 136.145.181.130.
|
155
|
|
155
|
|
156
|
- ---
|
|
|
|
|
156
|
+ ---
|
157
|
|
157
|
|
158
|
###Exercise 2: Sorting data
|
158
|
###Exercise 2: Sorting data
|
159
|
|
159
|
|