]> git.saurik.com Git - apple/configd.git/blob - Plugins/IPMonitor/serviceIDNumber.h
configd-1061.0.2.tar.gz
[apple/configd.git] / Plugins / IPMonitor / serviceIDNumber.h
1 /*
2 * Copyright (c) 2019 Apple 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 /*
25 * serviceID_number.h
26 * - assigns numbers to serviceID strings
27 */
28
29 #ifndef _SERVICEID_NUMBER_H
30 #define _SERVICEID_NUMBER_H
31
32 #include <CoreFoundation/CFString.h>
33 #include <sys/types.h>
34
35 /*
36 * Type: serviceIDNumber
37 * Purpose:
38 * A compact way to represent a serviceID that doesn't involve needing
39 * to worry about memory allocation or large comparisions.
40 */
41 typedef u_long serviceIDNumber, *serviceIDNumberRef;
42
43 /*
44 * Const: kserviceIDNumberZero
45 *
46 * Purpose:
47 * The zero value for serviceIDNumber. It will never be returned,
48 * it is a reserved value.
49 */
50 #define kserviceIDNumberZero (serviceIDNumber)(0)
51
52 /*
53 * Function: serviceIDNumberGetIfPresent
54 *
55 * Purpose:
56 * Returns TRUE and the serviceIDNumber for the given serviceID, if it
57 * is present, FALSE otherwise.
58 */
59 Boolean
60 serviceIDNumberGetIfPresent(CFStringRef serviceID, serviceIDNumberRef sidn);
61
62 /*
63 * Function: serviceIDNumberGet
64 *
65 * Purpose:
66 * Returns a unique serviceIDNumber for the given serviceID.
67 */
68 serviceIDNumber
69 serviceIDNumberGet(CFStringRef serviceID);
70
71 /*
72 * Function: serviceIDNumberRemove
73 *
74 * Purpose:
75 * Removes the assigned serviceIDNumber for the given serviceID.
76 */
77 void
78 serviceIDNumberRemove(CFStringRef serviceID);
79
80
81 /*
82 * Function: serviceIDNumberInit
83 *
84 * Purpose:
85 * Initialize the serviceID number database.
86 */
87 void
88 serviceIDNumberInit(void);
89
90 #endif /* _SERVICEID_NUMBER_H */