00001 /* 00002 * This file is part of RTRlib. 00003 * 00004 * This file is subject to the terms and conditions of the MIT license. 00005 * See the file LICENSE in the top level directory for more details. 00006 * 00007 * Website: http://rtrlib.realmv6.org/ 00008 */ 00009 00010 #ifndef LRTR_IP_PUBLIC_H 00011 #define LRTR_IP_PUBLIC_H 00012 00013 #include <stdbool.h> 00014 00015 #include "rtrlib/lib/ipv4.h" 00016 #include "rtrlib/lib/ipv6.h" 00025 enum lrtr_ip_version { 00027 LRTR_IPV4, 00028 00030 LRTR_IPV6 00031 }; 00032 00038 struct lrtr_ip_addr { 00039 enum lrtr_ip_version ver; 00040 union { 00041 struct lrtr_ipv4_addr addr4; 00042 struct lrtr_ipv6_addr addr6; 00043 } u; 00044 }; 00045 00055 int lrtr_ip_addr_to_str(const struct lrtr_ip_addr *ip, char *str, const unsigned int len); 00056 00064 int lrtr_ip_str_to_addr(const char *str, struct lrtr_ip_addr *ip); 00065 00074 bool lrtr_ip_addr_equal(const struct lrtr_ip_addr a, const struct lrtr_ip_addr b); 00075 00083 bool lrtr_ip_str_cmp(const struct lrtr_ip_addr *addr1, const char *addr2); 00084 00085 #endif 00086 /* @} */
1.6.1