]>
git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCValidation.h
2 * Copyright (c) 2001-2002 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 #ifndef _SCVALIDATION_H
24 #define _SCVALIDATION_H
26 #include <sys/cdefs.h>
27 #include <CoreFoundation/CoreFoundation.h>
31 static __inline__ CFTypeRef
32 isA_CFType(CFTypeRef obj
, CFTypeID type
)
37 if (CFGetTypeID(obj
) != type
)
43 static __inline__ CFTypeRef
44 isA_CFArray(CFTypeRef obj
)
46 return (isA_CFType(obj
, CFArrayGetTypeID()));
49 static __inline__ CFTypeRef
50 isA_CFBoolean(CFTypeRef obj
)
52 return (isA_CFType(obj
, CFBooleanGetTypeID()));
55 static __inline__ CFTypeRef
56 isA_CFData(CFTypeRef obj
)
58 return (isA_CFType(obj
, CFDataGetTypeID()));
61 static __inline__ CFTypeRef
62 isA_CFDate(CFTypeRef obj
)
64 return (isA_CFType(obj
, CFDateGetTypeID()));
67 static __inline__ CFTypeRef
68 isA_CFDictionary(CFTypeRef obj
)
70 return (isA_CFType(obj
, CFDictionaryGetTypeID()));
73 static __inline__ CFTypeRef
74 isA_CFNumber(CFTypeRef obj
)
76 return (isA_CFType(obj
, CFNumberGetTypeID()));
79 static __inline__ CFTypeRef
80 isA_CFPropertyList(CFTypeRef obj
)
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())
101 static __inline__ CFTypeRef
102 isA_CFString(CFTypeRef obj
)
104 return (isA_CFType(obj
, CFStringGetTypeID()));
109 _SC_stringIsValidDNSName (const char *name
);
113 _SC_CFStringIsValidDNSName (CFStringRef name
);
118 #endif /* _SCVALIDATION_H */