]> git.saurik.com Git - apple/security.git/blob - OSX/sec/SharedWebCredential/swcagent_client.h
Security-58286.20.16.tar.gz
[apple/security.git] / OSX / sec / SharedWebCredential / swcagent_client.h
1 /*
2 * Copyright (c) 2014 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 #ifndef _SWCAGENT_CLIENT_H_
24 #define _SWCAGENT_CLIENT_H_
25
26 #include <stdint.h>
27
28 #include <CoreFoundation/CFArray.h>
29 #include <CoreFoundation/CFDictionary.h>
30 #include <CoreFoundation/CFError.h>
31
32 #include <xpc/xpc.h>
33 #include <CoreFoundation/CFXPCBridge.h>
34
35 // TODO: This should be in client of XPC code locations...
36 #define kSWCAXPCServiceName "com.apple.security.swcagent"
37
38 //
39 // MARK: XPC Information.
40 //
41
42 extern CFStringRef sSWCAXPCErrorDomain;
43
44 //
45 // MARK: XPC Interfaces
46 //
47
48 extern const char *kSecXPCKeyOperation;
49 extern const char *kSecXPCKeyResult;
50 extern const char *kSecXPCKeyEndpoint;
51 extern const char *kSecXPCKeyError;
52 extern const char *kSecXPCKeyClientToken;
53 extern const char *kSecXPCKeyPeerInfoArray;
54 extern const char *kSecXPCKeyPeerInfo;
55 extern const char *kSecXPCKeyUserLabel;
56 extern const char *kSecXPCKeyDSID;
57 extern const char *kSecXPCKeyUserPassword;
58 extern const char *kSecXPCLimitInMinutes;
59 extern const char *kSecXPCKeyQuery;
60 extern const char *kSecXPCKeyAttributesToUpdate;
61 extern const char *kSecXPCKeyDomain;
62 extern const char *kSecXPCKeyDigest;
63 extern const char *kSecXPCKeyCertificate;
64 extern const char *kSecXPCKeySettings;
65 extern const char *kSecXPCKeyDeviceID;
66 extern const char *kSecXPCKeyIDSMessage;
67 extern const char *kSecXPCKeySendIDSMessage;
68 extern const char *kSecXPCKeyEscrowLabel;
69 extern const char *kSecXPCKeyTriesLabel;
70 extern const char *kSecXPCKeyViewName;
71 extern const char *kSecXPCKeyViewActionCode;
72
73 //
74 // MARK: Mach port request IDs
75 //
76 enum SWCAXPCOperation {
77 swca_add_request_id,
78 swca_update_request_id,
79 swca_delete_request_id,
80 swca_copy_request_id,
81 swca_select_request_id,
82 swca_copy_pairs_request_id,
83 swca_set_selection_request_id,
84 swca_enabled_request_id,
85 };
86
87 xpc_object_t swca_message_with_reply_sync(xpc_object_t message, CFErrorRef *error);
88 xpc_object_t swca_create_message(enum SWCAXPCOperation op, CFErrorRef *error);
89 bool swca_message_no_error(xpc_object_t message, CFErrorRef *error);
90 long swca_message_response(xpc_object_t replyMessage, CFErrorRef *error);
91
92 bool swca_autofill_enabled(const audit_token_t *auditToken);
93
94 bool swca_confirm_operation(enum SWCAXPCOperation op,
95 const audit_token_t *auditToken,
96 CFTypeRef query,
97 CFErrorRef *error,
98 void (^add_negative_entry)(CFStringRef fqdn));
99
100 CFTypeRef swca_message_copy_response(xpc_object_t replyMessage, CFErrorRef *error);
101
102 CFDictionaryRef swca_copy_selected_dictionary(enum SWCAXPCOperation op,
103 const audit_token_t *auditToken,
104 CFTypeRef items,
105 CFErrorRef *error);
106
107 CFArrayRef swca_copy_pairs(enum SWCAXPCOperation op,
108 const audit_token_t *auditToken,
109 CFErrorRef *error);
110
111 bool swca_set_selection(enum SWCAXPCOperation op,
112 const audit_token_t *auditToken,
113 CFTypeRef dictionary,
114 CFErrorRef *error);
115
116 bool swca_send_sync_and_do(enum SWCAXPCOperation op, CFErrorRef *error,
117 bool (^add_to_message)(xpc_object_t message, CFErrorRef* error),
118 bool (^handle_response)(xpc_object_t response, CFErrorRef* error));
119
120
121 #endif /* _SWCAGENT_CLIENT_H_ */