Mercurial > projects > dstep
comparison dstep/security/Authorization.d @ 11:07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sat, 01 Aug 2009 15:03:28 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
10:27e00625790b | 11:07194b026fa4 |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Jul 22, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.security.Authorization; | |
8 | |
9 version (Tango) | |
10 import tango.stdc.stdio; | |
11 | |
12 else | |
13 import std.c.stdio; | |
14 | |
15 import dstep.coreservices.carboncore.MacTypes; | |
16 | |
17 struct AuthorizationOpaqueRef; | |
18 | |
19 alias uint AuthorizationFlags; | |
20 alias AuthorizationOpaqueRef* AuthorizationRef; | |
21 alias char* AuthorizationString; | |
22 alias AuthorizationItemSet AuthorizationRights; | |
23 alias AuthorizationItemSet AuthorizationEnvironment; | |
24 | |
25 enum | |
26 { | |
27 errAuthorizationSuccess = 0, | |
28 errAuthorizationInvalidSet = -60001, | |
29 errAuthorizationInvalidRef = -60002, | |
30 errAuthorizationInvalidTag = -60003, | |
31 errAuthorizationInvalidPointer = -60004, | |
32 errAuthorizationDenied = -60005, | |
33 errAuthorizationCanceled = -60006, | |
34 errAuthorizationInteractionNotAllowed = -60007, | |
35 errAuthorizationInternal = -60008, | |
36 errAuthorizationExternalizeNotAllowed = -60009, | |
37 errAuthorizationInternalizeNotAllowed = -60010, | |
38 errAuthorizationInvalidFlags = -60011, | |
39 errAuthorizationToolExecuteFailure = -60031, | |
40 errAuthorizationToolEnvironmentError = -60032, | |
41 errAuthorizationBadAddress = -60033 | |
42 } | |
43 | |
44 enum | |
45 { | |
46 kAuthorizationFlagDefaults = 0, | |
47 kAuthorizationFlagInteractionAllowed = (1 << 0), | |
48 kAuthorizationFlagExtendRights = (1 << 1), | |
49 kAuthorizationFlagPartialRights = (1 << 2), | |
50 kAuthorizationFlagDestroyRights = (1 << 3), | |
51 kAuthorizationFlagPreAuthorize = (1 << 4), | |
52 kAuthorizationFlagNoData = (1 << 20) | |
53 } | |
54 | |
55 enum | |
56 { | |
57 kAuthorizationFlagCanNotPreAuthorize = (1 << 0) | |
58 } | |
59 | |
60 enum | |
61 { | |
62 kAuthorizationExternalFormLength = 32 | |
63 } | |
64 | |
65 struct AuthorizationItem | |
66 { | |
67 char* name; | |
68 uint valueLength; | |
69 void* value; | |
70 uint flags; | |
71 } | |
72 | |
73 | |
74 struct AuthorizationItemSet | |
75 { | |
76 uint count; | |
77 AuthorizationItem* items; | |
78 } | |
79 | |
80 | |
81 struct AuthorizationExternalForm | |
82 { | |
83 char* bytes; | |
84 } | |
85 | |
86 extern (C) | |
87 { | |
88 int AuthorizationCreate (AuthorizationRights* rights, AuthorizationEnvironment* environment, uint flags, AuthorizationRef* authorization); | |
89 int AuthorizationFree (AuthorizationRef authorization, uint flags); | |
90 int AuthorizationCopyRights (AuthorizationRef authorization, AuthorizationRights* rights, AuthorizationEnvironment* environment, uint flags, AuthorizationRights** authorizedRights); | |
91 int AuthorizationCopyInfo (AuthorizationRef authorization, char* tag, AuthorizationItemSet** info); | |
92 int AuthorizationMakeExternalForm (AuthorizationRef authorization, AuthorizationExternalForm* extForm); | |
93 int AuthorizationCreateFromExternalForm (AuthorizationExternalForm* extForm, AuthorizationRef* authorization); | |
94 int AuthorizationFreeItemSet (AuthorizationItemSet* set); | |
95 int AuthorizationExecuteWithPrivileges (AuthorizationRef authorization, char* pathToTool, uint options, char** arguments, FILE** communicationsPipe); | |
96 int AuthorizationCopyPrivilegedReference (AuthorizationRef* authorization, uint flags); | |
97 } |