summaryrefslogtreecommitdiff
path: root/include/acd.h
blob: 0d777963caae69a2dd91ee0ba040ac7989b57d19 (plain)
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
/*
 *
 *  Connection Manager
 *
 *  Copyright (C) 2018  Commend International. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 */

/*
 *  Address Conflict Detection (RFC 5227)
 *
 *  based on DHCP client library with GLib integration,
 *      Copyright (C) 2009-2014  Intel Corporation. All rights reserved.
 *
 */

#ifndef __CONNMAN_ACD_H
#define __CONNMAN_ACD_H

#include <stdint.h>
#include <glib.h>

#ifdef __cplusplus
extern "C" {
#endif

struct acd_host;

struct acd_host *acd_host_new(int ifindex, const char* path);
void acd_host_free(struct acd_host *acd);
int acd_host_start(struct acd_host *acd, uint32_t ip);
void acd_host_stop(struct acd_host *acd);

typedef void (*acd_host_cb_t) (struct acd_host *acd, gpointer user_data);

enum acd_host_event {
	ACD_HOST_EVENT_IPV4_AVAILABLE,
	ACD_HOST_EVENT_IPV4_LOST,
	ACD_HOST_EVENT_IPV4_CONFLICT,
	ACD_HOST_EVENT_IPV4_MAXCONFLICT,
};

void acd_host_register_event(struct acd_host *acd,
			    enum acd_host_event event,
			    acd_host_cb_t func,
			    gpointer user_data);

void acd_host_append_dbus_property(struct acd_host *acd, DBusMessageIter *dict);

unsigned int acd_host_get_conflicts_count(struct acd_host *acd);

#ifdef __cplusplus
}
#endif

#endif /* __CONNMAN_ACD_H */