29#ifndef _NETSIM_IP_LIB_
30#pragma comment(lib,"IP.lib")
35#define IP_IGMP_STATUS_DEFAULT false
36#define IP_PIM_STATUS_DEFAULT false
37#define IP_ICMP_STATUS_DEFAULT false
38#define IP_STATIC_IP_ROUTE_DEFAULT _strdup("")
39#define IP_PROCESSING_DELAY_DEFAULT 0
42#define DEFAULT_METRIC 999
43#define ONLINK_METRIC 300
44#define MULTICAST_METRIC 306
45#define IPV4_HEADER_SIZE 20
49#define GET_IP_DEVVAR(d) (DEVICE_NWLAYER(d)?(IP_DEVVAR*)(DEVICE_NWLAYER(d)->ipVar):NULL)
88#define isPIMPacket(packet) (packet->pstruNetworkData->IPProtocol == IPPROTOCOL_PIM)
299#define DNS_ALLOC() (struct stru_dnsList*)list_alloc(sizeof(struct stru_dnsList),offsetof(struct stru_dnsList,ele))
301#define IPROUTINGTABLE_ALLOC() (ptrIP_ROUTINGTABLE)list_alloc(sizeof(IP_ROUTINGTABLE),offsetof(IP_ROUTINGTABLE,ele))
302#define IPROUTINGTABLE_ADD(table,current,fun) list_add(((void**)(table)),current,offsetof(IP_ROUTINGTABLE,ele),fun)
316 unsigned int metric);
320 unsigned int prefix_len,
325 unsigned int metric);
337 unsigned int prefix_len,
407 bool(*
resp)(
void*,
char*,
bool),
void process_icmp_packet()
IP_PROTOCOL_ACTION pim_decide_action(NetSim_PACKET *packet, NETSIM_ID d)
int iptable_change_byRoute(ptrIP_WRAPPER wrapper, ptrIP_ROUTINGTABLE route, NETSIM_IPAddress subnet, unsigned int prefix_len, NETSIM_IPAddress gateway, UINT interfaceCount, NETSIM_IPAddress *interfaceIp, NETSIM_ID *interfaceId, unsigned int metric)
IP_GATEWAYSTATE
Enumeration for IP gateway states.
@ GATEWAYSTATE_CLEARANCE_PENDING
@ GATEWAYSTATE_NOTIFICATION_PENDING
void pim_join_group(NETSIM_ID d, NETSIM_IPAddress group)
void igmp_host_join_group(NETSIM_ID d, NETSIM_IPAddress group)
struct stru_NetSim_IPRoutingTable ** pptrIP_ROUTINGTABLE
int ICMP_CHECKSTATE(NETSIM_IPAddress ip)
void ICMP_copyPacket(NetSim_PACKET *d, NetSim_PACKET *s)
void pim_configure(NETSIM_ID d, void *xmlNetSimNode)
int fn_NetSim_NAT_NetworkIn(NETSIM_ID ndev, NetSim_PACKET *packet)
IP_PROTOCOL_ACTION router_is_ip_present_in_db(NETSIM_ID d, NETSIM_IPAddress ip, NetSim_PACKET *packet)
ptrIP_ROUTINGTABLE iptable_check(ptrIP_ROUTINGTABLE *table, NETSIM_IPAddress dest, NETSIM_IPAddress subnet)
struct stru_NetSim_IPRoutingTable * ptrIP_ROUTINGTABLE
int iptable_delete_by_route(ptrIP_WRAPPER wrapper, ptrIP_ROUTINGTABLE route)
IP_PROTOCOL_ACTION check_ip_in_multicastgroup(NETSIM_IPAddress ip, NETSIM_ID d, NetSim_PACKET *packet)
ptrIP_FORWARD_ROUTE fn_NetSim_IP_RoutePacketViaStaticEntry(NetSim_PACKET *packet, NETSIM_ID dev)
int iptable_delete(ptrIP_WRAPPER wrapper, NETSIM_IPAddress dest, NETSIM_IPAddress in, char *type)
ptrIP_FORWARD_ROUTE fn_NetSim_IP_RoutePacket(NetSim_PACKET *packet, NETSIM_ID dev)
void process_pim_packet()
void free_ip_route(ptrIP_FORWARD_ROUTE route)
struct stru_NetSim_IPRoutingTable IP_ROUTINGTABLE
Structure to store ip routing table.
ptrIP_ROUTINGTABLE iptable_add(ptrIP_WRAPPER wrapper, NETSIM_IPAddress dest, NETSIM_IPAddress subnet, unsigned int prefix_len, NETSIM_IPAddress gateway, UINT interfaceCount, NETSIM_IPAddress *interfaceIp, NETSIM_ID *interfaceId, unsigned int metric, char *type)
IP_SUBEVENT
Enumeration for ip sub-events.
@ EVENT_PIM_NEIGHBOR_TIMEOUT
@ EVENT_IP_PROCESSING_DELAY
@ EVENT_IGMP_OtherQuerierPresentTimer
@ EVENT_IGMP_SendStartupQuery
@ EVENT_IGMP_GroupMembershipTimer
@ EVENT_IGMP_Unsolicited_report
struct stru_IP_Metrics ** ipMetrics
void igmp_configure(NETSIM_ID d, void *xmlNode)
void Router_PIM_Init(NETSIM_ID d)
VPN_STATE
Enumeration for VPN states.
int iptable_change(ptrIP_WRAPPER wrapper, NETSIM_IPAddress dest, NETSIM_IPAddress subnet, UINT prefix_len, NETSIM_IPAddress gateway, UINT interfaceCount, NETSIM_IPAddress *interfaceIp, NETSIM_ID *interfaceId, unsigned int metric)
void IGMP_FreePacket(NetSim_PACKET *packet)
bool isCorrectRoute(pptrIP_ROUTINGTABLE table, NETSIM_IPAddress dest, NETSIM_IPAddress src)
ptrIP_ROUTINGTABLE * iptable_get_table_by_type(ptrIP_ROUTINGTABLE table, char *type, UINT *count)
void process_igmp_packet()
int iptable_print(FILE *fp, ptrIP_ROUTINGTABLE routeTable)
void icmp_send_echo_request()
void ip_write_to_pcap(NetSim_PACKET *packet, NETSIM_ID d, NETSIM_ID i, double time)
struct ForwardRoute * ptrIP_FORWARD_ROUTE
ROUTING_TYPE
Enumeration for routing types.
void igmp_router_processOtherQuerierPresentTime()
void igmp_free(NETSIM_ID d)
struct stru_dnsList DNS
Data structure for dns.
IP_CONTROL_PACKET
Enumeration for IP control packets.
@ PACKET_PIM_REGISTERSTOP
@ PACKET_ICMP_DstUnreachableMsg
@ PACKET_ROUTER_ADVERTISEMENT
@ PACKET_ICMP_ECHORequest
void * ICMP_StartPingRequest(NETSIM_ID src, NETSIM_ID dest, UINT count, bool(*resp)(void *, char *, bool), void *arg)
void copy_igmp_packet(NetSim_PACKET *d, NetSim_PACKET *s)
int fn_NetSim_IP_VPN_Run()
void igmp_init(NETSIM_ID d)
void igmp_router_ProcessGroupMembershipTimer()
IP_PROTOCOL_ACTION host_is_ip_present_in_db(NETSIM_ID d, NETSIM_IPAddress ip, NetSim_PACKET *packet)
void pim_handle_timer_event()
int iptable_add_check(ptrIP_ROUTINGTABLE current, ptrIP_ROUTINGTABLE mem)
void multicast_join_group()
void send_query_msg(NETSIM_ID d, NETSIM_IPAddress groupAddr, double time)
bool is_reserved_multicast_address(NETSIM_IPAddress ip)
struct ForwardRoute IP_FORWARD_ROUTE
NETSIM_IPAddress dns_query(NETSIM_ID nDeviceId, NETSIM_ID id)
void host_handle_unsolicited_report_timer()
int iptable_delete_by_type(ptrIP_WRAPPER wrapper, char *type)
void pass_to_lower_layer(NetSim_PACKET *packet, ptrIP_FORWARD_ROUTE route, UINT c)
int fn_NetSim_NAT_NetworkOut(NETSIM_ID ndev, NetSim_PACKET *packet)
#define _declspec(dllexport)
This function is used to trigger the update.
bool resp(ptrCLIENTINFO info, char *msg, bool isMore)
NETSIM_IPAddress * nextHop
NETSIM_IPAddress * gateway
struct ForwardRoute * next
Structure to store the device ip details.
NETSIM_IPAddress ipPoolEnd
NETSIM_IPAddress * GatewayIPAddress
NETSIM_IPAddress ipPoolStart
unsigned int nRouterAdverLifeTime
unsigned int nRouterAdverMaxInterval
NETSIM_IPAddress ipPoolMask
IP_GATEWAYSTATE * nGatewayState
unsigned int nRouterAdvertisementFlag
unsigned int nICMPPollingTime
bool isFirewallConfigured
NETSIM_IPAddress serverIP
unsigned int nRouterAdverMinInterval
unsigned int nGatewayCount
Structure to store the IP metrics.
unsigned int nFirewallBlocked
unsigned int nPacketReceived
unsigned int nPacketDiscarded
unsigned int nPacketForwarded
Structure to store ip routing table.
NETSIM_IPAddress * Interface
NETSIM_IPAddress networkDestination