Imported Upstream version 1.37
[platform/upstream/connman.git] / src / shared / arp.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  based on IPv4 Local Link library with GLib integration,
6  *          Copyright (C) 2009-2010  Aldebaran Robotics. All rights reserved.
7  *
8  *  Copyright (C) 2018  Commend International. All rights reserved.
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License version 2 as
12  *  published by the Free Software Foundation.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  */
20
21 #ifndef SHARED_ARP_H
22 #define SHARED_ARP_H
23
24 #include <stdint.h>
25
26 /* IPv4 Link-Local (RFC 3927), IPv4 Address Conflict Detection (RFC 5227) */
27 #define PROBE_WAIT           1
28 #define PROBE_NUM            3
29 #define PROBE_MIN            1
30 #define PROBE_MAX            2
31 #define ANNOUNCE_WAIT        2
32 #define ANNOUNCE_NUM         2
33 #define ANNOUNCE_INTERVAL    2
34 #define MAX_CONFLICTS       10
35 #define RATE_LIMIT_INTERVAL 60
36 #define DEFEND_INTERVAL     10
37
38 /* 169.254.0.0 */
39 #define LINKLOCAL_ADDR 0xa9fe0000
40
41 int arp_send_packet(uint8_t* source_eth, uint32_t source_ip,
42                     uint32_t target_ip, int ifindex);
43 int arp_socket(int ifindex);
44
45 uint32_t arp_random_ip(void);
46
47 #endif