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