Commit 0258d3c9 authored by Michael Tremer's avatar Michael Tremer

network: Rename "match" functions to "matches"

Gramatically, this makes more sense.
Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 0b27a567
...@@ -785,7 +785,7 @@ static int __loc_database_lookup_handle_leaf(struct loc_database* db, const stru ...@@ -785,7 +785,7 @@ static int __loc_database_lookup_handle_leaf(struct loc_database* db, const stru
} }
// Check if the given IP address is inside the network // 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"); DEBUG(db->ctx, "Searched address is not part of the network\n");
loc_network_unref(*network); loc_network_unref(*network);
......
...@@ -98,8 +98,8 @@ global: ...@@ -98,8 +98,8 @@ global:
loc_network_get_last_address; loc_network_get_last_address;
loc_network_has_flag; loc_network_has_flag;
loc_network_is_subnet; loc_network_is_subnet;
loc_network_match_address; loc_network_matches_address;
loc_network_match_country_code; loc_network_matches_country_code;
loc_network_new; loc_network_new;
loc_network_new_from_string; loc_network_new_from_string;
loc_network_overlaps; loc_network_overlaps;
......
...@@ -45,11 +45,11 @@ const struct in6_addr* loc_network_get_first_address(struct loc_network* network ...@@ -45,11 +45,11 @@ const struct in6_addr* loc_network_get_first_address(struct loc_network* network
char* loc_network_format_first_address(struct loc_network* network); char* loc_network_format_first_address(struct loc_network* network);
const struct in6_addr* loc_network_get_last_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); 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); 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_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); uint32_t loc_network_get_asn(struct loc_network* network);
int loc_network_set_asn(struct loc_network* network, uint32_t asn); int loc_network_set_asn(struct loc_network* network, uint32_t asn);
......
...@@ -353,7 +353,7 @@ LOC_EXPORT char* loc_network_format_last_address(struct loc_network* network) { ...@@ -353,7 +353,7 @@ LOC_EXPORT char* loc_network_format_last_address(struct loc_network* network) {
return loc_network_format_address(network, &network->last_address); 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 // Address must be larger than the start address
if (in6_addr_cmp(&network->first_address, address) > 0) if (in6_addr_cmp(&network->first_address, address) > 0)
return 0; return 0;
...@@ -386,7 +386,7 @@ LOC_EXPORT int loc_network_set_country_code(struct loc_network* network, const c ...@@ -386,7 +386,7 @@ LOC_EXPORT int loc_network_set_country_code(struct loc_network* network, const c
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 // Search for any special flags
const int flag = loc_country_special_code_to_flag(country_code); const int flag = loc_country_special_code_to_flag(country_code);
...@@ -441,17 +441,17 @@ LOC_EXPORT int loc_network_cmp(struct loc_network* self, struct loc_network* oth ...@@ -441,17 +441,17 @@ LOC_EXPORT int loc_network_cmp(struct loc_network* self, struct loc_network* oth
LOC_EXPORT int loc_network_overlaps(struct loc_network* self, struct loc_network* other) { 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 // 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; return 1;
if (loc_network_match_address(other, &self->first_address)) if (loc_network_matches_address(other, &self->first_address))
return 1; return 1;
// Or either of the end addresses is in the other subnet // 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; return 1;
if (loc_network_match_address(other, &self->last_address)) if (loc_network_matches_address(other, &self->last_address))
return 1; return 1;
return 0; return 0;
......
...@@ -165,21 +165,21 @@ int main(int argc, char** argv) { ...@@ -165,21 +165,21 @@ int main(int argc, char** argv) {
loc_network_set_flag(network, LOC_NETWORK_FLAG_ANONYMOUS_PROXY); loc_network_set_flag(network, LOC_NETWORK_FLAG_ANONYMOUS_PROXY);
// Check if this network matches its own country code // 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) { if (!err) {
fprintf(stderr, "Network does not match its own country code\n"); fprintf(stderr, "Network does not match its own country code\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// Check if this network matches the special country code // 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) { if (!err) {
fprintf(stderr, "Network does not match the special country code A1\n"); fprintf(stderr, "Network does not match the special country code A1\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// Check if this network does not match another special country code // 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) { if (err) {
fprintf(stderr, "Network matches another special country code A2\n"); fprintf(stderr, "Network matches another special country code A2\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
......
...@@ -100,7 +100,7 @@ int main(int argc, char** argv) { ...@@ -100,7 +100,7 @@ int main(int argc, char** argv) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
err = loc_network_match_address(network1, &address); err = loc_network_matches_address(network1, &address);
if (!err) { if (!err) {
fprintf(stderr, "Network1 does not match address\n"); fprintf(stderr, "Network1 does not match address\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment