From 786d0bb9e7c5db5104e3fd0ff7fdfbd1e19844ea Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 10 Jul 1998 08:38:29 +0000 Subject: Added ipa_class_mask() which guesses netmask for classful addressing. For pure A/B/C class addresses it just returns the class netmask, for subnets it tries to guess subnet mask. Please make sure the address you pass to this function is really a valid host address (i.e., call ipa_validate() first). --- lib/ipv4.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/ipv4.h') diff --git a/lib/ipv4.h b/lib/ipv4.h index e38dce6..a771500 100644 --- a/lib/ipv4.h +++ b/lib/ipv4.h @@ -54,8 +54,10 @@ typedef u32 ip_addr; #define ipa_ntoh(x) x = _MI(ntohl(_I(x))) #define ipa_classify(x) ipv4_classify(_I(x)) #define ipa_opposite(x) _MI(_I(x) ^ 1) +#define ipa_class_mask(x) x = _MI(ipv4_class_mask(_I(x))) int ipv4_classify(u32); +u32 ipv4_class_mask(u32); /* FIXME: Is this hash function uniformly distributed over standard routing tables? */ static inline unsigned ipv4_hash(u32 a) -- cgit v1.2.3