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