NetSim Source Code Help
Loading...
Searching...
No Matches
IP_Addressing.h File Reference
#include "Linux.h"
Include dependency graph for IP_Addressing.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  stru_ip
 

Macros

#define _NETSIM_IP_LEN   50
 
#define _NETSIM_BIN_IP_LEN   130
 
#define MAX_TTL   255
 
#define IP_COMPARE6(ip1, ip2)
 
#define IP_COMPARE4(ip1, ip2)   (ip1->int_ip[0]==ip2->int_ip[0]?0:1)
 
#define IP_COMPARE(ip1, ip2)
 
#define IP_TO_STR(ip, ipstr)   ((ip)?(strcpy((ipstr),((ip)->str_ip))):strcpy(ipstr,"0.0.0.0"))
 
#define STR_TO_IP4(ipstr)   STR_TO_IP(ipstr,4)
 
#define STR_TO_IP6(ipstr)   STR_TO_IP(ipstr,6)
 
#define IP_IS_IN_SAME_NETWORK_IPV4(ip1, ip2, subnet)   IP_IS_IN_SAME_NETWORK(ip1,ip2,subnet,0)
 
#define IP_IS_IN_SAME_NETWORK_IPV6(ip1, ip2, prefix)   IP_IS_IN_SAME_NETWORK(ip1,ip2,NULL,prefix)
 
#define IP_NETWORK_ADDRESS_IPV4(ip, subnet)   IP_NETWORK_ADDRESS(ip,subnet,0)
 
#define IP_NETWORK_ADDRESS_IPV6(ip, prefix)   IP_NETWORK_ADDRESS(ip,NULL,prefix)
 

Typedefs

typedef struct stru_ipNETSIM_IPAddress
 

Functions

NETSIM_IPAddress STR_TO_IP (char *ipStr, int type)
 
NETSIM_IPAddress IP_COPY (NETSIM_IPAddress ip)
 
void IP_FREE (NETSIM_IPAddress ip)
 
NETSIM_IPAddress IP_COPY_FORCE (NETSIM_IPAddress ip)
 
void IP_FREE_FORCE (NETSIM_IPAddress ip)
 
void IP_TO_BINARY (NETSIM_IPAddress ip, char *binary)
 
unsigned int IP_ADD_TO_LIST (NETSIM_IPAddress **pipList, unsigned int *count, const NETSIM_IPAddress ip)
 
unsigned int IP_REMOVE_FROM_LIST (NETSIM_IPAddress *pipList, unsigned int *count, const NETSIM_IPAddress ip)
 
int IP_CHECK_IN_LIST (const NETSIM_IPAddress *ipList, unsigned int count, const NETSIM_IPAddress ip)
 
int IP_IS_IN_SAME_NETWORK (NETSIM_IPAddress ip1, NETSIM_IPAddress ip2, NETSIM_IPAddress subnet, unsigned int prefix_len)
 
NETSIM_IPAddress IP_NETWORK_ADDRESS (NETSIM_IPAddress ip, NETSIM_IPAddress subnet, unsigned int prefix_len)
 
NETSIM_IPAddress GET_BROADCAST_IP (int type)
 
int IP_FREE_ALL ()
 
int IP_VALIDATE_ALL_IP ()
 
int STR_GET_IP_TYPE (char *ip)
 
bool isBroadcastIP (NETSIM_IPAddress ip)
 
bool isMulticastIP (NETSIM_IPAddress ip)
 
bool isValidIPAddress (char *ip)
 
int IP_find_match_length (NETSIM_IPAddress ip1, NETSIM_IPAddress ip2)
 

Macro Definition Documentation

◆ _NETSIM_BIN_IP_LEN

#define _NETSIM_BIN_IP_LEN   130

Definition at line 30 of file IP_Addressing.h.

◆ _NETSIM_IP_LEN

#define _NETSIM_IP_LEN   50

Definition at line 29 of file IP_Addressing.h.

◆ IP_COMPARE

#define IP_COMPARE (   ip1,
  ip2 
)
Value:
((ip1)->type==(ip2)->type \
? ((ip1)->type==4?IP_COMPARE4((ip1),(ip2)):IP_COMPARE6((ip1),(ip2))) \
:1)
#define IP_COMPARE6(ip1, ip2)
Definition: IP_Addressing.h:60
#define IP_COMPARE4(ip1, ip2)
Definition: IP_Addressing.h:65

Definition at line 67 of file IP_Addressing.h.

◆ IP_COMPARE4

#define IP_COMPARE4 (   ip1,
  ip2 
)    (ip1->int_ip[0]==ip2->int_ip[0]?0:1)

Definition at line 65 of file IP_Addressing.h.

◆ IP_COMPARE6

#define IP_COMPARE6 (   ip1,
  ip2 
)
Value:
(ip1->int_ip[0]==ip2->int_ip[0] \
?(ip1->int_ip[1]==ip2->int_ip[1] \
?(ip1->int_ip[2]==ip2->int_ip[2] \
?(ip1->int_ip[3]==ip2->int_ip[3]?0:1) :1) :1) :1)

Definition at line 60 of file IP_Addressing.h.

◆ IP_IS_IN_SAME_NETWORK_IPV4

#define IP_IS_IN_SAME_NETWORK_IPV4 (   ip1,
  ip2,
  subnet 
)    IP_IS_IN_SAME_NETWORK(ip1,ip2,subnet,0)

Definition at line 97 of file IP_Addressing.h.

◆ IP_IS_IN_SAME_NETWORK_IPV6

#define IP_IS_IN_SAME_NETWORK_IPV6 (   ip1,
  ip2,
  prefix 
)    IP_IS_IN_SAME_NETWORK(ip1,ip2,NULL,prefix)

Definition at line 98 of file IP_Addressing.h.

◆ IP_NETWORK_ADDRESS_IPV4

#define IP_NETWORK_ADDRESS_IPV4 (   ip,
  subnet 
)    IP_NETWORK_ADDRESS(ip,subnet,0)

Definition at line 100 of file IP_Addressing.h.

◆ IP_NETWORK_ADDRESS_IPV6

#define IP_NETWORK_ADDRESS_IPV6 (   ip,
  prefix 
)    IP_NETWORK_ADDRESS(ip,NULL,prefix)

Definition at line 101 of file IP_Addressing.h.

◆ IP_TO_STR

#define IP_TO_STR (   ip,
  ipstr 
)    ((ip)?(strcpy((ipstr),((ip)->str_ip))):strcpy(ipstr,"0.0.0.0"))

Definition at line 71 of file IP_Addressing.h.

◆ MAX_TTL

#define MAX_TTL   255

Definition at line 31 of file IP_Addressing.h.

◆ STR_TO_IP4

#define STR_TO_IP4 (   ipstr)    STR_TO_IP(ipstr,4)

Definition at line 94 of file IP_Addressing.h.

◆ STR_TO_IP6

#define STR_TO_IP6 (   ipstr)    STR_TO_IP(ipstr,6)

Definition at line 95 of file IP_Addressing.h.

Typedef Documentation

◆ NETSIM_IPAddress

typedef struct stru_ip* NETSIM_IPAddress

Definition at line 32 of file IP_Addressing.h.

Function Documentation

◆ GET_BROADCAST_IP()

NETSIM_IPAddress GET_BROADCAST_IP ( int  type)
Here is the caller graph for this function:

◆ IP_ADD_TO_LIST()

unsigned int IP_ADD_TO_LIST ( NETSIM_IPAddress **  pipList,
unsigned int *  count,
const NETSIM_IPAddress  ip 
)

◆ IP_CHECK_IN_LIST()

int IP_CHECK_IN_LIST ( const NETSIM_IPAddress ipList,
unsigned int  count,
const NETSIM_IPAddress  ip 
)

◆ IP_COPY()

Here is the caller graph for this function:

◆ IP_COPY_FORCE()

NETSIM_IPAddress IP_COPY_FORCE ( NETSIM_IPAddress  ip)
Here is the caller graph for this function:

◆ IP_find_match_length()

int IP_find_match_length ( NETSIM_IPAddress  ip1,
NETSIM_IPAddress  ip2 
)

◆ IP_FREE()

void IP_FREE ( NETSIM_IPAddress  ip)
Here is the caller graph for this function:

◆ IP_FREE_ALL()

int IP_FREE_ALL ( )

◆ IP_FREE_FORCE()

void IP_FREE_FORCE ( NETSIM_IPAddress  ip)

◆ IP_IS_IN_SAME_NETWORK()

int IP_IS_IN_SAME_NETWORK ( NETSIM_IPAddress  ip1,
NETSIM_IPAddress  ip2,
NETSIM_IPAddress  subnet,
unsigned int  prefix_len 
)
Here is the caller graph for this function:

◆ IP_NETWORK_ADDRESS()

NETSIM_IPAddress IP_NETWORK_ADDRESS ( NETSIM_IPAddress  ip,
NETSIM_IPAddress  subnet,
unsigned int  prefix_len 
)
Here is the caller graph for this function:

◆ IP_REMOVE_FROM_LIST()

unsigned int IP_REMOVE_FROM_LIST ( NETSIM_IPAddress pipList,
unsigned int *  count,
const NETSIM_IPAddress  ip 
)

◆ IP_TO_BINARY()

void IP_TO_BINARY ( NETSIM_IPAddress  ip,
char *  binary 
)
Here is the caller graph for this function:

◆ IP_VALIDATE_ALL_IP()

int IP_VALIDATE_ALL_IP ( )

Very costly function. Use only for debugging

◆ isBroadcastIP()

bool isBroadcastIP ( NETSIM_IPAddress  ip)
Here is the caller graph for this function:

◆ isMulticastIP()

bool isMulticastIP ( NETSIM_IPAddress  ip)
Here is the caller graph for this function:

◆ isValidIPAddress()

bool isValidIPAddress ( char *  ip)
Here is the caller graph for this function:

◆ STR_GET_IP_TYPE()

int STR_GET_IP_TYPE ( char *  ip)
Here is the caller graph for this function:

◆ STR_TO_IP()

NETSIM_IPAddress STR_TO_IP ( char *  ipStr,
int  type 
)
Here is the caller graph for this function: