1/*
2 * Copyright (c) 1998-2013 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 __DISKARBITRATIOND_DAINTERNAL__
25#define __DISKARBITRATIOND_DAINTERNAL__
26
27#include <mach/mach.h>
28#include <sys/mount.h>
29#include <CoreFoundation/CoreFoundation.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif /* __cplusplus */
34
35#define ___GID_WHEEL 0
36#define ___UID_ROOT  0
37
38#define ___GID_UNKNOWN 99
39#define ___UID_UNKNOWN 99
40
41#define _kDADaemonName "com.apple.DiskArbitration.diskarbitrationd"
42
43enum
44{
45    _kDAAuthorizeOptionDefault                   = 0x00000000,
46    _kDAAuthorizeOptionAuthenticateAdministrator = 0x00000001,
47    _kDAAuthorizeOptionIsOwner                   = 0x00080000
48};
49
50typedef UInt32 _DAAuthorizeOptions;
51
52enum
53{
54    _kDADiskAppearedCallback,
55    _kDADiskClaimCallback,
56    _kDADiskClaimReleaseCallback,
57    _kDADiskDescriptionChangedCallback,
58    _kDADiskDisappearedCallback,
59    _kDADiskEjectCallback,
60    _kDADiskEjectApprovalCallback,
61    _kDADiskMountCallback,
62    _kDADiskMountApprovalCallback,
63    _kDADiskPeekCallback,
64    _kDADiskProbeCallback,
65    _kDADiskRefreshCallback,
66    _kDADiskRenameCallback,
67    _kDADiskUnmountCallback,
68    _kDADiskUnmountApprovalCallback,
69    _kDAIdleCallback
70};
71
72typedef UInt32 _DACallbackKind;
73
74enum
75{
76    _kDADiskClaim   = _kDADiskClaimCallback,
77    _kDADiskEject   = _kDADiskEjectCallback,
78    _kDADiskMount   = _kDADiskMountCallback,
79    _kDADiskProbe   = _kDADiskProbeCallback,
80    _kDADiskRefresh = _kDADiskRefreshCallback,
81    _kDADiskRename  = _kDADiskRenameCallback,
82    _kDADiskUnmount = _kDADiskUnmountCallback
83};
84
85typedef UInt32 _DARequestKind;
86
87const char * _kDAAuthorizeRightAdopt;
88const char * _kDAAuthorizeRightEncode;
89const char * _kDAAuthorizeRightMount;
90const char * _kDAAuthorizeRightRename;
91const char * _kDAAuthorizeRightUnmount;
92
93const CFStringRef _kDACallbackAddressKey;       /* ( CFNumber     ) */
94const CFStringRef _kDACallbackArgument0Key;     /* ( CFType       ) */
95const CFStringRef _kDACallbackArgument1Key;     /* ( CFType       ) */
96const CFStringRef _kDACallbackContextKey;       /* ( CFNumber     ) */
97const CFStringRef _kDACallbackDiskKey;          /* ( DADisk       ) */
98const CFStringRef _kDACallbackKindKey;          /* ( CFNumber     ) */
99const CFStringRef _kDACallbackMatchKey;         /* ( CFDictionary ) */
100const CFStringRef _kDACallbackOrderKey;         /* ( CFNumber     ) */
101const CFStringRef _kDACallbackSessionKey;       /* ( DASession    ) */
102const CFStringRef _kDACallbackTimeKey;          /* ( CFDate       ) */
103const CFStringRef _kDACallbackWatchKey;         /* ( CFArray      ) */
104
105const CFStringRef _kDADiskIDKey;                /* ( CFData       ) */
106
107const CFStringRef _kDADissenterProcessIDKey;    /* ( CFNumber     ) */
108const CFStringRef _kDADissenterStatusKey;       /* ( CFNumber     ) */
109const CFStringRef _kDADissenterStatusStringKey; /* ( CFString     ) */
110
111const CFStringRef _kDARequestArgument1Key;      /* ( CFType       ) */
112const CFStringRef _kDARequestArgument2Key;      /* ( CFType       ) */
113const CFStringRef _kDARequestArgument3Key;      /* ( CFType       ) */
114const CFStringRef _kDARequestCallbackKey;       /* ( DACallback   ) */
115const CFStringRef _kDARequestDiskKey;           /* ( DADisk       ) */
116const CFStringRef _kDARequestDissenterKey;      /* ( DADissenter  ) */
117const CFStringRef _kDARequestKindKey;           /* ( CFNumber     ) */
118const CFStringRef _kDARequestLinkKey;           /* ( CFArray      ) */
119const CFStringRef _kDARequestStateKey;          /* ( CFNumber     ) */
120const CFStringRef _kDARequestUserGIDKey;        /* ( CFNumber     ) */
121const CFStringRef _kDARequestUserUIDKey;        /* ( CFNumber     ) */
122
123__private_extern__ int          ___statfs( const char * path, struct statfs * buf, int flags );
124__private_extern__ Boolean      ___CFArrayContainsValue( CFArrayRef array, const void * value );
125__private_extern__ void         ___CFArrayRemoveValue( CFMutableArrayRef array, const void * value );
126__private_extern__ vm_address_t ___CFDataCopyBytes( CFDataRef data, mach_msg_type_number_t * length );
127__private_extern__ SInt64       ___CFDictionaryGetIntegerValue( CFDictionaryRef dictionary, const void * key );
128__private_extern__ void         ___CFDictionarySetIntegerValue( CFMutableDictionaryRef dictionary, const void * key, SInt64 value );
129__private_extern__ CFNumberRef  ___CFNumberCreateWithIntegerValue( CFAllocatorRef allocator, SInt64 value );
130__private_extern__ SInt64       ___CFNumberGetIntegerValue( CFNumberRef number );
131__private_extern__ char *       ___CFStringCopyCString( CFStringRef string );
132__private_extern__ char *       ___CFURLCopyFileSystemRepresentation( CFURLRef url );
133
134__private_extern__ const char * _DACallbackKindGetName( _DACallbackKind kind );
135__private_extern__ const char * _DARequestKindGetName( _DARequestKind kind );
136
137__private_extern__ CFDataRef              _DASerialize( CFAllocatorRef allocator, CFTypeRef object );
138__private_extern__ CFDataRef              _DASerializeDiskDescription( CFAllocatorRef allocator, CFDictionaryRef description );
139__private_extern__ CFTypeRef              _DAUnserialize( CFAllocatorRef allocator, CFDataRef data );
140__private_extern__ CFMutableDictionaryRef _DAUnserializeDiskDescription( CFAllocatorRef allocator, CFDataRef data );
141__private_extern__ CFMutableDictionaryRef _DAUnserializeDiskDescriptionWithBytes( CFAllocatorRef allocator, vm_address_t bytes, vm_size_t length );
142__private_extern__ CFTypeRef              _DAUnserializeWithBytes( CFAllocatorRef allocator, vm_address_t bytes, vm_size_t length );
143
144__private_extern__ char * _DAVolumeCopyID( const struct statfs * fs );
145__private_extern__ char * _DAVolumeGetID( const struct statfs * fs );
146
147#ifdef __cplusplus
148}
149#endif /* __cplusplus */
150
151#endif /* !__DISKARBITRATIOND_DAINTERNAL__ */
152