/core/externals/google-toolbox-for-mac/Foundation/GTMServiceManagement.h

http://macfuse.googlecode.com/ · C Header · 77 lines · 18 code · 16 blank · 43 comment · 0 complexity · 46bc0b69a8a506ab0e4ff5ff024fddfd MD5 · raw file

  1. //
  2. // GTMServiceManagement.h
  3. //
  4. // Copyright 2010 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations under
  16. // the License.
  17. //
  18. #include "GTMDefines.h"
  19. #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4
  20. #include <launch.h>
  21. #include <CoreFoundation/CoreFoundation.h>
  22. GTM_EXTERN_C_BEGIN
  23. // Done in C as opposed to Objective-C as lots of services may not want
  24. // to bring in Obj-C libraries.
  25. // For rough documentation on these methods please see
  26. // <ServiceManagement/ServiceManagement.h> from the 10.6 sdk.
  27. // This reimplements some of the ServiceManagement framework on 10.5.
  28. // Caller takes ownership of error if necessary.
  29. Boolean GTMSMJobSubmit(CFDictionaryRef job, CFErrorRef *error);
  30. Boolean GTMSMJobRemove(CFStringRef jobLabel, CFErrorRef *error);
  31. // Caller takes ownership of the returned type.
  32. // Note that the dictionary returned will have 0 for machports.
  33. // To get a machport, use bootstrap_look_up, or NSMachBootstrapServer.
  34. CFDictionaryRef GTMSMJobCopyDictionary(CFStringRef jobLabel);
  35. // This one is conspiciously absent from the ServiceManagement framework.
  36. // Performs a check-in for the running process and returns its dictionary with
  37. // the appropriate sockets and machports filled in.
  38. // Caller takes ownership of the returned type.
  39. CFDictionaryRef GTMSMCopyJobCheckInDictionary(CFErrorRef *error);
  40. // The official ServiceManagement version returns an array of job dictionaries.
  41. // This returns a dictionary of job dictionaries where the key is the label
  42. // of the job, and the value is the dictionary for the job of that label.
  43. // Caller takes ownership of the returned type.
  44. CFDictionaryRef GTMSMCopyAllJobDictionaries(void);
  45. // Convert a CFType (and any of it's subitems) into a launch_data_t.
  46. // Caller takes ownership of the returned type if it isn't added to a launch
  47. // data container type.
  48. launch_data_t GTMLaunchDataCreateFromCFType(CFTypeRef cf_type_ref,
  49. CFErrorRef *error);
  50. // Convert a launch_data_t (and any of it's subitems) into a CFType.
  51. // If |convert_non_standard_objects| is true, file descriptors and machports
  52. // will be included in the returned dictionary, otherwise they will be ignored.
  53. // Caller is takes ownership of the returned type.
  54. CFTypeRef GTMCFTypeCreateFromLaunchData(launch_data_t ldata,
  55. bool convert_non_standard_objects,
  56. CFErrorRef *error);
  57. // Returns the list of exports defined by launchd.
  58. // Caller is takes ownership of the returned type.
  59. CFDictionaryRef GTMCopyLaunchdExports();
  60. GTM_EXTERN_C_END
  61. #endif // if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4