1 /* 2 * Copyright 2019, 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 <netinet/in.h> 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 struct ipv6Monitor; 26 27 // A callback for when the IPv6 configuration changes. 28 typedef void (*ipv6MonitorCallback)(const struct in6_addr* /*gateway*/, 29 const struct in6_addr* /*dns servers*/, 30 size_t /*number of dns servers */); 31 32 // Create an IPv6 monitor that will monitor |interfaceName| for IPv6 router 33 // advertisements. The monitor will trigger a callback if the gateway and/or 34 // DNS servers provided by router advertisements change at any point. 35 struct ipv6Monitor* ipv6MonitorCreate(const char* interfaceName); 36 void ipv6MonitorFree(struct ipv6Monitor* monitor); 37 38 void ipv6MonitorSetCallback(struct ipv6Monitor* monitor, 39 ipv6MonitorCallback callback); 40 void ipv6MonitorRunAsync(struct ipv6Monitor* monitor); 41 void ipv6MonitorStop(struct ipv6Monitor* monitor); 42 43 #ifdef __cplusplus 44 } // extern "C" 45 #endif 46 47 48