Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
5.0 KiB

  1. /*
  2. File: AEMach.h
  3. Contains: AppleEvent over mach_msg interfaces
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 2000-2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __AEMACH__
  11. #define __AEMACH__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __MIXEDMODE__
  16. #include <MixedMode.h>
  17. #endif
  18. #ifndef __AEDATAMODEL__
  19. #include <AEDataModel.h>
  20. #endif
  21. #if PRAGMA_ONCE
  22. #pragma once
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #if PRAGMA_IMPORT
  28. #pragma import on
  29. #endif
  30. /*-
  31. * AE Mach API --
  32. *
  33. * AppleEvents on OS X are implemented in terms of mach messages.
  34. * To facilitate writing server processes that can send and receive
  35. * AppleEvents, the following APIs are provided.
  36. *
  37. * AppleEvents are directed to a well known port uniquely tied to a
  38. * process. The AE framework will discover this port based on the
  39. * keyAddressAttr of the event (as specifed in AECreateAppleEvent by
  40. * the target parameter.) If a port cannot be found,
  41. * procNotFound (-600) will be returned on AESend.
  42. *
  43. * Of note is a new attribute for an AppleEvent, keyReplyPortAttr.
  44. * This specifies the mach_port_t to which an AppleEvent reply
  45. * should be directed. By default, replies are sent to the
  46. * processes registered port where they are culled from the normal
  47. * event stream if there is an outstanding AESend + kAEWaitReply.
  48. * But it may be desirable for a client to specify their own port to
  49. * receive quued replies.
  50. * (In the case of AESendMessage with kAEWaitReply specified, an
  51. * anonymous port will be used to block until the reply is received.)
  52. *
  53. * Not supplied is a convenience routine to block a server and
  54. * process AppleEvents. This implementation will be detailed in a
  55. * tech note.
  56. **/
  57. enum {
  58. keyReplyPortAttr = FOUR_CHAR_CODE('repp')
  59. };
  60. /* typeReplyPortAttr was misnamed and is deprecated; use keyReplyPortAttr instead. */
  61. enum {
  62. typeReplyPortAttr = keyReplyPortAttr
  63. };
  64. /*-
  65. * Return the mach_port_t that was registered with the bootstrap
  66. * server for this process. This port is considered public, and
  67. * will be used by other applications to target your process. You
  68. * are free to use this mach_port_t to add to a port set, if and
  69. * only if, you are not also using routines from HIToolbox. In that
  70. * case, HIToolbox retains control of this port and AppleEvents are
  71. * dispatched through the main event loop.
  72. **/
  73. /*
  74. * AEGetRegisteredMachPort()
  75. *
  76. * Availability:
  77. * Non-Carbon CFM: not available
  78. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  79. * Mac OS X: in version 10.0 and later
  80. */
  81. EXTERN_API_C( mach_port_t )
  82. AEGetRegisteredMachPort(void);
  83. /*-
  84. * Decode a mach_msg into an AppleEvent and its related reply. (The
  85. * reply is set up from fields of the event.) You can call this
  86. * routine if you wish to dispatch or handle the event yourself. To
  87. * return a reply to the sender, you should call:
  88. *
  89. * AESendMessage(reply, NULL, kAENoReply, kAENormalPriority, kAEDefaultTimeout);
  90. *
  91. * The contents of the header are invalid after this call.
  92. **/
  93. /*
  94. * AEDecodeMessage()
  95. *
  96. * Availability:
  97. * Non-Carbon CFM: not available
  98. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  99. * Mac OS X: in version 10.0 and later
  100. */
  101. EXTERN_API_C( OSStatus )
  102. AEDecodeMessage(
  103. mach_msg_header_t * header,
  104. AppleEvent * event,
  105. AppleEvent * reply); /* can be NULL */
  106. /*-
  107. * Decodes and dispatches an event to an event handler. Handles
  108. * packaging and returning the reply to the sender.
  109. *
  110. * The contents of the header are invalid after this call.
  111. **/
  112. /*
  113. * AEProcessMessage()
  114. *
  115. * Availability:
  116. * Non-Carbon CFM: not available
  117. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  118. * Mac OS X: in version 10.0 and later
  119. */
  120. EXTERN_API_C( OSStatus )
  121. AEProcessMessage(mach_msg_header_t * header);
  122. /*-
  123. * Send an AppleEvent to a target process. If the target is the
  124. * current process (as specified by using typeProcessSerialNumber of
  125. * { 0, kCurrentProcess } it is dispatched directly to the
  126. * appropriate event handler in your process and not serialized.
  127. **/
  128. /*
  129. * AESendMessage()
  130. *
  131. * Availability:
  132. * Non-Carbon CFM: not available
  133. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  134. * Mac OS X: in version 10.0 and later
  135. */
  136. EXTERN_API_C( OSStatus )
  137. AESendMessage(
  138. const AppleEvent * event,
  139. AppleEvent * reply, /* can be NULL */
  140. AESendMode sendMode,
  141. long timeOutInTicks);
  142. #ifdef PRAGMA_IMPORT_OFF
  143. #pragma import off
  144. #elif PRAGMA_IMPORT
  145. #pragma import reset
  146. #endif
  147. #ifdef __cplusplus
  148. }
  149. #endif
  150. #endif /* __AEMACH__ */