NetSim Source Code Help
Loading...
Searching...
No Matches
IP_Routing.c File Reference
#include "main.h"
#include "List.h"
#include "IP.h"
#include "NetSim_utility.h"
#include "Protocol.h"
#include "../Firewall/Firewall.h"
Include dependency graph for IP_Routing.c:

Go to the source code of this file.

Data Structures

struct  stru_match
 

Macros

#define MATCH_ALLOC()   (ptrMATCH)list_alloc(sizeof(MATCH),offsetof(MATCH,ele))
 
#define display_error(error, line, file)   fnNetSimError("Invalid line in route file %s at line %d: %s", file, line, error)
 

Typedefs

typedef struct stru_match MATCH
 
typedef struct stru_matchptrMATCH
 

Functions

static void print_match_table (ptrMATCH match, NETSIM_ID d, NETSIM_IPAddress dest, NETSIM_IPAddress src)
 
static void free_match_table (ptrMATCH l)
 
static int match_check (ptrMATCH m1, ptrMATCH m2)
 
static void add_to_match_list (ptrMATCH *l, ptrMATCH c)
 
static UINT get_bit_match_count (NETSIM_IPAddress ip1)
 
static ptrMATCH get_match_table (ptrIP_ROUTINGTABLE table, NETSIM_IPAddress dest, bool isStatic)
 
void free_ip_route (ptrIP_FORWARD_ROUTE route)
 
static void update_route_entry (ptrMATCH match, ptrIP_FORWARD_ROUTE route, NETSIM_IPAddress dest)
 
static ptrMATCH choose_match_for_reserved_address (ptrMATCH match, NETSIM_IPAddress dest, NETSIM_IPAddress src)
 
static void multicast_update_route_entry (ptrMATCH match, ptrIP_FORWARD_ROUTE route, NETSIM_IPAddress dest, NETSIM_IPAddress src)
 
static void route_onlink (NETSIM_ID d, NETSIM_IPAddress src, NETSIM_IPAddress dest, ptrIP_FORWARD_ROUTE route)
 
static bool check_my_ip (NETSIM_ID d, NETSIM_IPAddress ip)
 
static ptrIP_FORWARD_ROUTE route_unicast (NetSim_PACKET *packet, NETSIM_ID dev)
 
static ptrIP_FORWARD_ROUTE route_multicast (NetSim_PACKET *packet, NETSIM_ID dev)
 
ptrIP_FORWARD_ROUTE fn_NetSim_IP_RoutePacket (NetSim_PACKET *packet, NETSIM_ID dev)
 
static void change_table (NETSIM_ID d, ptrIP_ROUTINGTABLE table, NETSIM_IPAddress gateway, NETSIM_ID in, UINT metric)
 
static void add_table (NETSIM_ID d, NETSIM_IPAddress dest, NETSIM_IPAddress mask, NETSIM_IPAddress gateway, NETSIM_ID in, UINT metric)
 
void configure_static_ip_route (NETSIM_ID d, char *file)
 
static ptrIP_FORWARD_ROUTE static_route_unicast (NetSim_PACKET *packet, NETSIM_ID dev)
 
static ptrIP_FORWARD_ROUTE static_route_multicast (NetSim_PACKET *packet, NETSIM_ID dev)
 
ptrIP_FORWARD_ROUTE fn_NetSim_IP_RoutePacketViaStaticEntry (NetSim_PACKET *packet, NETSIM_ID dev)
 
void pass_to_lower_layer (NetSim_PACKET *packet, ptrIP_FORWARD_ROUTE route, UINT c)
 

Macro Definition Documentation

◆ display_error

#define display_error (   error,
  line,
  file 
)    fnNetSimError("Invalid line in route file %s at line %d: %s", file, line, error)

Definition at line 418 of file IP_Routing.c.

◆ MATCH_ALLOC

#define MATCH_ALLOC ( )    (ptrMATCH)list_alloc(sizeof(MATCH),offsetof(MATCH,ele))

Definition at line 39 of file IP_Routing.c.

Typedef Documentation

◆ MATCH

typedef struct stru_match MATCH

This function is used to route the packet

◆ ptrMATCH

typedef struct stru_match * ptrMATCH

Function Documentation

◆ add_table()

static void add_table ( NETSIM_ID  d,
NETSIM_IPAddress  dest,
NETSIM_IPAddress  mask,
NETSIM_IPAddress  gateway,
NETSIM_ID  in,
UINT  metric 
)
static

Definition at line 412 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_to_match_list()

static void add_to_match_list ( ptrMATCH l,
ptrMATCH  c 
)
static

Definition at line 90 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ change_table()

static void change_table ( NETSIM_ID  d,
ptrIP_ROUTINGTABLE  table,
NETSIM_IPAddress  gateway,
NETSIM_ID  in,
UINT  metric 
)
static

Definition at line 382 of file IP_Routing.c.

Here is the caller graph for this function:

◆ check_my_ip()

static bool check_my_ip ( NETSIM_ID  d,
NETSIM_IPAddress  ip 
)
static

Definition at line 309 of file IP_Routing.c.

◆ choose_match_for_reserved_address()

static ptrMATCH choose_match_for_reserved_address ( ptrMATCH  match,
NETSIM_IPAddress  dest,
NETSIM_IPAddress  src 
)
static

Definition at line 204 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ configure_static_ip_route()

void configure_static_ip_route ( NETSIM_ID  d,
char *  file 
)

This function is to configure static ip table

Definition at line 420 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_IP_RoutePacket()

ptrIP_FORWARD_ROUTE fn_NetSim_IP_RoutePacket ( NetSim_PACKET packet,
NETSIM_ID  dev 
)

Definition at line 371 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_IP_RoutePacketViaStaticEntry()

ptrIP_FORWARD_ROUTE fn_NetSim_IP_RoutePacketViaStaticEntry ( NetSim_PACKET packet,
NETSIM_ID  dev 
)

Definition at line 558 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_ip_route()

void free_ip_route ( ptrIP_FORWARD_ROUTE  route)

Definition at line 157 of file IP_Routing.c.

Here is the caller graph for this function:

◆ free_match_table()

static void free_match_table ( ptrMATCH  l)
static

Definition at line 72 of file IP_Routing.c.

Here is the caller graph for this function:

◆ get_bit_match_count()

static UINT get_bit_match_count ( NETSIM_IPAddress  ip1)
static

Definition at line 95 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_match_table()

static ptrMATCH get_match_table ( ptrIP_ROUTINGTABLE  table,
NETSIM_IPAddress  dest,
bool  isStatic 
)
static

Definition at line 111 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ match_check()

static int match_check ( ptrMATCH  m1,
ptrMATCH  m2 
)
static

Definition at line 78 of file IP_Routing.c.

Here is the caller graph for this function:

◆ multicast_update_route_entry()

static void multicast_update_route_entry ( ptrMATCH  match,
ptrIP_FORWARD_ROUTE  route,
NETSIM_IPAddress  dest,
NETSIM_IPAddress  src 
)
static

Definition at line 221 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pass_to_lower_layer()

void pass_to_lower_layer ( NetSim_PACKET packet,
ptrIP_FORWARD_ROUTE  route,
UINT  c 
)

Definition at line 568 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_match_table()

static void print_match_table ( ptrMATCH  match,
NETSIM_ID  d,
NETSIM_IPAddress  dest,
NETSIM_IPAddress  src 
)
static

Definition at line 41 of file IP_Routing.c.

Here is the caller graph for this function:

◆ route_multicast()

static ptrIP_FORWARD_ROUTE route_multicast ( NetSim_PACKET packet,
NETSIM_ID  dev 
)
static

Definition at line 343 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ route_onlink()

static void route_onlink ( NETSIM_ID  d,
NETSIM_IPAddress  src,
NETSIM_IPAddress  dest,
ptrIP_FORWARD_ROUTE  route 
)
static

Definition at line 271 of file IP_Routing.c.

Here is the call graph for this function:

◆ route_unicast()

static ptrIP_FORWARD_ROUTE route_unicast ( NetSim_PACKET packet,
NETSIM_ID  dev 
)
static

Definition at line 318 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ static_route_multicast()

static ptrIP_FORWARD_ROUTE static_route_multicast ( NetSim_PACKET packet,
NETSIM_ID  dev 
)
static

Definition at line 530 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ static_route_unicast()

static ptrIP_FORWARD_ROUTE static_route_unicast ( NetSim_PACKET packet,
NETSIM_ID  dev 
)
static

Definition at line 505 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_route_entry()

static void update_route_entry ( ptrMATCH  match,
ptrIP_FORWARD_ROUTE  route,
NETSIM_IPAddress  dest 
)
static

Definition at line 167 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function: