jailbreak_daemonServer.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. * IDENTIFICATION:
  3. * stub generated Tue Mar 6 23:07:11 2018
  4. * with a MiG generated by bootstrap_cmds-96.20.2
  5. * OPTIONS:
  6. */
  7. /* Module jailbreak_daemon */
  8. #define __MIG_check__Request__jailbreak_daemon_subsystem__ 1
  9. #include "jailbreak_daemonServer.h"
  10. #ifndef mig_internal
  11. #define mig_internal static __inline__
  12. #endif /* mig_internal */
  13. #ifndef mig_external
  14. #define mig_external
  15. #endif /* mig_external */
  16. #if !defined(__MigTypeCheck) && defined(TypeCheck)
  17. #define __MigTypeCheck TypeCheck /* Legacy setting */
  18. #endif /* !defined(__MigTypeCheck) */
  19. #if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
  20. #define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */
  21. #endif /* !defined(__MigKernelSpecificCode) */
  22. #ifndef LimitCheck
  23. #define LimitCheck 0
  24. #endif /* LimitCheck */
  25. #ifndef min
  26. #define min(a,b) ( ((a) < (b))? (a): (b) )
  27. #endif /* min */
  28. #if !defined(_WALIGN_)
  29. #define _WALIGN_(x) (((x) + 3) & ~3)
  30. #endif /* !defined(_WALIGN_) */
  31. #if !defined(_WALIGNSZ_)
  32. #define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
  33. #endif /* !defined(_WALIGNSZ_) */
  34. #ifndef UseStaticTemplates
  35. #define UseStaticTemplates 0
  36. #endif /* UseStaticTemplates */
  37. #ifndef __DeclareRcvRpc
  38. #define __DeclareRcvRpc(_NUM_, _NAME_)
  39. #endif /* __DeclareRcvRpc */
  40. #ifndef __BeforeRcvRpc
  41. #define __BeforeRcvRpc(_NUM_, _NAME_)
  42. #endif /* __BeforeRcvRpc */
  43. #ifndef __AfterRcvRpc
  44. #define __AfterRcvRpc(_NUM_, _NAME_)
  45. #endif /* __AfterRcvRpc */
  46. #ifndef __DeclareRcvSimple
  47. #define __DeclareRcvSimple(_NUM_, _NAME_)
  48. #endif /* __DeclareRcvSimple */
  49. #ifndef __BeforeRcvSimple
  50. #define __BeforeRcvSimple(_NUM_, _NAME_)
  51. #endif /* __BeforeRcvSimple */
  52. #ifndef __AfterRcvSimple
  53. #define __AfterRcvSimple(_NUM_, _NAME_)
  54. #endif /* __AfterRcvSimple */
  55. #define novalue void
  56. #define msgh_request_port msgh_local_port
  57. #define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits)
  58. #define msgh_reply_port msgh_remote_port
  59. #define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits)
  60. #define MIG_RETURN_ERROR(X, code) {\
  61. ((mig_reply_error_t *)X)->RetCode = code;\
  62. ((mig_reply_error_t *)X)->NDR = NDR_record;\
  63. return;\
  64. }
  65. /* Forward Declarations */
  66. mig_internal novalue _Xcall
  67. (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
  68. #if ( __MigTypeCheck )
  69. #if __MIG_check__Request__jailbreak_daemon_subsystem__
  70. #if !defined(__MIG_check__Request__call_t__defined)
  71. #define __MIG_check__Request__call_t__defined
  72. mig_internal kern_return_t __MIG_check__Request__call_t(__attribute__((__unused__)) __Request__call_t *In0P)
  73. {
  74. typedef __Request__call_t __Request;
  75. #if __MigTypeCheck
  76. if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
  77. (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
  78. return MIG_BAD_ARGUMENTS;
  79. #endif /* __MigTypeCheck */
  80. return MACH_MSG_SUCCESS;
  81. }
  82. #endif /* !defined(__MIG_check__Request__call_t__defined) */
  83. #endif /* __MIG_check__Request__jailbreak_daemon_subsystem__ */
  84. #endif /* ( __MigTypeCheck ) */
  85. /* Routine call */
  86. mig_internal novalue _Xcall
  87. (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
  88. {
  89. #ifdef __MigPackStructs
  90. #pragma pack(4)
  91. #endif
  92. typedef struct {
  93. mach_msg_header_t Head;
  94. NDR_record_t NDR;
  95. uint8_t command;
  96. char commandPad[3];
  97. uint32_t pid;
  98. mach_msg_trailer_t trailer;
  99. } Request __attribute__((unused));
  100. #ifdef __MigPackStructs
  101. #pragma pack()
  102. #endif
  103. typedef __Request__call_t __Request;
  104. typedef __Reply__call_t Reply __attribute__((unused));
  105. /*
  106. * typedef struct {
  107. * mach_msg_header_t Head;
  108. * NDR_record_t NDR;
  109. * kern_return_t RetCode;
  110. * } mig_reply_error_t;
  111. */
  112. Request *In0P = (Request *) InHeadP;
  113. Reply *OutP = (Reply *) OutHeadP;
  114. #ifdef __MIG_check__Request__call_t__defined
  115. kern_return_t check_result;
  116. #endif /* __MIG_check__Request__call_t__defined */
  117. __DeclareRcvRpc(500, "call")
  118. __BeforeRcvRpc(500, "call")
  119. #if defined(__MIG_check__Request__call_t__defined)
  120. check_result = __MIG_check__Request__call_t((__Request *)In0P);
  121. if (check_result != MACH_MSG_SUCCESS)
  122. { MIG_RETURN_ERROR(OutP, check_result); }
  123. #endif /* defined(__MIG_check__Request__call_t__defined) */
  124. OutP->RetCode = jbd_call(In0P->Head.msgh_request_port, In0P->command, In0P->pid);
  125. OutP->NDR = NDR_record;
  126. __AfterRcvRpc(500, "call")
  127. }
  128. /* Description of this subsystem, for use in direct RPC */
  129. const struct jbd_jailbreak_daemon_subsystem jbd_jailbreak_daemon_subsystem = {
  130. jailbreak_daemon_server_routine,
  131. 500,
  132. 501,
  133. (mach_msg_size_t)sizeof(union __ReplyUnion__jbd_jailbreak_daemon_subsystem),
  134. (vm_address_t)0,
  135. {
  136. { (mig_impl_routine_t) 0,
  137. (mig_stub_routine_t) _Xcall, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__call_t)},
  138. }
  139. };
  140. mig_external boolean_t jailbreak_daemon_server
  141. (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
  142. {
  143. /*
  144. * typedef struct {
  145. * mach_msg_header_t Head;
  146. * NDR_record_t NDR;
  147. * kern_return_t RetCode;
  148. * } mig_reply_error_t;
  149. */
  150. register mig_routine_t routine;
  151. OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
  152. OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
  153. /* Minimal size: routine() will update it if different */
  154. OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
  155. OutHeadP->msgh_local_port = MACH_PORT_NULL;
  156. OutHeadP->msgh_id = InHeadP->msgh_id + 100;
  157. OutHeadP->msgh_reserved = 0;
  158. if ((InHeadP->msgh_id > 500) || (InHeadP->msgh_id < 500) ||
  159. ((routine = jbd_jailbreak_daemon_subsystem.routine[InHeadP->msgh_id - 500].stub_routine) == 0)) {
  160. ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
  161. ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
  162. return FALSE;
  163. }
  164. (*routine) (InHeadP, OutHeadP);
  165. return TRUE;
  166. }
  167. mig_external mig_routine_t jailbreak_daemon_server_routine
  168. (mach_msg_header_t *InHeadP)
  169. {
  170. register int msgh_id;
  171. msgh_id = InHeadP->msgh_id - 500;
  172. if ((msgh_id > 0) || (msgh_id < 0))
  173. return 0;
  174. return jbd_jailbreak_daemon_subsystem.routine[msgh_id].stub_routine;
  175. }