this repo has no description
1/*
2 * Copyright (c) 2012-2017 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
25 * ip_plugin.h
26 * - header for IPMonitor.bundle
27 */
28
29#ifndef _IP_PLUGIN_H
30#define _IP_PLUGIN_H
31
32#include <net/if.h>
33#include <netinet/in.h>
34#include <CoreFoundation/CoreFoundation.h>
35#include <SystemConfiguration/SCPrivate.h>
36
37#ifdef TEST_IPV4_ROUTELIST
38#define TEST_ROUTELIST
39#endif
40
41#ifdef TEST_IPV6_ROUTELIST
42#define TEST_ROUTELIST
43#endif
44
45#ifndef countof
46#define countof(array) (sizeof(array) / sizeof((array)[0]))
47#endif
48
49#define kIsNULL CFSTR("IsNULL") /* CFBoolean */
50
51#ifndef my_log
52 #ifdef TEST_ROUTELIST
53 #define my_log(__level, __format, ...) SCPrint(TRUE, stdout, CFSTR(__format "\n"), ## __VA_ARGS__)
54 #else /* TEST_ROUTELIST */
55 #define my_log(__level, __format, ...) SC_log(__level, __format, ## __VA_ARGS__)
56 #endif /* TEST_ROUTELIST */
57#endif // !my_log
58
59os_log_t
60__log_IPMonitor(void);
61
62boolean_t
63cfstring_to_ip(CFStringRef str, struct in_addr * ip_p);
64
65boolean_t
66cfstring_to_ip6(CFStringRef str, struct in6_addr * ip6_p);
67
68unsigned int
69my_if_nametoindex(const char * ifname);
70
71const char *
72my_if_indextoname(unsigned int idx, char if_name[IFNAMSIZ]);
73
74boolean_t
75service_is_routable(CFDictionaryRef service_dict, int af);
76
77boolean_t
78service_is_scoped_only(CFDictionaryRef service_dict);
79
80boolean_t
81check_if_service_expensive(CFStringRef serviceID);
82
83CFDictionaryRef
84ipv4_dict_create(CFDictionaryRef state_dict);
85
86CFDictionaryRef
87ipv6_dict_create(CFDictionaryRef state_dict);
88
89#endif // _IP_PLUGIN_H