]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCNetworkSignature.h
configd-453.16.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SCNetworkSignature.h
1 /*
2 * Copyright (c) 2006, 2008, 2011 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 #ifndef _SCNETWORKSIGNATURE_H
25 #define _SCNETWORKSIGNATURE_H
26
27 #include <Availability.h>
28 #include <sys/cdefs.h>
29 #include <CoreFoundation/CFString.h>
30 #include <CoreFoundation/CFArray.h>
31 #include <netinet/in.h>
32
33 __BEGIN_DECLS
34
35 /*!
36 @header SCNetworkSignature
37 @discussion The SCNetworkSignature API provides access to the
38 network identification information. Each routable network
39 has an associated signature that is assigned a unique
40 identifier. The unique identifier allows an application
41 to associate settings with a particular network
42 or set of networks.
43 */
44
45 /*!
46 @const kSCNetworkSignatureActiveChangedNotifyName
47 @discussion The name to use with the notify(3) API's to monitor
48 when the list of active signatures changes.
49 */
50 extern const char * kSCNetworkSignatureActiveChangedNotifyName;
51
52 /*!
53 @function SCNetworkSignatureCopyActiveIdentifiers
54 @discussion Find all currently active networks and return a list of
55 (string) identifiers, one for each network.
56 @param allocator The CFAllocator that should be used to allocate
57 memory for the local dynamic store object.
58 This parameter may be NULL in which case the current
59 default CFAllocator is used. If this reference is not
60 a valid CFAllocator, the behavior is undefined.
61 @result A CFArrayRef containing a list of (string) identifiers,
62 NULL if no networks are currently active.
63 */
64 CFArrayRef /* of CFStringRef's */
65 SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
66
67 /*!
68 @function SCNetworkSignatureCopyActiveIdentifierForAddress
69 @discussion Find the one active network associated with the specified
70 address and return the unique (string) identifier that
71 represents it.
72 @param allocator The CFAllocator that should be used to allocate
73 memory for the local dynamic store object.
74 This parameter may be NULL in which case the current
75 default CFAllocator is used. If this reference is not
76 a valid CFAllocator, the behavior is undefined.
77 @param addr The address of interest. Note: currently only AF_INET
78 0.0.0.0 is supported, passing anything else always returns
79 NULL.
80 @result The unique (string) identifier associated with the address,
81 NULL if no network is known.
82 */
83 CFStringRef
84 SCNetworkSignatureCopyActiveIdentifierForAddress(CFAllocatorRef alloc,
85 const struct sockaddr * addr) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
86
87 /*!
88 @function SCNetworkSignatureCopyIdentifierForConnectedSocket
89 @discussion Find the identifier for the given file descriptor
90 corresponding to a connected socket.
91 @param allocator The CFAllocator that should be used to allocate
92 memory for the local dynamic store object.
93 This parameter may be NULL in which case the current
94 default CFAllocator is used. If this reference is not
95 a valid CFAllocator, the behavior is undefined.
96 @param sock_fd The socket file descriptor, must be either AF_INET
97 or AF_INET6.
98 @result The unique (string) identifier associated with the address,
99 NULL if no network is known.
100 */
101 CFStringRef
102 SCNetworkSignatureCopyIdentifierForConnectedSocket(CFAllocatorRef alloc,
103 int sock_fd) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
104
105 __END_DECLS
106
107 #endif /* _SCNETWORKSIGNATURE_H */