InspIRCd
2.0
|
Classes | |
struct | cidr_mask |
union | sockaddrs |
Functions | |
CoreExport bool | MatchCIDR (const std::string &address, const std::string &cidr_mask, bool match_with_username) |
int | sa_size (const irc::sockets::sockaddrs &sa) |
CoreExport bool | aptosa (const std::string &addr, int port, irc::sockets::sockaddrs &sa) |
CoreExport bool | satoap (const irc::sockets::sockaddrs &sa, std::string &addr, int &port) |
std::string | satouser (const irc::sockets::sockaddrs &sa) |
This namespace contains various protocol-independent helper classes. It also contains some types which are often used by the core and modules in place of inet_* functions and types.
bool irc::sockets::aptosa | ( | const std::string & | addr, |
int | port, | ||
irc::sockets::sockaddrs & | sa | ||
) |
Convert an address-port pair into a binary sockaddr
addr | The IP address, IPv4 or IPv6 |
port | The port, 0 for unspecified |
sa | The structure to place the result in. Will be zeroed prior to conversion |
bool irc::sockets::MatchCIDR | ( | const std::string & | address, |
const std::string & | cidr_mask, | ||
bool | match_with_username | ||
) |
Match CIDR, including an optional username/nickname part.
This function will compare a human-readable address (plus optional username and nickname) against a human-readable CIDR mask, for example [email protected] against *[email protected]/16. This method supports both IPV4 and IPV6 addresses.
address | The human readable address, e.g. [email protected] |
cidr_mask | The human readable mask, e.g. *@1.2.0.0/16 |
match_with_username | Does the mask include a nickname segment? |
|
inline |
Return the size of the structure for syscall passing
bool irc::sockets::satoap | ( | const irc::sockets::sockaddrs & | sa, |
std::string & | addr, | ||
int & | port | ||
) |
Convert a binary sockaddr to an address-port pair
sa | The structure to convert |
addr | the IP address |
port | the port |
|
inline |
Convert a binary sockaddr to a user-readable string. This means IPv6 addresses are written as [::1]:6667, and *:6668 is used for 0.0.0.0:6668
sa | The structure to convert |