]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCDPlugin.h
configd-53.1.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SCDPlugin.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 #ifndef _SCDPLUGIN_H
24 #define _SCDPLUGIN_H
25
26 #include <sys/cdefs.h>
27 #include <sys/types.h>
28 #include <sys/time.h>
29 #include <sys/resource.h>
30 #include <CoreFoundation/CoreFoundation.h>
31
32
33 /*!
34 @header SCDPlugin
35 */
36
37
38 /*
39 @define kSCBundleRequires
40 */
41 #define kSCBundleRequires CFSTR("Requires")
42
43
44 /*
45 @define kSCBundleVerbose
46 */
47 #define kSCBundleVerbose CFSTR("Verbose")
48
49
50 /*!
51 @typedef SCDynamicStoreBundleLoadFunction
52 @discussion Type of the load() initialization function that will be
53 called when a plug-in is loaded. This function is called
54 before calling the start() function and can be uesd to
55 initialize any variables, open any sessions with "configd",
56 and register any needed notifications.
57 @param bundle The CFBundle being loaded.
58 @param verbose A boolean value indicating whether verbose logging has
59 been enabled for this bundle.
60 */
61 typedef void (*SCDynamicStoreBundleLoadFunction) (CFBundleRef bundle,
62 Boolean bundleVerbose);
63
64 /*!
65 @typedef SCDynamicStoreBundleStartFunction
66 @discussion Type of the start() initialization function that will be
67 called after all plug-ins have been loaded and their load()
68 functions have been called. This function can initialize
69 variables, open sessions with "configd", and register any
70 needed notifications.
71 @param bundleName The name of the plug-in / bundle.
72 @param bundlePath The path name associated with the plug-in / bundle.
73 */
74 typedef void (*SCDynamicStoreBundleStartFunction) (const char *bundleName,
75 const char *bundlePath);
76
77 /*!
78 @typedef SCDynamicStoreBundlePrimeFunction
79 @discussion Type of the prime() initialization function that will be
80 called after all plug-ins have executed their start() function but
81 before the main plug-in run loop is started. This function should
82 be used to initialize any configuration information and/or state
83 in the store.
84 */
85 typedef void (*SCDynamicStoreBundlePrimeFunction) ();
86
87
88 /*!
89 @typedef SCDPluginExecCallBack
90 @discussion Type of the callback function used when a child process
91 started by a plug-in has exited.
92 @param pid The process id of the child which has exited.
93 @param status The exit status of the child which has exited.
94 @param rusage A summary of the resources used by the child process
95 and all its children.
96 @param context The callback argument specified on the call
97 to _SCDPluginExecCommand().
98 */
99 typedef void (*SCDPluginExecCallBack) (pid_t pid,
100 int status,
101 struct rusage *rusage,
102 void *context);
103
104
105 __BEGIN_DECLS
106
107 /*!
108 @function _SCDPluginExecCommand
109 @discussion Starts a child process.
110 @param callout The function to be called when the child
111 process exits. A NULL value can be specified if no
112 callouts are desired.
113 @param context A argument which will be passed
114 to the callout function.
115 @param uid The desired user id of the child process.
116 @param gid The desired group id of the child process.
117 @param path The command to be executed.
118 @param argv The arguments to be passed to the child process.
119 @result The process ID of the child.
120 */
121 pid_t
122 _SCDPluginExecCommand (
123 SCDPluginExecCallBack callout,
124 void *context,
125 uid_t uid,
126 gid_t gid,
127 const char *path,
128 char * const argv[]
129 );
130
131 __END_DECLS
132
133 #endif /* _SCDPLUGIN_H */