DA: Add exception check for time logic
[platform/upstream/connman.git] / include / acd.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2018  Commend International. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  */
17
18 /*
19  *  Address Conflict Detection (RFC 5227)
20  *
21  *  based on DHCP client library with GLib integration,
22  *      Copyright (C) 2009-2014  Intel Corporation. All rights reserved.
23  *
24  */
25
26 #ifndef __CONNMAN_ACD_H
27 #define __CONNMAN_ACD_H
28
29 #include <stdint.h>
30 #include <glib.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 struct acd_host;
37
38 struct acd_host *acd_host_new(int ifindex, const char* path);
39 void acd_host_free(struct acd_host *acd);
40 int acd_host_start(struct acd_host *acd, uint32_t ip);
41 void acd_host_stop(struct acd_host *acd);
42
43 typedef void (*acd_host_cb_t) (struct acd_host *acd, gpointer user_data);
44
45 enum acd_host_event {
46         ACD_HOST_EVENT_IPV4_AVAILABLE,
47         ACD_HOST_EVENT_IPV4_LOST,
48         ACD_HOST_EVENT_IPV4_CONFLICT,
49         ACD_HOST_EVENT_IPV4_MAXCONFLICT,
50 };
51
52 void acd_host_register_event(struct acd_host *acd,
53                             enum acd_host_event event,
54                             acd_host_cb_t func,
55                             gpointer user_data);
56
57 void acd_host_append_dbus_property(struct acd_host *acd, DBusMessageIter *dict);
58
59 unsigned int acd_host_get_conflicts_count(struct acd_host *acd);
60
61 #ifdef __cplusplus
62 }
63 #endif
64
65 #endif /* __CONNMAN_ACD_H */