]>
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 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
26 #ifndef _SCVALIDATION_H
27 #define _SCVALIDATION_H
29 #include <sys/cdefs.h>
30 #include <CoreFoundation/CoreFoundation.h>
34 static __inline__ CFTypeRef
35 isA_CFType(CFTypeRef obj
, CFTypeID type
)
40 if (CFGetTypeID(obj
) != type
)
46 static __inline__ CFTypeRef
47 isA_CFArray(CFTypeRef obj
)
49 return (isA_CFType(obj
, CFArrayGetTypeID()));
52 static __inline__ CFTypeRef
53 isA_CFBoolean(CFTypeRef obj
)
55 return (isA_CFType(obj
, CFBooleanGetTypeID()));
58 static __inline__ CFTypeRef
59 isA_CFData(CFTypeRef obj
)
61 return (isA_CFType(obj
, CFDataGetTypeID()));
64 static __inline__ CFTypeRef
65 isA_CFDate(CFTypeRef obj
)
67 return (isA_CFType(obj
, CFDateGetTypeID()));
70 static __inline__ CFTypeRef
71 isA_CFDictionary(CFTypeRef obj
)
73 return (isA_CFType(obj
, CFDictionaryGetTypeID()));
76 static __inline__ CFTypeRef
77 isA_CFNumber(CFTypeRef obj
)
79 return (isA_CFType(obj
, CFNumberGetTypeID()));
82 static __inline__ CFTypeRef
83 isA_CFPropertyList(CFTypeRef obj
)
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())
104 static __inline__ CFTypeRef
105 isA_CFString(CFTypeRef obj
)
107 return (isA_CFType(obj
, CFStringGetTypeID()));
112 _SC_stringIsValidDNSName (const char *name
);
116 _SC_CFStringIsValidDNSName (CFStringRef name
);
121 #endif /* _SCVALIDATION_H */