MCPcopy Create free account
hub / github.com/Icinga/icinga2 / ParseIp

Function ParseIp

lib/base/utility.cpp:158–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158static bool ParseIp(const String& ip, char addr[16], int *proto)
159{
160 if (inet_pton(AF_INET, ip.CStr(), addr + 12) == 1) {
161 /* IPv4-mapped IPv6 address (::ffff:<ipv4-bits>) */
162 memset(addr, 0, 10);
163 memset(addr + 10, 0xff, 2);
164 *proto = AF_INET;
165
166 return true;
167 }
168
169 if (inet_pton(AF_INET6, ip.CStr(), addr) == 1) {
170 *proto = AF_INET6;
171
172 return true;
173 }
174
175 return false;
176}
177
178static void ParseIpMask(const String& ip, char mask[16], int *bits)
179{

Callers 2

ParseIpMaskFunction · 0.85
CidrMatchMethod · 0.85

Calls 1

CStrMethod · 0.80

Tested by

no test coverage detected