/ OSX / libsecurityd / lib / handletypes.h
handletypes.h
 1  /*
 2   * Copyright (c) 2008,2011 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  
25  /*
26   * handletypes.h 
27   */
28  #ifndef _H_SS_HANDLE_TYPES
29  #define _H_SS_HANDLE_TYPES
30  
31  #include <Security/cssmtype.h>
32  #include <stdint.h>
33  
34  #ifdef __cplusplus
35  
36  namespace Security {
37  namespace SecurityServer {
38  
39  #endif /* __cplusplus */
40  
41  
42  /* XXX/gh  Might have to be guarded thusly to protect ss_types.h */
43  /* #ifndef _H_SS_TYPES */
44  
45  /*
46   * These are all uint32_ts behind the curtain, but we try to be
47   * explicit about which kind they are.
48   * By protocol, each of these is in a different address space - i.e.
49   * a KeyHandle and a DbHandle with the same value may or may not refer
50   * to the same thing - it's up to the handle provider.
51   * GenericHandle is for cases where a generic handle is further elaborated
52   * with a "kind code" - currently for ACL manipulations only.
53   */
54  typedef uint32_t DbHandle;			/* database handle               */
55  typedef uint32_t KeyHandle;			/* cryptographic key handle      */
56  typedef uint32_t RecordHandle;		/* data record identifier handle */
57  typedef uint32_t SearchHandle;		/* search (query) handle         */
58  typedef uint32_t GenericHandle;		/* for polymorphic handle uses   */
59  
60  static const DbHandle noDb = 0;
61  static const KeyHandle noKey = 0;
62  static const RecordHandle noRecord = 0;
63  static const SearchHandle noSearch = 0;
64  
65  /* #endif */  /* _H_SS_TYPES */
66  
67  /*
68   * Required for MIG-generated code; made sense when the above handle types
69   * were all CSSM_HANDLEs
70   */
71  typedef uint32_t IPCHandle;
72  typedef IPCHandle IPCDbHandle;
73  typedef IPCHandle IPCKeyHandle;
74  typedef IPCHandle IPCRecordHandle;
75  typedef IPCHandle IPCSearchHandle;
76  typedef IPCHandle IPCGenericHandle;
77  
78  #ifdef __cplusplus
79  
80  } // end namespace SecurityServer
81  } // end namespace Security
82  
83  #endif /* __cplusplus */
84  
85  
86  #endif /* _H_SS_HANDLE_TYPES */