21 if (command->
length - index >= 9)
23 send_message(info,
"Too few argument for route add command\n");
29 if (command->
length - index >= 1)
31 send_message(info,
"Too few argument for route delete command\n");
37 if (command->
length - index < 2)
39 send_message(info,
"Too less argument for route command\n");
52 send_message(info,
"%s is not valid argument for route command\n",
78 prefix = atoi(command->
commands[index + 3]);
82 metric = atoi(command->
commands[index + 6]);
84 in = atoi(command->
commands[index + 8]);
86 iptable_add(
IP_WRAPPER_GET(d), dest, mask, prefix, gateway, 1, &
DEVICE_NWADDRESS(d, in), &in, metric,
"STATIC");
100 send_message(info,
"===========================================\n\n");
102 send_message(info,
"===========================================\n\n");
104 send_message(info,
"%30s\t%15s\t%30s\t%30s\t%10s\t%10s\n",
105 "Network Destination",
135 send_message(info,
"================================================\n");
void send_message(ptrCLIENTINFO info, char *msg,...)
int iptable_delete(ptrIP_WRAPPER wrapper, NETSIM_IPAddress dest, NETSIM_IPAddress in, char *type)
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)
NETSIM_IPAddress STR_TO_IP(char *ipStr, int type)
int STR_GET_IP_TYPE(char *ip)
#define STR_TO_IP4(ipstr)
#define fnNetSimError(x,...)
#define ptrIP_ROUTINGTABLE
static bool validate_route_delete_command(ptrCLIENTINFO info, ptrCOMMANDARRAY command, int index)
static void execute_route_delete_command(ptrCLIENTINFO info, ptrCOMMANDARRAY command, int index, NETSIM_ID d)
static void execute_route_print_command(ptrCLIENTINFO info, ptrCOMMANDARRAY command, int index, NETSIM_ID d)
bool validate_route_command(ptrCLIENTINFO info, ptrCOMMANDARRAY command, int index)
void execute_route_command(ptrCLIENTINFO info, ptrCOMMANDARRAY command, int index, NETSIM_ID d)
static void execute_route_add_command(ptrCLIENTINFO info, ptrCOMMANDARRAY command, int index, NETSIM_ID d)
static bool validate_route_add_command(ptrCLIENTINFO info, ptrCOMMANDARRAY command, int index)
#define DEVICE_NWADDRESS(DeviceId, InterfaceId)
#define IP_WRAPPER_GET(DeviceId)
Structure to store ip routing table.
NETSIM_IPAddress * Interface
NETSIM_IPAddress networkDestination
char str_ip[_NETSIM_IP_LEN]