-
Notifications
You must be signed in to change notification settings - Fork 0
/
sr_rt.h
53 lines (46 loc) · 1.47 KB
/
sr_rt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*-----------------------------------------------------------------------------
* file: sr_rt.h
* date: Mon Oct 07 03:53:53 PDT 2002
* Author: [email protected]
*
* Description:
*
* Methods and datastructures for handeling the routing table
*
*---------------------------------------------------------------------------*/
#ifndef sr_RT_H
#define sr_RT_H
#ifdef _DARWIN_
#include <sys/types.h>
#endif
#define INFINITY 16
#include <netinet/in.h>
#include "sr_if.h"
#include "sr_protocol.h"
/* ----------------------------------------------------------------------------
* struct sr_rt
*
* Node in the routing table
*
* -------------------------------------------------------------------------- */
struct sr_rt
{
struct in_addr dest;
struct in_addr gw;
struct in_addr mask;
char interface[sr_IFACE_NAMELEN];
uint32_t metric;
time_t updated_time;
struct sr_rt* next;
};
int sr_build_rt(struct sr_instance*);
int sr_load_rt(struct sr_instance*,const char*);
void sr_add_rt_entry(struct sr_instance*, struct in_addr,struct in_addr,
struct in_addr, uint32_t metric, char*);
void sr_print_routing_table(struct sr_instance* sr);
void sr_print_routing_entry(struct sr_rt* entry);
void *sr_rip_timeout(void *sr_ptr);
void send_rip_request(struct sr_instance *sr);
void send_rip_response(struct sr_instance *sr);
void update_route_table(struct sr_instance *sr, uint8_t *packet, unsigned int len, char *interface);
#endif /* -- sr_RT_H -- */