-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw_addrs.h
52 lines (40 loc) · 1.38 KB
/
hw_addrs.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
/* Our own header for the programs that need hardware address info. */
#ifndef HW_ADDR_H
#define HW_ADDR_H
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <assert.h>
//#include <linux/if_arp.h>
#define ODR_K2159 2159
#define IF_NAME 16 /* same as IFNAMSIZ in <net/if.h> */
#define IF_HADDR 6 /* same as IFHWADDRLEN in <net/if.h> */
#define MAX_IF 6
#define IP_ALIAS 1 /* hwa_addr is an alias */
#define ETH_HDRLEN 14
extern struct sockaddr_in eth0_ip;
extern int total_if_count;
struct hwa_info {
char if_name[IF_NAME]; /* interface name, null terminated */
char if_haddr[IF_HADDR]; /* hardware address */
int if_index; /* interface index */
short ip_alias; /* 1 if hwa_addr is an alias IP address */
struct sockaddr *ip_addr; /* IP address */
struct hwa_info *hwa_next; /* next of these structures */
};
struct hw_odr_info{
char if_name[IF_NAME]; /* interface name, null terminated */
char if_haddr[IF_HADDR]; /* hardware address */
int if_index; /* interface index */
struct sockaddr_in ip_addr; /* IP address */
};
extern int staleness;
extern struct hw_odr_info if_list[MAX_IF];
/* function prototypes */
struct hwa_info *get_hw_addrs();
struct hwa_info *Get_hw_addrs();
void free_hwa_info(struct hwa_info *);
#endif