MCPcopy Create free account
hub / github.com/NetSys/bess / Ipv4Prefix

Method Ipv4Prefix

core/utils/ip.cc:63–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63Ipv4Prefix::Ipv4Prefix(const std::string &prefix) {
64 size_t delim_pos = prefix.find('/');
65
66 // default values in case of parser failure
67 addr = be32_t(0);
68 mask = be32_t(0);
69
70 if (prefix.length() == 0 || delim_pos == std::string::npos ||
71 delim_pos >= prefix.length()) {
72 return;
73 }
74
75 ParseIpv4Address(prefix.substr(0, delim_pos), &addr);
76
77 const int len = std::stoi(prefix.substr(delim_pos + 1));
78 mask = be32_t(SetBitsLow<uint32_t>(len));
79}
80
81} // namespace utils
82} // namespace bess

Callers

nothing calls this directly

Calls 1

ParseIpv4AddressFunction · 0.85

Tested by

no test coverage detected