2  * Copyright (c) 2006,2011,2014 Apple Inc. All Rights Reserved. 
   4  * @APPLE_LICENSE_HEADER_START@ 
   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 
  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. 
  21  * @APPLE_LICENSE_HEADER_END@ 
  25 // csgeneric - generic Code representative 
  31 #include <Security/SecCodeHost.h> 
  32 #include <security_utilities/utilities.h> 
  33 #include <security_utilities/mach++.h> 
  36 namespace CodeSigning 
{ 
  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. 
  47 // It is all right to subclass GenericCode to inherit access to the cshosting protocol. 
  49 class GenericCode 
: public SecCode 
{ 
  51         GenericCode(SecCode 
*host
, SecGuestRef guestRef 
= kSecNoGuest
); 
  53         SecCode 
*locateGuest(CFDictionaryRef attributes
); 
  54         SecStaticCode 
*identifyGuest(SecCode 
*guest
, CFDataRef 
*cdhash
); 
  55         SecCodeStatus 
getGuestStatus(SecCode 
*guest
); 
  56         void changeGuestStatus(SecCode 
*guest
, SecCodeStatusOperation operation
, CFDictionaryRef arguments
); 
  58         SecGuestRef 
guestRef() const { return mGuestRef
; } 
  61         MachPlusPlus::Port 
hostingPort(); 
  62         virtual mach_port_t 
getHostingPort(); 
  65         void identifyGuest(SecGuestRef guest
, char *path
, CFDataRef 
&cdhash
, CFDictionaryRef 
&attributes
); 
  68         MachPlusPlus::Port mHostingPort
;        // cached hosting port for this Code 
  69         SecGuestRef mGuestRef
;                          // guest reference 
  74 // We don't need a GenericCode variant of SecStaticCode 
  76 typedef SecStaticCode GenericStaticCode
; 
  79 } // end namespace CodeSigning 
  80 } // end namespace Security 
  82 #endif // !_H_CSGENERIC