]> git.saurik.com Git - apple/securityd.git/blob - src/flippers.h
140c6cf8ea62dca29595eaccd54cd3eed9770e65
[apple/securityd.git] / src / flippers.h
1 /*
2 * Copyright (c) 2003-2004 Apple Computer, Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25
26
27 //
28 // process - track a single client process and its belongings
29 //
30 #ifndef _H_FLIPPERS
31 #define _H_FLIPPERS
32
33 #include <security_utilities/endian.h>
34 #include <security_utilities/debugging.h>
35
36 // various types we make flippers for
37 #include <Security/Authorization.h>
38 #include <security_cdsa_utilities/cssmlist.h>
39 #include <security_cdsa_utilities/cssmcred.h>
40 #include <security_cdsa_utilities/cssmacl.h>
41 #include <security_cdsa_utilities/cssmaclpod.h>
42 #include <security_cdsa_utilities/context.h>
43 #include <security_cdsa_utilities/cssmdb.h>
44
45
46 namespace Flippers {
47
48
49 //
50 // The default flipper does nothing
51 //
52 template <class T>
53 inline void flip(T &obj)
54 { }
55
56
57 //
58 // It's a bad idea to try to flip a const, so flag that
59 //
60 template <class T>
61 inline void flip(const T &)
62 { tryingToFlipAConstWontWork(); }
63
64
65 //
66 // Basic flippers
67 //
68 void flip(uint32 &obj);
69 void flip(uint16 &obj);
70 void flip(sint32 &obj);
71 void flip(sint16 &obj);
72
73 template <class Base>
74 inline void flip(Base * &obj) { flip(&obj, sizeof(obj)); }
75
76
77 //
78 // The raw byte reversal flipper
79 //
80 void flip(void *addr, size_t size);
81
82
83 //
84 // Include automatically generated flipper declarations
85 //
86 #include "flip_gen.h"
87
88
89 } // end namespace flippers
90
91
92 #endif //_H_FLIPPERS