]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCValidation.h
configd-53.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 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 #ifndef _SCVALIDATION_H
24 #define _SCVALIDATION_H
25
26 #include <sys/cdefs.h>
27 #include <CoreFoundation/CoreFoundation.h>
28
29 __BEGIN_DECLS
30
31 static __inline__ CFTypeRef
32 isA_CFType(CFTypeRef obj, CFTypeID type)
33 {
34 if (obj == NULL)
35 return (NULL);
36
37 if (CFGetTypeID(obj) != type)
38 return (NULL);
39
40 return (obj);
41 }
42
43 static __inline__ CFTypeRef
44 isA_CFArray(CFTypeRef obj)
45 {
46 return (isA_CFType(obj, CFArrayGetTypeID()));
47 }
48
49 static __inline__ CFTypeRef
50 isA_CFBoolean(CFTypeRef obj)
51 {
52 return (isA_CFType(obj, CFBooleanGetTypeID()));
53 }
54
55 static __inline__ CFTypeRef
56 isA_CFData(CFTypeRef obj)
57 {
58 return (isA_CFType(obj, CFDataGetTypeID()));
59 }
60
61 static __inline__ CFTypeRef
62 isA_CFDate(CFTypeRef obj)
63 {
64 return (isA_CFType(obj, CFDateGetTypeID()));
65 }
66
67 static __inline__ CFTypeRef
68 isA_CFDictionary(CFTypeRef obj)
69 {
70 return (isA_CFType(obj, CFDictionaryGetTypeID()));
71 }
72
73 static __inline__ CFTypeRef
74 isA_CFNumber(CFTypeRef obj)
75 {
76 return (isA_CFType(obj, CFNumberGetTypeID()));
77 }
78
79 static __inline__ CFTypeRef
80 isA_CFPropertyList(CFTypeRef obj)
81 {
82 CFTypeID type;
83
84 if (obj == NULL)
85 return (NULL);
86
87 type = CFGetTypeID(obj);
88 if (type == CFArrayGetTypeID() ||
89 type == CFBooleanGetTypeID() ||
90 type == CFDataGetTypeID() ||
91 type == CFDateGetTypeID() ||
92 type == CFDictionaryGetTypeID() ||
93 type == CFNumberGetTypeID() ||
94 type == CFStringGetTypeID())
95 return (obj);
96
97 return (NULL);
98 }
99
100
101 static __inline__ CFTypeRef
102 isA_CFString(CFTypeRef obj)
103 {
104 return (isA_CFType(obj, CFStringGetTypeID()));
105 }
106
107
108 Boolean
109 _SC_stringIsValidDNSName (const char *name);
110
111
112 Boolean
113 _SC_CFStringIsValidDNSName (CFStringRef name);
114
115
116 __END_DECLS
117
118 #endif /* _SCVALIDATION_H */
119