Libinfo-517.200.9.tar.gz
[apple/libinfo.git] / lookup.subproj / si_compare.h
1 //
2 // si_compare.h
3 // Libinfo
4 //
5 // Copyright (c) 2011-2017 Apple Inc. All rights reserved.
6 //
7
8 #ifndef __SI_COMPARE_H__
9 #define __SI_COMPARE_H__
10
11 #include <sys/cdefs.h>
12 #include <sys/socket.h>
13 #include <stdbool.h>
14 #include <os/availability.h>
15
16
17 __BEGIN_DECLS
18
19 /*!
20 * @function si_destination_compare
21 *
22 * Equivalent to the si_destination_compare function, but doesn't take any routing table information
23 * into account. This follows rules 6, 8 and 10 of RFC 6724 destination address selection.
24 *
25 * @param destination1
26 * The first potential destination address.
27 *
28 * @param destination2
29 * The second potential destination address.
30 *
31 * @result
32 * Returns -1 if destination1 is less desirable than destination 2. Returns 0 if destination1
33 * is equally as desirable as destination 2. Returns 1 if destination 1 is more desirable than
34 * destination 2.
35 */
36 API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
37 int si_destination_compare(const struct sockaddr *dst1, int dst1ifindex,
38 const struct sockaddr *dst2, int dst2ifindex,
39 bool statistics);
40
41 /*!
42 * @function si_destination_compare_no_dependencies
43 *
44 * Equivalent to the si_destination_compare function, but doesn't take any routing table information
45 * into account. This follows rules 6, 8 and 10 of RFC 6724 destination address selection.
46 *
47 * @param destination1
48 * The first potential destination address.
49 *
50 * @param destination2
51 * The second potential destination address.
52 *
53 * @result
54 * Returns -1 if destination1 is less desirable than destination 2. Returns 0 if destination1
55 * is equally as desirable as destination 2. Returns 1 if destination 1 is more desirable than
56 * destination 2.
57 */
58 API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
59 int
60 si_destination_compare_no_dependencies(const struct sockaddr *destination1,
61 const struct sockaddr *destination2);
62
63 __END_DECLS
64
65 #endif // __SI_COMPARE_H__