]>
Commit | Line | Data |
---|---|---|
7d31e928 A |
1 | /* |
2 | * Copyright (c) 2006 Apple Computer, 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 | // | |
25 | // csgeneric - generic Code representative | |
26 | // | |
27 | #ifndef _H_CSGENERIC | |
28 | #define _H_CSGENERIC | |
29 | ||
30 | #include "Code.h" | |
31 | #include <Security/SecCodeHost.h> | |
32 | #include <security_utilities/utilities.h> | |
33 | #include <security_utilities/mach++.h> | |
34 | ||
35 | namespace Security { | |
36 | namespace CodeSigning { | |
37 | ||
38 | ||
39 | // | |
40 | // A SecCode that represents "generic" code. | |
41 | // Generic code is, well, generic. It doesn't have any real resources that define it, | |
42 | // and so it's defined, de facto, by its host. The Code Signing subsystem has no special | |
43 | // knowledge as to its nature, and so it just asks the host about everything. The asking | |
44 | // is done via the cshosting Mach RPC protocol, which can be implemented by hosts in whichever | |
45 | // way they find reasonable. This code doesn't care, as long as someone is answering. | |
46 | // | |
47 | // It is all right to subclass GenericCode to inherit access to the cshosting protocol. | |
48 | // | |
49 | class GenericCode : public SecCode { | |
50 | public: | |
51 | GenericCode(SecCode *host, SecGuestRef guestRef = kSecNoGuest); | |
52 | ||
53 | SecCode *locateGuest(CFDictionaryRef attributes); | |
d1c1ab47 A |
54 | SecStaticCode *identifyGuest(SecCode *guest, CFDataRef *cdhash); |
55 | SecCodeStatus getGuestStatus(SecCode *guest); | |
56 | void changeGuestStatus(SecCode *guest, SecCodeStatusOperation operation, CFDictionaryRef arguments); | |
7d31e928 A |
57 | |
58 | SecGuestRef guestRef() const { return mGuestRef; } | |
59 | ||
60 | protected: | |
61 | MachPlusPlus::Port hostingPort(); | |
7d31e928 | 62 | virtual mach_port_t getHostingPort(); |
d1c1ab47 A |
63 | |
64 | private: | |
65 | void identifyGuest(SecGuestRef guest, char *path, CFDataRef &cdhash, CFDictionaryRef &attributes); | |
7d31e928 A |
66 | |
67 | private: | |
68 | MachPlusPlus::Port mHostingPort; // cached hosting port for this Code | |
69 | SecGuestRef mGuestRef; // guest reference | |
70 | }; | |
71 | ||
72 | ||
73 | // | |
74 | // We don't need a GenericCode variant of SecStaticCode | |
75 | // | |
76 | typedef SecStaticCode GenericStaticCode; | |
77 | ||
78 | ||
79 | } // end namespace CodeSigning | |
80 | } // end namespace Security | |
81 | ||
82 | #endif // !_H_CSGENERIC |