19#ifndef _NETSIM_IPADDRESSING_H_
20#define _NETSIM_IPADDRESSING_H_
29#define _NETSIM_IP_LEN 50
30#define _NETSIM_BIN_IP_LEN 130
60#define IP_COMPARE6(ip1,ip2) (ip1->int_ip[0]==ip2->int_ip[0] \
61 ?(ip1->int_ip[1]==ip2->int_ip[1] \
62 ?(ip1->int_ip[2]==ip2->int_ip[2] \
63 ?(ip1->int_ip[3]==ip2->int_ip[3]?0:1) :1) :1) :1)
65#define IP_COMPARE4(ip1,ip2) (ip1->int_ip[0]==ip2->int_ip[0]?0:1)
67#define IP_COMPARE(ip1,ip2) ((ip1)->type==(ip2)->type \
68 ? ((ip1)->type==4?IP_COMPARE4((ip1),(ip2)):IP_COMPARE6((ip1),(ip2))) \
71#define IP_TO_STR(ip,ipstr) ((ip)?(strcpy((ipstr),((ip)->str_ip))):strcpy(ipstr,"0.0.0.0"))
94#define STR_TO_IP4(ipstr) STR_TO_IP(ipstr,4)
95#define STR_TO_IP6(ipstr) STR_TO_IP(ipstr,6)
97#define IP_IS_IN_SAME_NETWORK_IPV4(ip1,ip2,subnet) IP_IS_IN_SAME_NETWORK(ip1,ip2,subnet,0)
98#define IP_IS_IN_SAME_NETWORK_IPV6(ip1,ip2,prefix) IP_IS_IN_SAME_NETWORK(ip1,ip2,NULL,prefix)
100#define IP_NETWORK_ADDRESS_IPV4(ip,subnet) IP_NETWORK_ADDRESS(ip,subnet,0)
101#define IP_NETWORK_ADDRESS_IPV6(ip,prefix) IP_NETWORK_ADDRESS(ip,NULL,prefix)
bool isValidIPAddress(char *ip)
NETSIM_IPAddress IP_COPY(NETSIM_IPAddress ip)
int IP_CHECK_IN_LIST(const NETSIM_IPAddress *ipList, unsigned int count, const NETSIM_IPAddress ip)
struct stru_ip * NETSIM_IPAddress
void IP_TO_BINARY(NETSIM_IPAddress ip, char *binary)
NETSIM_IPAddress STR_TO_IP(char *ipStr, int type)
unsigned int IP_ADD_TO_LIST(NETSIM_IPAddress **pipList, unsigned int *count, const NETSIM_IPAddress ip)
NETSIM_IPAddress IP_COPY_FORCE(NETSIM_IPAddress ip)
NETSIM_IPAddress GET_BROADCAST_IP(int type)
int STR_GET_IP_TYPE(char *ip)
unsigned int IP_REMOVE_FROM_LIST(NETSIM_IPAddress *pipList, unsigned int *count, const NETSIM_IPAddress ip)
bool isBroadcastIP(NETSIM_IPAddress ip)
NETSIM_IPAddress IP_NETWORK_ADDRESS(NETSIM_IPAddress ip, NETSIM_IPAddress subnet, unsigned int prefix_len)
void IP_FREE_FORCE(NETSIM_IPAddress ip)
int IP_find_match_length(NETSIM_IPAddress ip1, NETSIM_IPAddress ip2)
void IP_FREE(NETSIM_IPAddress ip)
int IP_IS_IN_SAME_NETWORK(NETSIM_IPAddress ip1, NETSIM_IPAddress ip2, NETSIM_IPAddress subnet, unsigned int prefix_len)
bool isMulticastIP(NETSIM_IPAddress ip)
#define _declspec(dllexport)
This function is used to trigger the update.
char str_ip[_NETSIM_IP_LEN]
struct stru_ip::@5::ipv4 IPV4
struct stru_ip::@5::ipv6 IPV6