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