-
Notifications
You must be signed in to change notification settings - Fork 0
/
sr_handler.h
51 lines (36 loc) · 1.35 KB
/
sr_handler.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
#ifndef SR_HANDLER_H
#define SR_HANDLER_H
#include <netinet/in.h>
#include <sys/time.h>
#include <stdio.h>
#include "sr_protocol.h"
#include "sr_base_internal.h"
#include "cli/helper.h"
#include "sr_router.h"
#include "sr_arp.h"
#include "sr_help.h"
#include "sr_integration.h"
#include "sr_lpm.h"
struct send_list
{
uint8_t* payload;
uint32_t IP;
char* iface;
unsigned int len;
time_t added;
uint16_t type;
struct send_list* next;
};
/* Toby's amazing functions */
struct sr_eth_pkt* read_ethernet_frame( uint8_t*, unsigned int);
struct sr_arphdr* extract_arp_header(uint8_t*);
struct sr_ip_pkt* read_ip_pkt(uint8_t*, unsigned int );
int handle_ip_pkt(struct sr_instance* , uint8_t* , char* , unsigned int, uint8_t MAC[] );
int make_and_send(struct sr_instance*, char*, uint32_t, uint8_t*, unsigned int, uint8_t);
int process_ICMP_pkt(struct sr_instance*, char* , uint32_t, uint8_t*, unsigned int);
int create_ICMP_pkt(struct sr_instance*, char*, uint32_t, uint8_t, uint8_t, uint16_t, uint16_t, uint8_t*, unsigned int);
struct send_list* send_list_new();
int send_list_send(struct send_list*, struct sr_instance*, uint32_t*, uint8_t*);
void send_list_add(struct send_list**, uint32_t, uint8_t*, unsigned int, char*, uint16_t, time_t);
int send_packet(struct sr_instance*, char*, uint8_t*, uint8_t*, unsigned int, uint16_t);
#endif /* SR_HANDLER_H */