blob: 118bf88065f65686ca4416db80eae04a888d91a4 [file] [log] [blame]
Bjoern Johanssondf74cb42018-08-23 16:43:53 -07001/*
2 * Copyright 2018, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <stddef.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25struct ifMonitor;
26
27struct ifAddress {
28 int family;
29 int prefix;
30 unsigned char addr[16];
31};
32
33// A callback for when the addresses on an interface changes
34typedef void (*ifMonitorCallback)(unsigned int /*interface index*/,
35 const struct ifAddress* /*addresses*/,
36 size_t /*number of addresses */);
37
38struct ifMonitor* ifMonitorCreate();
39void ifMonitorFree(struct ifMonitor* monitor);
40
41void ifMonitorSetCallback(struct ifMonitor* monitor,
42 ifMonitorCallback callback);
43void ifMonitorRunAsync(struct ifMonitor* monitor);
44void ifMonitorStop(struct ifMonitor* monitor);
45
46#ifdef __cplusplus
47} // extern "C"
48#endif
49