#C12240. Network Traffic QoS Simulation
Network Traffic QoS Simulation
Network Traffic QoS Simulation
This problem simulates a network management system processing network packets with various traffic types. The system applies a Quality of Service (QoS) policy depending on the traffic type. For each packet, the program should output a processing log that includes the traffic type, the corresponding QoS policy, the source IP, and the destination IP.
The known traffic types and their QoS policies are:
- HTTP - High
- FTP - Medium
- Streaming - Low
For any other traffic type, the QoS policy is "Unknown". Additionally, the program should maintain a count of processed packets for each traffic type and, after processing all packets, output these aggregated counts in the order that each traffic type first appeared.
Note: All formulas (if any) must be in LaTeX format. However, this problem does not contain any mathematical formulas.
inputFormat
The first line contains an integer N
representing the number of packets. Each of the following N
lines contains three values separated by spaces: a string representing the traffic type, a source IP address, and a destination IP address.
Example:
3 HTTP 192.168.0.1 192.168.1.1 FTP 192.168.0.2 192.168.1.2 Unknown 192.168.0.3 192.168.1.3
outputFormat
For each packet, output a line in the format:
Processing packet: <traffic_type>, QoS: <qos>, Source: <source_ip>, Destination: <destination_ip>
After processing all packets, output the aggregate counts for each traffic type on separate lines, in the order of their first appearance. Each line should be in the format:
<traffic_type>: <count>## sample
3
HTTP 192.168.0.1 192.168.1.1
FTP 192.168.0.2 192.168.1.2
Unknown 192.168.0.3 192.168.1.3
Processing packet: HTTP, QoS: High, Source: 192.168.0.1, Destination: 192.168.1.1
Processing packet: FTP, QoS: Medium, Source: 192.168.0.2, Destination: 192.168.1.2
Processing packet: Unknown, QoS: Unknown, Source: 192.168.0.3, Destination: 192.168.1.3
HTTP: 1
FTP: 1
Unknown: 1
</p>