Gramatically, this makes more sense.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
}
// Check if the given IP address is inside the network
- if (!loc_network_match_address(*network, address)) {
+ if (!loc_network_matches_address(*network, address)) {
DEBUG(db->ctx, "Searched address is not part of the network\n");
loc_network_unref(*network);
loc_network_get_last_address;
loc_network_has_flag;
loc_network_is_subnet;
- loc_network_match_address;
- loc_network_match_country_code;
+ loc_network_matches_address;
+ loc_network_matches_country_code;
loc_network_new;
loc_network_new_from_string;
loc_network_overlaps;
char* loc_network_format_first_address(struct loc_network* network);
const struct in6_addr* loc_network_get_last_address(struct loc_network* network);
char* loc_network_format_last_address(struct loc_network* network);
-int loc_network_match_address(struct loc_network* network, const struct in6_addr* address);
+int loc_network_matches_address(struct loc_network* network, const struct in6_addr* address);
const char* loc_network_get_country_code(struct loc_network* network);
int loc_network_set_country_code(struct loc_network* network, const char* country_code);
-int loc_network_match_country_code(struct loc_network* network, const char* country_code);
+int loc_network_matches_country_code(struct loc_network* network, const char* country_code);
uint32_t loc_network_get_asn(struct loc_network* network);
int loc_network_set_asn(struct loc_network* network, uint32_t asn);
return loc_network_format_address(network, &network->last_address);
}
-LOC_EXPORT int loc_network_match_address(struct loc_network* network, const struct in6_addr* address) {
+LOC_EXPORT int loc_network_matches_address(struct loc_network* network, const struct in6_addr* address) {
// Address must be larger than the start address
if (in6_addr_cmp(&network->first_address, address) > 0)
return 0;
return 0;
}
-LOC_EXPORT int loc_network_match_country_code(struct loc_network* network, const char* country_code) {
+LOC_EXPORT int loc_network_matches_country_code(struct loc_network* network, const char* country_code) {
// Search for any special flags
const int flag = loc_country_special_code_to_flag(country_code);
LOC_EXPORT int loc_network_overlaps(struct loc_network* self, struct loc_network* other) {
// Either of the start addresses must be in the other subnet
- if (loc_network_match_address(self, &other->first_address))
+ if (loc_network_matches_address(self, &other->first_address))
return 1;
- if (loc_network_match_address(other, &self->first_address))
+ if (loc_network_matches_address(other, &self->first_address))
return 1;
// Or either of the end addresses is in the other subnet
- if (loc_network_match_address(self, &other->last_address))
+ if (loc_network_matches_address(self, &other->last_address))
return 1;
- if (loc_network_match_address(other, &self->last_address))
+ if (loc_network_matches_address(other, &self->last_address))
return 1;
return 0;
loc_network_set_flag(network, LOC_NETWORK_FLAG_ANONYMOUS_PROXY);
// Check if this network matches its own country code
- err = loc_network_match_country_code(network, "YY");
+ err = loc_network_matches_country_code(network, "YY");
if (!err) {
fprintf(stderr, "Network does not match its own country code\n");
exit(EXIT_FAILURE);
}
// Check if this network matches the special country code
- err = loc_network_match_country_code(network, "A1");
+ err = loc_network_matches_country_code(network, "A1");
if (!err) {
fprintf(stderr, "Network does not match the special country code A1\n");
exit(EXIT_FAILURE);
}
// Check if this network does not match another special country code
- err = loc_network_match_country_code(network, "A2");
+ err = loc_network_matches_country_code(network, "A2");
if (err) {
fprintf(stderr, "Network matches another special country code A2\n");
exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
- err = loc_network_match_address(network1, &address);
+ err = loc_network_matches_address(network1, &address);
if (!err) {
fprintf(stderr, "Network1 does not match address\n");
exit(EXIT_FAILURE);