]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCValidation.h
configd-84.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SCValidation.h
1 /*
2 * Copyright (c) 2001-2002 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 #ifndef _SCVALIDATION_H
27 #define _SCVALIDATION_H
28
29 #include <sys/cdefs.h>
30 #include <CoreFoundation/CoreFoundation.h>
31
32 __BEGIN_DECLS
33
34 static __inline__ CFTypeRef
35 isA_CFType(CFTypeRef obj, CFTypeID type)
36 {
37 if (obj == NULL)
38 return (NULL);
39
40 if (CFGetTypeID(obj) != type)
41 return (NULL);
42
43 return (obj);
44 }
45
46 static __inline__ CFTypeRef
47 isA_CFArray(CFTypeRef obj)
48 {
49 return (isA_CFType(obj, CFArrayGetTypeID()));
50 }
51
52 static __inline__ CFTypeRef
53 isA_CFBoolean(CFTypeRef obj)
54 {
55 return (isA_CFType(obj, CFBooleanGetTypeID()));
56 }
57
58 static __inline__ CFTypeRef
59 isA_CFData(CFTypeRef obj)
60 {
61 return (isA_CFType(obj, CFDataGetTypeID()));
62 }
63
64 static __inline__ CFTypeRef
65 isA_CFDate(CFTypeRef obj)
66 {
67 return (isA_CFType(obj, CFDateGetTypeID()));
68 }
69
70 static __inline__ CFTypeRef
71 isA_CFDictionary(CFTypeRef obj)
72 {
73 return (isA_CFType(obj, CFDictionaryGetTypeID()));
74 }
75
76 static __inline__ CFTypeRef
77 isA_CFNumber(CFTypeRef obj)
78 {
79 return (isA_CFType(obj, CFNumberGetTypeID()));
80 }
81
82 static __inline__ CFTypeRef
83 isA_CFPropertyList(CFTypeRef obj)
84 {
85 CFTypeID type;
86
87 if (obj == NULL)
88 return (NULL);
89
90 type = CFGetTypeID(obj);
91 if (type == CFArrayGetTypeID() ||
92 type == CFBooleanGetTypeID() ||
93 type == CFDataGetTypeID() ||
94 type == CFDateGetTypeID() ||
95 type == CFDictionaryGetTypeID() ||
96 type == CFNumberGetTypeID() ||
97 type == CFStringGetTypeID())
98 return (obj);
99
100 return (NULL);
101 }
102
103
104 static __inline__ CFTypeRef
105 isA_CFString(CFTypeRef obj)
106 {
107 return (isA_CFType(obj, CFStringGetTypeID()));
108 }
109
110
111 Boolean
112 _SC_stringIsValidDNSName (const char *name);
113
114
115 Boolean
116 _SC_CFStringIsValidDNSName (CFStringRef name);
117
118
119 __END_DECLS
120
121 #endif /* _SCVALIDATION_H */
122