Added function for converting of IP addresses to printable form.
This commit is contained in:
parent
620a355a15
commit
6b5e06abb5
3 changed files with 9 additions and 0 deletions
7
lib/ip.h
7
lib/ip.h
|
@ -43,4 +43,11 @@
|
||||||
|
|
||||||
#define ip_is_prefix(a,l) (!ipa_nonzero(ipa_and(a, ipa_not(ipa_mkmask(l)))))
|
#define ip_is_prefix(a,l) (!ipa_nonzero(ipa_and(a, ipa_not(ipa_mkmask(l)))))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Conversions between internal and string representation
|
||||||
|
*/
|
||||||
|
|
||||||
|
char *ip_ntop(ip_addr a, char *);
|
||||||
|
char *ip_ntox(ip_addr a, char *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,6 +37,7 @@ typedef u32 ip_addr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BITS_PER_IP_ADDRESS 32
|
#define BITS_PER_IP_ADDRESS 32
|
||||||
|
#define STD_ADDRESS_P_LENGTH 15
|
||||||
|
|
||||||
#define IPA_NONE (_MI(0))
|
#define IPA_NONE (_MI(0))
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ typedef struct ipv4_addr {
|
||||||
#define _I3(a) ((a).addr[3])
|
#define _I3(a) ((a).addr[3])
|
||||||
|
|
||||||
#define BITS_PER_IP_ADDRESS 128
|
#define BITS_PER_IP_ADDRESS 128
|
||||||
|
#define STD_ADDRESS_P_LENGTH 39
|
||||||
|
|
||||||
#define IPA_NONE _MI(0,0,0,0)
|
#define IPA_NONE _MI(0,0,0,0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue