-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefinitions.h
More file actions
68 lines (55 loc) · 1.88 KB
/
definitions.h
File metadata and controls
68 lines (55 loc) · 1.88 KB
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
#ifndef __DEFINES__
#define __DEFINES__
// The purpose of this file is to defines the macros
// Used in all system's parts
// ----------------- General macros -----------------
#define __ERROR__ -1
#define __OK__ 0
#define _DEFAULT_ARP_TTL_ 60
#define LOOPBACK_IP "127.0.0.1"
#define XARPD_PORT 5050
#define LISTEN_ENQ 5 // listen queue size
#define MAX_IFNAME_LEN 22
#define IFACE_UP 1
#define IFACE_DOWN 0
// -------------- End general macros -----------------
// ----------- Types of arp table entries ------------
#define DYNAMIC_ENTRY 0
#define STATIC_ENTRY 1
// --------- End types of arp table entries ----------
// ------------------ IP protocol --------------------
#define ICMP_PROTOCOL 0x01
// ---------------- End IP protocol ------------------
// -------------- ICMP Protocol ----------------------
#define ICMP_ECHO_REQUEST 0x08
// ------------- End ICMP Protocol -------------------
// ------------------ ARP protocol -------------------
#define ARP_ETHERTYPE 0x0806
#define ARP_HW_TYPE 0x0001
#define ARP_PROTOTYPE 0x0800 // IP
#define HW_ADDR_LEN 0x06 // 6 bytes
#define PROTOCOL_ADDR_LEN 0x04 // 4 bytes
#define ARP_REQUEST 0x01
#define ARP_REPLY 0x02
#define ARP_TIMEOUT 0x05 // 5 seconds
// ---------------- End ARP protocol ------------------
// ---------- Inter program communication ------------
// OPCODES
// 0 - 49 xifconfig
#define LIST_IFCES 0
#define CONFIG_IFACE 1
#define SET_IFACE_MTU 2
#define LIST_IFACE 3
#define TURN_IFACE_ON_OFF 4
// 50 - 99 xarp
#define SHOW_ARP_TABLE 50
#define RES_IP 51
#define ADD_ARP_LINE 52
#define DEL_ARP_LINE 53
#define SET_ARP_TTL 54
// 100 - 149 xroute
#define SHOW_ROUTE_TABLE 100
#define ADD_ROUTE_LINE 101
#define DEL_ROUTE_LINE 102
// -------- End inter program communication ----------
#endif