Compare commits
4 Commits
9dc91af758
...
76ff4db369
Author | SHA1 | Date | |
---|---|---|---|
76ff4db369 | |||
d024c4a714 | |||
6144a7ba5b | |||
4461978f4e |
35
Codes/Code-B5.cpp
Normal file
35
Codes/Code-B5.cpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void printSubnetMask(int prefixLength) {
|
||||||
|
int mask[4] = {0, 0, 0, 0};
|
||||||
|
for (int i = 0; i < prefixLength; ++i) {
|
||||||
|
mask[i / 8] |= (1 << (7 - (i % 8)));
|
||||||
|
}
|
||||||
|
cout << "Subnet Mask for /" << prefixLength << ": ";
|
||||||
|
cout << mask[0] << "." << mask[1] << "." << mask[2] << "." << mask[3] << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int prefixLength;
|
||||||
|
cout << "Enter the prefix length: ";
|
||||||
|
cin >> prefixLength;
|
||||||
|
|
||||||
|
if (prefixLength >= 0 && prefixLength <= 32) {
|
||||||
|
printSubnetMask(prefixLength);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cout << "Invalid prefix length!" << std::endl;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
OUTPUT:
|
||||||
|
Enter the prefix length: 22
|
||||||
|
Subnet Mask for /22: 255.255.252.0
|
||||||
|
Enter the prefix length: 0
|
||||||
|
Subnet Mask for /0: 0.0.0.0
|
||||||
|
Enter the prefix length: 32
|
||||||
|
Subnet Mask for /32: 255.255.255.255
|
||||||
|
*/
|
BIN
Printable outputs/Output-A2.pdf
Normal file
BIN
Printable outputs/Output-A2.pdf
Normal file
Binary file not shown.
BIN
Printable outputs/Output-B5.pdf
Normal file
BIN
Printable outputs/Output-B5.pdf
Normal file
Binary file not shown.
BIN
Printable outputs/Output-C11.pdf
Normal file
BIN
Printable outputs/Output-C11.pdf
Normal file
Binary file not shown.
10
README.md
10
README.md
@ -27,6 +27,10 @@ This Git repository is a comprehensive resource for the Computer Networks and Se
|
|||||||
##### A2 - Network types, topologies and transmission media
|
##### A2 - Network types, topologies and transmission media
|
||||||
- [Handout-A2](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-A2.pdf)
|
- [Handout-A2](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-A2.pdf)
|
||||||
- [Write-up - A2](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Write-ups/Write-up%20-%20A2.pdf)
|
- [Write-up - A2](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Write-ups/Write-up%20-%20A2.pdf)
|
||||||
|
- [Output-A2](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-A2.pdf)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> No code for assignment A2.
|
||||||
|
|
||||||
##### A3 - Error detection and correction using Hamming code and CRC
|
##### A3 - Error detection and correction using Hamming code and CRC
|
||||||
- [Code-A3 (CRC)](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-A3%20%28CRC%29.cpp)
|
- [Code-A3 (CRC)](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-A3%20%28CRC%29.cpp)
|
||||||
@ -42,7 +46,10 @@ This Git repository is a comprehensive resource for the Computer Networks and Se
|
|||||||
- [Output-A4](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-A4.pdf)
|
- [Output-A4](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-A4.pdf)
|
||||||
|
|
||||||
##### B5 - Subnetting and subnet mask
|
##### B5 - Subnetting and subnet mask
|
||||||
|
- [Code-B5](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-B5.cpp)
|
||||||
- [Handout-B5](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-B5.pdf)
|
- [Handout-B5](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-B5.pdf)
|
||||||
|
- [Write-up - B5](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Write-ups/Write-up%20-%20B5.pdf)
|
||||||
|
- [Output-B5](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-B5.pdf)
|
||||||
|
|
||||||
##### B6 - Link state & distance vector
|
##### B6 - Link state & distance vector
|
||||||
- [Code-B6](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-B6.py)
|
- [Code-B6](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-B6.py)
|
||||||
@ -71,11 +78,14 @@ This Git repository is a comprehensive resource for the Computer Networks and Se
|
|||||||
##### C10 - DNS
|
##### C10 - DNS
|
||||||
- [Code-C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-C10.py)
|
- [Code-C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-C10.py)
|
||||||
- [Handout-C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-C10.pdf)
|
- [Handout-C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-C10.pdf)
|
||||||
|
- [Write-up - C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Write-ups/Write-up%20-%20C10.pdf)
|
||||||
- [Output-C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-C10.pdf)
|
- [Output-C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-C10.pdf)
|
||||||
|
|
||||||
##### C11 - DHCP
|
##### C11 - DHCP
|
||||||
- [Code-C11](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-C11.py)
|
- [Code-C11](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-C11.py)
|
||||||
- [Handout-C11](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-C11.pdf)
|
- [Handout-C11](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-C11.pdf)
|
||||||
|
- [Write-up - C11](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Write-ups/Write-up%20-%20C11.pdf)
|
||||||
|
- [Output-C11](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-C11.pdf)
|
||||||
|
|
||||||
##### C12 - TCP & HTTP traffic capture using Wireshark
|
##### C12 - TCP & HTTP traffic capture using Wireshark
|
||||||
- [Handout-C12](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-C12.pdf)
|
- [Handout-C12](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-C12.pdf)
|
||||||
|
BIN
Write-ups/Write-up - B5.pdf
Normal file
BIN
Write-ups/Write-up - B5.pdf
Normal file
Binary file not shown.
BIN
Write-ups/Write-up - C10.pdf
Normal file
BIN
Write-ups/Write-up - C10.pdf
Normal file
Binary file not shown.
BIN
Write-ups/Write-up - C11.pdf
Normal file
BIN
Write-ups/Write-up - C11.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user