-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharp.h
74 lines (57 loc) · 1.3 KB
/
arp.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef ARP_H_
#define ARP_H_
#include "hw_addrs.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/un.h>
#include <errno.h>
#include <netdb.h>
#include "common_lib.h"
#ifdef ARP_DEBUG
#define dprintf(fmt, args...) printf(fmt, ##args)
#else
#define dprintf(fmt, args...)
#endif
#define ARP_K2159 2159
#define ARP_9512K 9512
#define LISTENQ 1024
struct ip_to_mac{
unsigned long ip;
unsigned char mac[IF_HADDR];
};
extern struct ip_to_mac self_list[MAX_IF];
extern int eth0_index;
extern struct sockaddr_in eth0_ip;
extern unsigned char eth0_mac[IF_HADDR];
extern int total_self_entries;
typedef struct arp_packet_type{
int type;
#define AREQ 0
#define AREP 1
int proto_id;
unsigned short hatype;
unsigned char src_mac[IF_HADDR];
unsigned long src_ip;
unsigned char dest_mac[IF_HADDR];
unsigned long dest_ip;
} t_arp;
typedef struct arp_cache_entry{
unsigned long ip;
int sll_ifindex;
unsigned char mac[IF_HADDR];
unsigned short sll_hatype;
int connfd;
int incomplete;
struct arp_cache_entry * next;
}cache_entry;
extern cache_entry * cache_head;
int recv_process_pf_packet(int sockfd);
int process_app_conn(int sockfd,int connfd);
char * get_name(unsigned long ip);
#endif