1 1.1 christos /* interface-monitor-macos.h 2 1.1 christos * 3 1.1 christos * Copyright (c) 2021 Apple Inc. All rights reserved. 4 1.1 christos * 5 1.1 christos * Licensed under the Apache License, Version 2.0 (the "License"); 6 1.1 christos * you may not use this file except in compliance with the License. 7 1.1 christos * You may obtain a copy of the License at 8 1.1 christos * 9 1.1 christos * https://www.apache.org/licenses/LICENSE-2.0 10 1.1 christos * 11 1.1 christos * Unless required by applicable law or agreed to in writing, software 12 1.1 christos * distributed under the License is distributed on an "AS IS" BASIS, 13 1.1 christos * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 1.1 christos * See the License for the specific language governing permissions and 15 1.1 christos * limitations under the License. 16 1.1 christos */ 17 1.1 christos 18 1.1 christos #ifndef __INTERFACE_MONITOR_MACOS_H__ 19 1.1 christos #define __INTERFACE_MONITOR_MACOS_H__ 20 1.1 christos 21 1.1 christos #include <CoreUtils/CommonServices.h> 22 1.1 christos #include <dispatch/dispatch.h> 23 1.1 christos 24 1.1 christos typedef struct ifmon_s *ifmon_t; 25 1.1 christos 26 1.1 christos CU_ASSUME_NONNULL_BEGIN 27 1.1 christos 28 1.1 christos __BEGIN_DECLS 29 1.1 christos 30 1.1 christos ifmon_t 31 1.1 christos ifmon_create(dispatch_queue_t queue); 32 1.1 christos 33 1.1 christos void 34 1.1 christos ifmon_set_primary_ip_changed_handler(ifmon_t monitor, dispatch_block_t handler); 35 1.1 christos 36 1.1 christos void 37 1.1 christos ifmon_activate(ifmon_t monitor, dispatch_block_t completion_handler); 38 1.1 christos 39 1.1 christos sockaddr_ip 40 1.1 christos ifmon_get_primary_ipv4_address(ifmon_t monitor); 41 1.1 christos 42 1.1 christos sockaddr_ip 43 1.1 christos ifmon_get_primary_ipv6_address(ifmon_t monitor); 44 1.1 christos 45 1.1 christos void 46 1.1 christos ifmon_invalidate(ifmon_t monitor); 47 1.1 christos 48 1.1 christos void 49 1.1 christos ifmon_release(ifmon_t monitor); 50 1.1 christos 51 1.1 christos __END_DECLS 52 1.1 christos 53 1.1 christos CU_ASSUME_NONNULL_END 54 1.1 christos 55 1.1 christos #endif // __INTERFACE_MONITOR_MACOS_H__ 56