this repo has no description
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
32static __inline__ CFTypeRef
33isA_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
44static __inline__ CFTypeRef
45isA_CFArray(CFTypeRef obj)
46{
47 return (isA_CFType(obj, CFArrayGetTypeID()));
48}
49
50static __inline__ CFTypeRef
51isA_CFBoolean(CFTypeRef obj)
52{
53 return (isA_CFType(obj, CFBooleanGetTypeID()));
54}
55
56static __inline__ CFTypeRef
57isA_CFData(CFTypeRef obj)
58{
59 return (isA_CFType(obj, CFDataGetTypeID()));
60}
61
62static __inline__ CFTypeRef
63isA_CFDate(CFTypeRef obj)
64{
65 return (isA_CFType(obj, CFDateGetTypeID()));
66}
67
68static __inline__ CFTypeRef
69isA_CFDictionary(CFTypeRef obj)
70{
71 return (isA_CFType(obj, CFDictionaryGetTypeID()));
72}
73
74static __inline__ CFTypeRef
75isA_CFNumber(CFTypeRef obj)
76{
77 return (isA_CFType(obj, CFNumberGetTypeID()));
78}
79
80static __inline__ CFTypeRef
81isA_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
102static __inline__ CFTypeRef
103isA_CFString(CFTypeRef obj)
104{
105 return (isA_CFType(obj, CFStringGetTypeID()));
106}
107
108
109Boolean
110_SC_stringIsValidDNSName (const char *name);
111
112
113Boolean
114_SC_CFStringIsValidDNSName (CFStringRef name);
115
116
117Boolean
118_SC_CFStringIsValidNetBIOSName (CFStringRef name);
119
120
121__END_DECLS
122
123#endif /* _SCVALIDATION_H */
124