|
|
|
|
5
|
![main2.png](images/main2.png)
|
5
|
![main2.png](images/main2.png)
|
6
|
![main3.png](images/main3.png)
|
6
|
![main3.png](images/main3.png)
|
7
|
|
7
|
|
|
|
8
|
+[Verano 2016 - Ive]
|
8
|
|
9
|
|
9
|
When working with arrays, two common tasks are searching for data and sorting the data using a certain order, ascending or descending, alphabetically or numerically. To efficiently carry out these tasks, searching and sorting algorithms are used. One simple searching algorithm is linear search. Two well known sorting algorithms are the Selection Sort and the Bubble Sort. In this laboratory experience you will complete an application to monitor network flow to practice the implementation of algorithms for searching and sorting.
|
10
|
When working with arrays, two common tasks are searching for data and sorting the data using a certain order, ascending or descending, alphabetically or numerically. To efficiently carry out these tasks, searching and sorting algorithms are used. One simple searching algorithm is linear search. Two well known sorting algorithms are the Selection Sort and the Bubble Sort. In this laboratory experience you will complete an application to monitor network flow to practice the implementation of algorithms for searching and sorting.
|
10
|
|
11
|
|
|
|
|
|
135
|
|
136
|
|
136
|
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:
|
137
|
|
138
|
|
138
|
-* `FilterBySrcAddr`
|
|
|
139
|
-* `FilterByDstAddr`
|
|
|
140
|
-* `FilterBySrcPort`
|
|
|
141
|
-* `FilterByDstPort`
|
|
|
|
|
139
|
+ * `FilterBySrcAddr`
|
|
|
140
|
+ * `FilterByDstAddr`
|
|
|
141
|
+ * `FilterBySrcPort`
|
|
|
142
|
+ * `FilterByDstPort`
|
142
|
|
143
|
|
143
|
-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.
|
144
|
|
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.
|
145
|
|
147
|
|
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.
|
|
|
|
|
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.
|
147
|
|
149
|
|
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.
|
|
|
|
|
150
|
+ ---
|
149
|
|
151
|
|
150
|
----
|
|
|
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
|
|