Aggie Student Toolkit — Load Balancer
CSCE 412 Project 4
Arnav Fotedar · Fall 2026 · C++ load balancer simulation
Toggle main menu visibility
Loading...
Searching...
No Matches
Firewall.h
Go to the documentation of this file.
1
6
7
#ifndef FIREWALL_H
8
#define FIREWALL_H
9
10
#include <cstdint>
11
#include <string>
12
#include <vector>
13
22
class
Firewall
{
23
public
:
29
bool
addRange
(
const
std::string& cidr);
30
36
bool
isBlocked
(
const
std::string& ip)
const
;
37
39
std::vector<std::string>
ranges
()
const
;
40
47
static
bool
parseIpv4
(
const
std::string& text, std::uint32_t& value);
48
49
private
:
51
struct
Range {
52
std::uint32_t network;
53
std::uint32_t mask;
54
std::string text;
55
};
56
57
std::vector<Range> ranges_;
58
};
59
60
#endif
Firewall
Rejects requests whose source address falls in a blocked IPv4 range.
Definition
Firewall.h:22
Firewall::addRange
bool addRange(const std::string &cidr)
Adds a blocked range.
Definition
Firewall.cpp:44
Firewall::isBlocked
bool isBlocked(const std::string &ip) const
Checks whether an address is blocked.
Definition
Firewall.cpp:74
Firewall::parseIpv4
static bool parseIpv4(const std::string &text, std::uint32_t &value)
Parses a dotted-quad IPv4 address.
Definition
Firewall.cpp:11
Firewall::ranges
std::vector< std::string > ranges() const
Definition
Firewall.cpp:87
Firewall.h
Generated by
1.18.0