| 1 | /* iig(DriverKit-286 Mar 29 2024 10:27:09) generated from IODataQueueDispatchSource.iig */ |
| 2 | |
| 3 | #undef IIG_IMPLEMENTATION |
| 4 | #define IIG_IMPLEMENTATION IODataQueueDispatchSource.iig |
| 5 | |
| 6 | #if KERNEL |
| 7 | #include <libkern/c++/OSString.h> |
| 8 | #else |
| 9 | #include <DriverKit/DriverKit.h> |
| 10 | #endif /* KERNEL */ |
| 11 | #include <DriverKit/IOReturn.h> |
| 12 | #include <DriverKit/IODataQueueDispatchSource.h> |
| 13 | |
| 14 | |
| 15 | #if __has_builtin(__builtin_load_member_function_pointer) |
| 16 | #define SimpleMemberFunctionCast(cfnty, self, func) (cfnty)__builtin_load_member_function_pointer(self, func) |
| 17 | #else |
| 18 | #define SimpleMemberFunctionCast(cfnty, self, func) ({ union { typeof(func) memfun; cfnty cfun; } pair; pair.memfun = func; pair.cfun; }) |
| 19 | #endif |
| 20 | |
| 21 | |
| 22 | struct IODataQueueDispatchSource_Create_Msg_Content |
| 23 | { |
| 24 | IORPCMessage __hdr; |
| 25 | OSObjectRef __object; |
| 26 | OSObjectRef queue; |
| 27 | uint64_t queueByteCount; |
| 28 | }; |
| 29 | #pragma pack(4) |
| 30 | struct IODataQueueDispatchSource_Create_Msg |
| 31 | { |
| 32 | IORPCMessageMach mach; |
| 33 | mach_msg_port_descriptor_t __object__descriptor; |
| 34 | mach_msg_port_descriptor_t queue__descriptor; |
| 35 | IODataQueueDispatchSource_Create_Msg_Content content; |
| 36 | }; |
| 37 | #pragma pack() |
| 38 | #define IODataQueueDispatchSource_Create_Msg_ObjRefs (2) |
| 39 | |
| 40 | struct IODataQueueDispatchSource_Create_Rpl_Content |
| 41 | { |
| 42 | IORPCMessage __hdr; |
| 43 | OSObjectRef source; |
| 44 | }; |
| 45 | #pragma pack(4) |
| 46 | struct IODataQueueDispatchSource_Create_Rpl |
| 47 | { |
| 48 | IORPCMessageMach mach; |
| 49 | mach_msg_port_descriptor_t source__descriptor; |
| 50 | IODataQueueDispatchSource_Create_Rpl_Content content; |
| 51 | }; |
| 52 | #pragma pack() |
| 53 | #define IODataQueueDispatchSource_Create_Rpl_ObjRefs (1) |
| 54 | |
| 55 | |
| 56 | typedef union |
| 57 | { |
| 58 | const IORPC rpc; |
| 59 | struct |
| 60 | { |
| 61 | const struct IODataQueueDispatchSource_Create_Msg * message; |
| 62 | struct IODataQueueDispatchSource_Create_Rpl * reply; |
| 63 | uint32_t sendSize; |
| 64 | uint32_t replySize; |
| 65 | }; |
| 66 | } |
| 67 | IODataQueueDispatchSource_Create_Invocation; |
| 68 | struct IODataQueueDispatchSource_SetDataAvailableHandler_Msg_Content |
| 69 | { |
| 70 | IORPCMessage __hdr; |
| 71 | OSObjectRef __object; |
| 72 | OSObjectRef action; |
| 73 | }; |
| 74 | #pragma pack(4) |
| 75 | struct IODataQueueDispatchSource_SetDataAvailableHandler_Msg |
| 76 | { |
| 77 | IORPCMessageMach mach; |
| 78 | mach_msg_port_descriptor_t __object__descriptor; |
| 79 | mach_msg_port_descriptor_t action__descriptor; |
| 80 | IODataQueueDispatchSource_SetDataAvailableHandler_Msg_Content content; |
| 81 | }; |
| 82 | #pragma pack() |
| 83 | #define IODataQueueDispatchSource_SetDataAvailableHandler_Msg_ObjRefs (2) |
| 84 | |
| 85 | struct IODataQueueDispatchSource_SetDataAvailableHandler_Rpl_Content |
| 86 | { |
| 87 | IORPCMessage __hdr; |
| 88 | }; |
| 89 | #pragma pack(4) |
| 90 | struct IODataQueueDispatchSource_SetDataAvailableHandler_Rpl |
| 91 | { |
| 92 | IORPCMessageMach mach; |
| 93 | IODataQueueDispatchSource_SetDataAvailableHandler_Rpl_Content content; |
| 94 | }; |
| 95 | #pragma pack() |
| 96 | #define IODataQueueDispatchSource_SetDataAvailableHandler_Rpl_ObjRefs (0) |
| 97 | |
| 98 | |
| 99 | typedef union |
| 100 | { |
| 101 | const IORPC rpc; |
| 102 | struct |
| 103 | { |
| 104 | const struct IODataQueueDispatchSource_SetDataAvailableHandler_Msg * message; |
| 105 | struct IODataQueueDispatchSource_SetDataAvailableHandler_Rpl * reply; |
| 106 | uint32_t sendSize; |
| 107 | uint32_t replySize; |
| 108 | }; |
| 109 | } |
| 110 | IODataQueueDispatchSource_SetDataAvailableHandler_Invocation; |
| 111 | struct IODataQueueDispatchSource_SetDataServicedHandler_Msg_Content |
| 112 | { |
| 113 | IORPCMessage __hdr; |
| 114 | OSObjectRef __object; |
| 115 | OSObjectRef action; |
| 116 | }; |
| 117 | #pragma pack(4) |
| 118 | struct IODataQueueDispatchSource_SetDataServicedHandler_Msg |
| 119 | { |
| 120 | IORPCMessageMach mach; |
| 121 | mach_msg_port_descriptor_t __object__descriptor; |
| 122 | mach_msg_port_descriptor_t action__descriptor; |
| 123 | IODataQueueDispatchSource_SetDataServicedHandler_Msg_Content content; |
| 124 | }; |
| 125 | #pragma pack() |
| 126 | #define IODataQueueDispatchSource_SetDataServicedHandler_Msg_ObjRefs (2) |
| 127 | |
| 128 | struct IODataQueueDispatchSource_SetDataServicedHandler_Rpl_Content |
| 129 | { |
| 130 | IORPCMessage __hdr; |
| 131 | }; |
| 132 | #pragma pack(4) |
| 133 | struct IODataQueueDispatchSource_SetDataServicedHandler_Rpl |
| 134 | { |
| 135 | IORPCMessageMach mach; |
| 136 | IODataQueueDispatchSource_SetDataServicedHandler_Rpl_Content content; |
| 137 | }; |
| 138 | #pragma pack() |
| 139 | #define IODataQueueDispatchSource_SetDataServicedHandler_Rpl_ObjRefs (0) |
| 140 | |
| 141 | |
| 142 | typedef union |
| 143 | { |
| 144 | const IORPC rpc; |
| 145 | struct |
| 146 | { |
| 147 | const struct IODataQueueDispatchSource_SetDataServicedHandler_Msg * message; |
| 148 | struct IODataQueueDispatchSource_SetDataServicedHandler_Rpl * reply; |
| 149 | uint32_t sendSize; |
| 150 | uint32_t replySize; |
| 151 | }; |
| 152 | } |
| 153 | IODataQueueDispatchSource_SetDataServicedHandler_Invocation; |
| 154 | struct IODataQueueDispatchSource_CopyMemory_Msg_Content |
| 155 | { |
| 156 | IORPCMessage __hdr; |
| 157 | OSObjectRef __object; |
| 158 | }; |
| 159 | #pragma pack(4) |
| 160 | struct IODataQueueDispatchSource_CopyMemory_Msg |
| 161 | { |
| 162 | IORPCMessageMach mach; |
| 163 | mach_msg_port_descriptor_t __object__descriptor; |
| 164 | IODataQueueDispatchSource_CopyMemory_Msg_Content content; |
| 165 | }; |
| 166 | #pragma pack() |
| 167 | #define IODataQueueDispatchSource_CopyMemory_Msg_ObjRefs (1) |
| 168 | |
| 169 | struct IODataQueueDispatchSource_CopyMemory_Rpl_Content |
| 170 | { |
| 171 | IORPCMessage __hdr; |
| 172 | OSObjectRef memory; |
| 173 | }; |
| 174 | #pragma pack(4) |
| 175 | struct IODataQueueDispatchSource_CopyMemory_Rpl |
| 176 | { |
| 177 | IORPCMessageMach mach; |
| 178 | mach_msg_port_descriptor_t memory__descriptor; |
| 179 | IODataQueueDispatchSource_CopyMemory_Rpl_Content content; |
| 180 | }; |
| 181 | #pragma pack() |
| 182 | #define IODataQueueDispatchSource_CopyMemory_Rpl_ObjRefs (1) |
| 183 | |
| 184 | |
| 185 | typedef union |
| 186 | { |
| 187 | const IORPC rpc; |
| 188 | struct |
| 189 | { |
| 190 | const struct IODataQueueDispatchSource_CopyMemory_Msg * message; |
| 191 | struct IODataQueueDispatchSource_CopyMemory_Rpl * reply; |
| 192 | uint32_t sendSize; |
| 193 | uint32_t replySize; |
| 194 | }; |
| 195 | } |
| 196 | IODataQueueDispatchSource_CopyMemory_Invocation; |
| 197 | struct IODataQueueDispatchSource_CopyDataAvailableHandler_Msg_Content |
| 198 | { |
| 199 | IORPCMessage __hdr; |
| 200 | OSObjectRef __object; |
| 201 | }; |
| 202 | #pragma pack(4) |
| 203 | struct IODataQueueDispatchSource_CopyDataAvailableHandler_Msg |
| 204 | { |
| 205 | IORPCMessageMach mach; |
| 206 | mach_msg_port_descriptor_t __object__descriptor; |
| 207 | IODataQueueDispatchSource_CopyDataAvailableHandler_Msg_Content content; |
| 208 | }; |
| 209 | #pragma pack() |
| 210 | #define IODataQueueDispatchSource_CopyDataAvailableHandler_Msg_ObjRefs (1) |
| 211 | |
| 212 | struct IODataQueueDispatchSource_CopyDataAvailableHandler_Rpl_Content |
| 213 | { |
| 214 | IORPCMessage __hdr; |
| 215 | OSObjectRef action; |
| 216 | }; |
| 217 | #pragma pack(4) |
| 218 | struct IODataQueueDispatchSource_CopyDataAvailableHandler_Rpl |
| 219 | { |
| 220 | IORPCMessageMach mach; |
| 221 | mach_msg_port_descriptor_t action__descriptor; |
| 222 | IODataQueueDispatchSource_CopyDataAvailableHandler_Rpl_Content content; |
| 223 | }; |
| 224 | #pragma pack() |
| 225 | #define IODataQueueDispatchSource_CopyDataAvailableHandler_Rpl_ObjRefs (1) |
| 226 | |
| 227 | |
| 228 | typedef union |
| 229 | { |
| 230 | const IORPC rpc; |
| 231 | struct |
| 232 | { |
| 233 | const struct IODataQueueDispatchSource_CopyDataAvailableHandler_Msg * message; |
| 234 | struct IODataQueueDispatchSource_CopyDataAvailableHandler_Rpl * reply; |
| 235 | uint32_t sendSize; |
| 236 | uint32_t replySize; |
| 237 | }; |
| 238 | } |
| 239 | IODataQueueDispatchSource_CopyDataAvailableHandler_Invocation; |
| 240 | struct IODataQueueDispatchSource_CopyDataServicedHandler_Msg_Content |
| 241 | { |
| 242 | IORPCMessage __hdr; |
| 243 | OSObjectRef __object; |
| 244 | }; |
| 245 | #pragma pack(4) |
| 246 | struct IODataQueueDispatchSource_CopyDataServicedHandler_Msg |
| 247 | { |
| 248 | IORPCMessageMach mach; |
| 249 | mach_msg_port_descriptor_t __object__descriptor; |
| 250 | IODataQueueDispatchSource_CopyDataServicedHandler_Msg_Content content; |
| 251 | }; |
| 252 | #pragma pack() |
| 253 | #define IODataQueueDispatchSource_CopyDataServicedHandler_Msg_ObjRefs (1) |
| 254 | |
| 255 | struct IODataQueueDispatchSource_CopyDataServicedHandler_Rpl_Content |
| 256 | { |
| 257 | IORPCMessage __hdr; |
| 258 | OSObjectRef action; |
| 259 | }; |
| 260 | #pragma pack(4) |
| 261 | struct IODataQueueDispatchSource_CopyDataServicedHandler_Rpl |
| 262 | { |
| 263 | IORPCMessageMach mach; |
| 264 | mach_msg_port_descriptor_t action__descriptor; |
| 265 | IODataQueueDispatchSource_CopyDataServicedHandler_Rpl_Content content; |
| 266 | }; |
| 267 | #pragma pack() |
| 268 | #define IODataQueueDispatchSource_CopyDataServicedHandler_Rpl_ObjRefs (1) |
| 269 | |
| 270 | |
| 271 | typedef union |
| 272 | { |
| 273 | const IORPC rpc; |
| 274 | struct |
| 275 | { |
| 276 | const struct IODataQueueDispatchSource_CopyDataServicedHandler_Msg * message; |
| 277 | struct IODataQueueDispatchSource_CopyDataServicedHandler_Rpl * reply; |
| 278 | uint32_t sendSize; |
| 279 | uint32_t replySize; |
| 280 | }; |
| 281 | } |
| 282 | IODataQueueDispatchSource_CopyDataServicedHandler_Invocation; |
| 283 | struct IODataQueueDispatchSource_DataAvailable_Msg_Content |
| 284 | { |
| 285 | IORPCMessage __hdr; |
| 286 | OSObjectRef __object; |
| 287 | OSObjectRef action; |
| 288 | }; |
| 289 | #pragma pack(4) |
| 290 | struct IODataQueueDispatchSource_DataAvailable_Msg |
| 291 | { |
| 292 | IORPCMessageMach mach; |
| 293 | mach_msg_port_descriptor_t __object__descriptor; |
| 294 | mach_msg_port_descriptor_t action__descriptor; |
| 295 | IODataQueueDispatchSource_DataAvailable_Msg_Content content; |
| 296 | }; |
| 297 | #pragma pack() |
| 298 | #define IODataQueueDispatchSource_DataAvailable_Msg_ObjRefs (2) |
| 299 | |
| 300 | struct IODataQueueDispatchSource_DataAvailable_Rpl_Content |
| 301 | { |
| 302 | IORPCMessage __hdr; |
| 303 | }; |
| 304 | #pragma pack(4) |
| 305 | struct IODataQueueDispatchSource_DataAvailable_Rpl |
| 306 | { |
| 307 | IORPCMessageMach mach; |
| 308 | IODataQueueDispatchSource_DataAvailable_Rpl_Content content; |
| 309 | }; |
| 310 | #pragma pack() |
| 311 | #define IODataQueueDispatchSource_DataAvailable_Rpl_ObjRefs (0) |
| 312 | |
| 313 | |
| 314 | typedef union |
| 315 | { |
| 316 | const IORPC rpc; |
| 317 | struct |
| 318 | { |
| 319 | const struct IODataQueueDispatchSource_DataAvailable_Msg * message; |
| 320 | struct IODataQueueDispatchSource_DataAvailable_Rpl * reply; |
| 321 | uint32_t sendSize; |
| 322 | uint32_t replySize; |
| 323 | }; |
| 324 | } |
| 325 | IODataQueueDispatchSource_DataAvailable_Invocation; |
| 326 | struct IODataQueueDispatchSource_DataServiced_Msg_Content |
| 327 | { |
| 328 | IORPCMessage __hdr; |
| 329 | OSObjectRef __object; |
| 330 | OSObjectRef action; |
| 331 | }; |
| 332 | #pragma pack(4) |
| 333 | struct IODataQueueDispatchSource_DataServiced_Msg |
| 334 | { |
| 335 | IORPCMessageMach mach; |
| 336 | mach_msg_port_descriptor_t __object__descriptor; |
| 337 | mach_msg_port_descriptor_t action__descriptor; |
| 338 | IODataQueueDispatchSource_DataServiced_Msg_Content content; |
| 339 | }; |
| 340 | #pragma pack() |
| 341 | #define IODataQueueDispatchSource_DataServiced_Msg_ObjRefs (2) |
| 342 | |
| 343 | struct IODataQueueDispatchSource_DataServiced_Rpl_Content |
| 344 | { |
| 345 | IORPCMessage __hdr; |
| 346 | }; |
| 347 | #pragma pack(4) |
| 348 | struct IODataQueueDispatchSource_DataServiced_Rpl |
| 349 | { |
| 350 | IORPCMessageMach mach; |
| 351 | IODataQueueDispatchSource_DataServiced_Rpl_Content content; |
| 352 | }; |
| 353 | #pragma pack() |
| 354 | #define IODataQueueDispatchSource_DataServiced_Rpl_ObjRefs (0) |
| 355 | |
| 356 | |
| 357 | typedef union |
| 358 | { |
| 359 | const IORPC rpc; |
| 360 | struct |
| 361 | { |
| 362 | const struct IODataQueueDispatchSource_DataServiced_Msg * message; |
| 363 | struct IODataQueueDispatchSource_DataServiced_Rpl * reply; |
| 364 | uint32_t sendSize; |
| 365 | uint32_t replySize; |
| 366 | }; |
| 367 | } |
| 368 | IODataQueueDispatchSource_DataServiced_Invocation; |
| 369 | #if !KERNEL |
| 370 | extern OSMetaClass * gOSContainerMetaClass; |
| 371 | extern OSMetaClass * gOSDataMetaClass; |
| 372 | extern OSMetaClass * gOSNumberMetaClass; |
| 373 | extern OSMetaClass * gOSBooleanMetaClass; |
| 374 | extern OSMetaClass * gOSDictionaryMetaClass; |
| 375 | extern OSMetaClass * gOSArrayMetaClass; |
| 376 | extern OSMetaClass * gOSSetMetaClass; |
| 377 | extern OSMetaClass * gOSOrderedSetMetaClass; |
| 378 | extern OSMetaClass * gOSStringMetaClass; |
| 379 | extern OSMetaClass * gIOServiceMetaClass; |
| 380 | extern OSMetaClass * gIOMemoryMapMetaClass; |
| 381 | #endif /* !KERNEL */ |
| 382 | |
| 383 | #if KERNEL |
| 384 | OSDefineMetaClassAndStructors(IODataQueueDispatchSource, IODispatchSource); |
| 385 | #endif /* KERNEL */ |
| 386 | |
| 387 | #if !KERNEL |
| 388 | |
| 389 | #define IODataQueueDispatchSource_QueueNames "" |
| 390 | |
| 391 | #define IODataQueueDispatchSource_MethodNames "" |
| 392 | |
| 393 | #define IODataQueueDispatchSourceMetaClass_MethodNames "" |
| 394 | |
| 395 | struct OSClassDescription_IODataQueueDispatchSource_t |
| 396 | { |
| 397 | OSClassDescription base; |
| 398 | uint64_t methodOptions[2 * 0]; |
| 399 | uint64_t metaMethodOptions[2 * 0]; |
| 400 | char queueNames[sizeof(IODataQueueDispatchSource_QueueNames)]; |
| 401 | char methodNames[sizeof(IODataQueueDispatchSource_MethodNames)]; |
| 402 | char metaMethodNames[sizeof(IODataQueueDispatchSourceMetaClass_MethodNames)]; |
| 403 | }; |
| 404 | |
| 405 | const struct OSClassDescription_IODataQueueDispatchSource_t |
| 406 | OSClassDescription_IODataQueueDispatchSource = |
| 407 | { |
| 408 | .base = |
| 409 | { |
| 410 | .descriptionSize = sizeof(OSClassDescription_IODataQueueDispatchSource_t), |
| 411 | .name = "IODataQueueDispatchSource" , |
| 412 | .superName = "IODispatchSource" , |
| 413 | .methodOptionsSize = 2 * sizeof(uint64_t) * 0, |
| 414 | .methodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IODataQueueDispatchSource_t, methodOptions), |
| 415 | .metaMethodOptionsSize = 2 * sizeof(uint64_t) * 0, |
| 416 | .metaMethodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IODataQueueDispatchSource_t, metaMethodOptions), |
| 417 | .queueNamesSize = sizeof(IODataQueueDispatchSource_QueueNames), |
| 418 | .queueNamesOffset = __builtin_offsetof(struct OSClassDescription_IODataQueueDispatchSource_t, queueNames), |
| 419 | .methodNamesSize = sizeof(IODataQueueDispatchSource_MethodNames), |
| 420 | .methodNamesOffset = __builtin_offsetof(struct OSClassDescription_IODataQueueDispatchSource_t, methodNames), |
| 421 | .metaMethodNamesSize = sizeof(IODataQueueDispatchSourceMetaClass_MethodNames), |
| 422 | .metaMethodNamesOffset = __builtin_offsetof(struct OSClassDescription_IODataQueueDispatchSource_t, metaMethodNames), |
| 423 | .flags = 1*kOSClassCanRemote, |
| 424 | }, |
| 425 | .methodOptions = |
| 426 | { |
| 427 | }, |
| 428 | .metaMethodOptions = |
| 429 | { |
| 430 | }, |
| 431 | .queueNames = IODataQueueDispatchSource_QueueNames, |
| 432 | .methodNames = IODataQueueDispatchSource_MethodNames, |
| 433 | .metaMethodNames = IODataQueueDispatchSourceMetaClass_MethodNames, |
| 434 | }; |
| 435 | |
| 436 | OSMetaClass * gIODataQueueDispatchSourceMetaClass; |
| 437 | |
| 438 | static kern_return_t |
| 439 | IODataQueueDispatchSource_New(OSMetaClass * instance); |
| 440 | |
| 441 | const OSClassLoadInformation |
| 442 | IODataQueueDispatchSource_Class = |
| 443 | { |
| 444 | .description = &OSClassDescription_IODataQueueDispatchSource.base, |
| 445 | .metaPointer = &gIODataQueueDispatchSourceMetaClass, |
| 446 | .version = 1, |
| 447 | .instanceSize = sizeof(IODataQueueDispatchSource), |
| 448 | |
| 449 | .New = &IODataQueueDispatchSource_New, |
| 450 | }; |
| 451 | |
| 452 | extern const void * const |
| 453 | gIODataQueueDispatchSource_Declaration; |
| 454 | const void * const |
| 455 | gIODataQueueDispatchSource_Declaration |
| 456 | __attribute__((visibility("hidden" ),section("__DATA_CONST,__osclassinfo,regular,no_dead_strip" ),no_sanitize("address" ))) |
| 457 | = &IODataQueueDispatchSource_Class; |
| 458 | |
| 459 | static kern_return_t |
| 460 | IODataQueueDispatchSource_New(OSMetaClass * instance) |
| 461 | { |
| 462 | if (!new(instance) IODataQueueDispatchSourceMetaClass) return (kIOReturnNoMemory); |
| 463 | return (kIOReturnSuccess); |
| 464 | } |
| 465 | |
| 466 | kern_return_t |
| 467 | IODataQueueDispatchSourceMetaClass::New(OSObject * instance) |
| 468 | { |
| 469 | if (!new(instance) IODataQueueDispatchSource) return (kIOReturnNoMemory); |
| 470 | return (kIOReturnSuccess); |
| 471 | } |
| 472 | |
| 473 | #endif /* !KERNEL */ |
| 474 | |
| 475 | kern_return_t |
| 476 | IODataQueueDispatchSource::Dispatch(const IORPC rpc) |
| 477 | { |
| 478 | return _Dispatch(self: this, rpc); |
| 479 | } |
| 480 | |
| 481 | kern_return_t |
| 482 | IODataQueueDispatchSource::_Dispatch(IODataQueueDispatchSource * self, const IORPC rpc) |
| 483 | { |
| 484 | kern_return_t ret = kIOReturnUnsupported; |
| 485 | IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false); |
| 486 | |
| 487 | switch (msg->msgid) |
| 488 | { |
| 489 | #if KERNEL |
| 490 | case IODataQueueDispatchSource_SetDataAvailableHandler_ID: |
| 491 | { |
| 492 | ret = IODataQueueDispatchSource::SetDataAvailableHandler_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODataQueueDispatchSource::SetDataAvailableHandler_Handler, *self, &IODataQueueDispatchSource::SetDataAvailableHandler_Impl)); |
| 493 | break; |
| 494 | } |
| 495 | #endif /* !KERNEL */ |
| 496 | #if KERNEL |
| 497 | case IODataQueueDispatchSource_SetDataServicedHandler_ID: |
| 498 | { |
| 499 | ret = IODataQueueDispatchSource::SetDataServicedHandler_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODataQueueDispatchSource::SetDataServicedHandler_Handler, *self, &IODataQueueDispatchSource::SetDataServicedHandler_Impl)); |
| 500 | break; |
| 501 | } |
| 502 | #endif /* !KERNEL */ |
| 503 | case IODispatchSource_SetEnableWithCompletion_ID: |
| 504 | { |
| 505 | ret = IODispatchSource::SetEnableWithCompletion_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODispatchSource::SetEnableWithCompletion_Handler, *self, &IODataQueueDispatchSource::SetEnableWithCompletion_Impl)); |
| 506 | break; |
| 507 | } |
| 508 | case IODispatchSource_Cancel_ID: |
| 509 | { |
| 510 | ret = IODispatchSource::Cancel_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODispatchSource::Cancel_Handler, *self, &IODataQueueDispatchSource::Cancel_Impl)); |
| 511 | break; |
| 512 | } |
| 513 | #if KERNEL |
| 514 | case IODataQueueDispatchSource_CopyMemory_ID: |
| 515 | { |
| 516 | ret = IODataQueueDispatchSource::CopyMemory_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODataQueueDispatchSource::CopyMemory_Handler, *self, &IODataQueueDispatchSource::CopyMemory_Impl)); |
| 517 | break; |
| 518 | } |
| 519 | #endif /* !KERNEL */ |
| 520 | #if KERNEL |
| 521 | case IODataQueueDispatchSource_CopyDataAvailableHandler_ID: |
| 522 | { |
| 523 | ret = IODataQueueDispatchSource::CopyDataAvailableHandler_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODataQueueDispatchSource::CopyDataAvailableHandler_Handler, *self, &IODataQueueDispatchSource::CopyDataAvailableHandler_Impl)); |
| 524 | break; |
| 525 | } |
| 526 | #endif /* !KERNEL */ |
| 527 | #if KERNEL |
| 528 | case IODataQueueDispatchSource_CopyDataServicedHandler_ID: |
| 529 | { |
| 530 | ret = IODataQueueDispatchSource::CopyDataServicedHandler_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODataQueueDispatchSource::CopyDataServicedHandler_Handler, *self, &IODataQueueDispatchSource::CopyDataServicedHandler_Impl)); |
| 531 | break; |
| 532 | } |
| 533 | #endif /* !KERNEL */ |
| 534 | case IODispatchSource_CheckForWork_ID: |
| 535 | { |
| 536 | ret = IODispatchSource::CheckForWork_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODispatchSource::CheckForWork_Handler, *self, &IODataQueueDispatchSource::CheckForWork_Impl)); |
| 537 | break; |
| 538 | } |
| 539 | |
| 540 | default: |
| 541 | ret = IODispatchSource::_Dispatch(self, rpc); |
| 542 | break; |
| 543 | } |
| 544 | |
| 545 | return (ret); |
| 546 | } |
| 547 | |
| 548 | #if KERNEL |
| 549 | kern_return_t |
| 550 | IODataQueueDispatchSource::MetaClass::Dispatch(const IORPC rpc) |
| 551 | { |
| 552 | #else /* KERNEL */ |
| 553 | kern_return_t |
| 554 | IODataQueueDispatchSourceMetaClass::Dispatch(const IORPC rpc) |
| 555 | { |
| 556 | #endif /* !KERNEL */ |
| 557 | |
| 558 | kern_return_t ret = kIOReturnUnsupported; |
| 559 | IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false); |
| 560 | |
| 561 | switch (msg->msgid) |
| 562 | { |
| 563 | #if KERNEL |
| 564 | case IODataQueueDispatchSource_Create_ID: |
| 565 | ret = IODataQueueDispatchSource::Create_Invoke(rpc, func: &IODataQueueDispatchSource::Create_Impl); |
| 566 | break; |
| 567 | #endif /* !KERNEL */ |
| 568 | |
| 569 | default: |
| 570 | ret = OSMetaClassBase::Dispatch(rpc); |
| 571 | break; |
| 572 | } |
| 573 | |
| 574 | return (ret); |
| 575 | } |
| 576 | |
| 577 | kern_return_t |
| 578 | IODataQueueDispatchSource::Create( |
| 579 | uint64_t queueByteCount, |
| 580 | IODispatchQueue * queue, |
| 581 | IODataQueueDispatchSource ** source) |
| 582 | { |
| 583 | kern_return_t ret; |
| 584 | union |
| 585 | { |
| 586 | IODataQueueDispatchSource_Create_Msg msg; |
| 587 | struct |
| 588 | { |
| 589 | IODataQueueDispatchSource_Create_Rpl rpl; |
| 590 | mach_msg_max_trailer_t trailer; |
| 591 | } rpl; |
| 592 | } buf; |
| 593 | struct IODataQueueDispatchSource_Create_Msg * msg = &buf.msg; |
| 594 | struct IODataQueueDispatchSource_Create_Rpl * rpl = &buf.rpl.rpl; |
| 595 | |
| 596 | memset(s: msg, c: 0, n: sizeof(struct IODataQueueDispatchSource_Create_Msg)); |
| 597 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 598 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 599 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
| 600 | | 0*kIORPCMessageSimpleReply |
| 601 | | 0*kIORPCMessageLocalHost |
| 602 | | 0*kIORPCMessageOnqueue; |
| 603 | msg->content.__hdr.msgid = IODataQueueDispatchSource_Create_ID; |
| 604 | msg->content.__object = (OSObjectRef) OSTypeID(IODataQueueDispatchSource); |
| 605 | msg->content.__hdr.objectRefs = IODataQueueDispatchSource_Create_Msg_ObjRefs; |
| 606 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
| 607 | |
| 608 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 609 | |
| 610 | msg->content.queueByteCount = queueByteCount; |
| 611 | |
| 612 | msg->queue__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 613 | msg->content.queue = (OSObjectRef) queue; |
| 614 | |
| 615 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
| 616 | ret = OSMTypeID(IODataQueueDispatchSource)->Invoke(rpc); |
| 617 | |
| 618 | if (kIOReturnSuccess == ret) |
| 619 | do { |
| 620 | { |
| 621 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
| 622 | if (rpl->content.__hdr.msgid != IODataQueueDispatchSource_Create_ID) { ret = kIOReturnIPCError; break; }; |
| 623 | if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; }; |
| 624 | if (IODataQueueDispatchSource_Create_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
| 625 | } |
| 626 | } |
| 627 | while (false); |
| 628 | if (kIOReturnSuccess == ret) |
| 629 | { |
| 630 | *source = OSDynamicCast(IODataQueueDispatchSource, (OSObject *) rpl->content.source); |
| 631 | if (rpl->content.source && !*source) ret = kIOReturnBadArgument; |
| 632 | } |
| 633 | |
| 634 | |
| 635 | return (ret); |
| 636 | } |
| 637 | |
| 638 | kern_return_t |
| 639 | IODataQueueDispatchSource::SetDataAvailableHandler( |
| 640 | OSAction * action, |
| 641 | OSDispatchMethod supermethod) |
| 642 | { |
| 643 | kern_return_t ret; |
| 644 | union |
| 645 | { |
| 646 | IODataQueueDispatchSource_SetDataAvailableHandler_Msg msg; |
| 647 | struct |
| 648 | { |
| 649 | IODataQueueDispatchSource_SetDataAvailableHandler_Rpl rpl; |
| 650 | mach_msg_max_trailer_t trailer; |
| 651 | } rpl; |
| 652 | } buf; |
| 653 | struct IODataQueueDispatchSource_SetDataAvailableHandler_Msg * msg = &buf.msg; |
| 654 | struct IODataQueueDispatchSource_SetDataAvailableHandler_Rpl * rpl = &buf.rpl.rpl; |
| 655 | |
| 656 | memset(s: msg, c: 0, n: sizeof(struct IODataQueueDispatchSource_SetDataAvailableHandler_Msg)); |
| 657 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 658 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 659 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
| 660 | | 1*kIORPCMessageSimpleReply |
| 661 | | 0*kIORPCMessageLocalHost |
| 662 | | 0*kIORPCMessageOnqueue; |
| 663 | msg->content.__hdr.msgid = IODataQueueDispatchSource_SetDataAvailableHandler_ID; |
| 664 | msg->content.__object = (OSObjectRef) this; |
| 665 | msg->content.__hdr.objectRefs = IODataQueueDispatchSource_SetDataAvailableHandler_Msg_ObjRefs; |
| 666 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
| 667 | |
| 668 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 669 | |
| 670 | msg->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 671 | msg->content.action = (OSObjectRef) action; |
| 672 | |
| 673 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
| 674 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
| 675 | else ret = ((OSObject *)this)->Invoke(rpc); |
| 676 | |
| 677 | if (kIOReturnSuccess == ret) |
| 678 | do { |
| 679 | { |
| 680 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
| 681 | if (rpl->content.__hdr.msgid != IODataQueueDispatchSource_SetDataAvailableHandler_ID) { ret = kIOReturnIPCError; break; }; |
| 682 | if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; }; |
| 683 | if (IODataQueueDispatchSource_SetDataAvailableHandler_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
| 684 | } |
| 685 | } |
| 686 | while (false); |
| 687 | if (kIOReturnSuccess == ret) |
| 688 | { |
| 689 | } |
| 690 | |
| 691 | |
| 692 | return (ret); |
| 693 | } |
| 694 | |
| 695 | kern_return_t |
| 696 | IODataQueueDispatchSource::SetDataServicedHandler( |
| 697 | OSAction * action, |
| 698 | OSDispatchMethod supermethod) |
| 699 | { |
| 700 | kern_return_t ret; |
| 701 | union |
| 702 | { |
| 703 | IODataQueueDispatchSource_SetDataServicedHandler_Msg msg; |
| 704 | struct |
| 705 | { |
| 706 | IODataQueueDispatchSource_SetDataServicedHandler_Rpl rpl; |
| 707 | mach_msg_max_trailer_t trailer; |
| 708 | } rpl; |
| 709 | } buf; |
| 710 | struct IODataQueueDispatchSource_SetDataServicedHandler_Msg * msg = &buf.msg; |
| 711 | struct IODataQueueDispatchSource_SetDataServicedHandler_Rpl * rpl = &buf.rpl.rpl; |
| 712 | |
| 713 | memset(s: msg, c: 0, n: sizeof(struct IODataQueueDispatchSource_SetDataServicedHandler_Msg)); |
| 714 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 715 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 716 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
| 717 | | 1*kIORPCMessageSimpleReply |
| 718 | | 0*kIORPCMessageLocalHost |
| 719 | | 0*kIORPCMessageOnqueue; |
| 720 | msg->content.__hdr.msgid = IODataQueueDispatchSource_SetDataServicedHandler_ID; |
| 721 | msg->content.__object = (OSObjectRef) this; |
| 722 | msg->content.__hdr.objectRefs = IODataQueueDispatchSource_SetDataServicedHandler_Msg_ObjRefs; |
| 723 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
| 724 | |
| 725 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 726 | |
| 727 | msg->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 728 | msg->content.action = (OSObjectRef) action; |
| 729 | |
| 730 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
| 731 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
| 732 | else ret = ((OSObject *)this)->Invoke(rpc); |
| 733 | |
| 734 | if (kIOReturnSuccess == ret) |
| 735 | do { |
| 736 | { |
| 737 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
| 738 | if (rpl->content.__hdr.msgid != IODataQueueDispatchSource_SetDataServicedHandler_ID) { ret = kIOReturnIPCError; break; }; |
| 739 | if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; }; |
| 740 | if (IODataQueueDispatchSource_SetDataServicedHandler_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
| 741 | } |
| 742 | } |
| 743 | while (false); |
| 744 | if (kIOReturnSuccess == ret) |
| 745 | { |
| 746 | } |
| 747 | |
| 748 | |
| 749 | return (ret); |
| 750 | } |
| 751 | |
| 752 | kern_return_t |
| 753 | IODataQueueDispatchSource::CopyMemory( |
| 754 | IOMemoryDescriptor ** memory, |
| 755 | OSDispatchMethod supermethod) |
| 756 | { |
| 757 | kern_return_t ret; |
| 758 | union |
| 759 | { |
| 760 | IODataQueueDispatchSource_CopyMemory_Msg msg; |
| 761 | struct |
| 762 | { |
| 763 | IODataQueueDispatchSource_CopyMemory_Rpl rpl; |
| 764 | mach_msg_max_trailer_t trailer; |
| 765 | } rpl; |
| 766 | } buf; |
| 767 | struct IODataQueueDispatchSource_CopyMemory_Msg * msg = &buf.msg; |
| 768 | struct IODataQueueDispatchSource_CopyMemory_Rpl * rpl = &buf.rpl.rpl; |
| 769 | |
| 770 | memset(s: msg, c: 0, n: sizeof(struct IODataQueueDispatchSource_CopyMemory_Msg)); |
| 771 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 772 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 773 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
| 774 | | 0*kIORPCMessageSimpleReply |
| 775 | | 0*kIORPCMessageLocalHost |
| 776 | | 0*kIORPCMessageOnqueue; |
| 777 | msg->content.__hdr.msgid = IODataQueueDispatchSource_CopyMemory_ID; |
| 778 | msg->content.__object = (OSObjectRef) this; |
| 779 | msg->content.__hdr.objectRefs = IODataQueueDispatchSource_CopyMemory_Msg_ObjRefs; |
| 780 | msg->mach.msgh_body.msgh_descriptor_count = 1; |
| 781 | |
| 782 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 783 | |
| 784 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
| 785 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
| 786 | else ret = ((OSObject *)this)->Invoke(rpc); |
| 787 | |
| 788 | if (kIOReturnSuccess == ret) |
| 789 | do { |
| 790 | { |
| 791 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
| 792 | if (rpl->content.__hdr.msgid != IODataQueueDispatchSource_CopyMemory_ID) { ret = kIOReturnIPCError; break; }; |
| 793 | if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; }; |
| 794 | if (IODataQueueDispatchSource_CopyMemory_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
| 795 | } |
| 796 | } |
| 797 | while (false); |
| 798 | if (kIOReturnSuccess == ret) |
| 799 | { |
| 800 | *memory = OSDynamicCast(IOMemoryDescriptor, (OSObject *) rpl->content.memory); |
| 801 | if (rpl->content.memory && !*memory) ret = kIOReturnBadArgument; |
| 802 | } |
| 803 | |
| 804 | |
| 805 | return (ret); |
| 806 | } |
| 807 | |
| 808 | kern_return_t |
| 809 | IODataQueueDispatchSource::CopyDataAvailableHandler( |
| 810 | OSAction ** action, |
| 811 | OSDispatchMethod supermethod) |
| 812 | { |
| 813 | kern_return_t ret; |
| 814 | union |
| 815 | { |
| 816 | IODataQueueDispatchSource_CopyDataAvailableHandler_Msg msg; |
| 817 | struct |
| 818 | { |
| 819 | IODataQueueDispatchSource_CopyDataAvailableHandler_Rpl rpl; |
| 820 | mach_msg_max_trailer_t trailer; |
| 821 | } rpl; |
| 822 | } buf; |
| 823 | struct IODataQueueDispatchSource_CopyDataAvailableHandler_Msg * msg = &buf.msg; |
| 824 | struct IODataQueueDispatchSource_CopyDataAvailableHandler_Rpl * rpl = &buf.rpl.rpl; |
| 825 | |
| 826 | memset(s: msg, c: 0, n: sizeof(struct IODataQueueDispatchSource_CopyDataAvailableHandler_Msg)); |
| 827 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 828 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 829 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
| 830 | | 0*kIORPCMessageSimpleReply |
| 831 | | 0*kIORPCMessageLocalHost |
| 832 | | 0*kIORPCMessageOnqueue; |
| 833 | msg->content.__hdr.msgid = IODataQueueDispatchSource_CopyDataAvailableHandler_ID; |
| 834 | msg->content.__object = (OSObjectRef) this; |
| 835 | msg->content.__hdr.objectRefs = IODataQueueDispatchSource_CopyDataAvailableHandler_Msg_ObjRefs; |
| 836 | msg->mach.msgh_body.msgh_descriptor_count = 1; |
| 837 | |
| 838 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 839 | |
| 840 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
| 841 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
| 842 | else ret = ((OSObject *)this)->Invoke(rpc); |
| 843 | |
| 844 | if (kIOReturnSuccess == ret) |
| 845 | do { |
| 846 | { |
| 847 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
| 848 | if (rpl->content.__hdr.msgid != IODataQueueDispatchSource_CopyDataAvailableHandler_ID) { ret = kIOReturnIPCError; break; }; |
| 849 | if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; }; |
| 850 | if (IODataQueueDispatchSource_CopyDataAvailableHandler_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
| 851 | } |
| 852 | } |
| 853 | while (false); |
| 854 | if (kIOReturnSuccess == ret) |
| 855 | { |
| 856 | *action = OSDynamicCast(OSAction, (OSObject *) rpl->content.action); |
| 857 | if (rpl->content.action && !*action) ret = kIOReturnBadArgument; |
| 858 | } |
| 859 | |
| 860 | |
| 861 | return (ret); |
| 862 | } |
| 863 | |
| 864 | kern_return_t |
| 865 | IODataQueueDispatchSource::CopyDataServicedHandler( |
| 866 | OSAction ** action, |
| 867 | OSDispatchMethod supermethod) |
| 868 | { |
| 869 | kern_return_t ret; |
| 870 | union |
| 871 | { |
| 872 | IODataQueueDispatchSource_CopyDataServicedHandler_Msg msg; |
| 873 | struct |
| 874 | { |
| 875 | IODataQueueDispatchSource_CopyDataServicedHandler_Rpl rpl; |
| 876 | mach_msg_max_trailer_t trailer; |
| 877 | } rpl; |
| 878 | } buf; |
| 879 | struct IODataQueueDispatchSource_CopyDataServicedHandler_Msg * msg = &buf.msg; |
| 880 | struct IODataQueueDispatchSource_CopyDataServicedHandler_Rpl * rpl = &buf.rpl.rpl; |
| 881 | |
| 882 | memset(s: msg, c: 0, n: sizeof(struct IODataQueueDispatchSource_CopyDataServicedHandler_Msg)); |
| 883 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 884 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 885 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
| 886 | | 0*kIORPCMessageSimpleReply |
| 887 | | 0*kIORPCMessageLocalHost |
| 888 | | 0*kIORPCMessageOnqueue; |
| 889 | msg->content.__hdr.msgid = IODataQueueDispatchSource_CopyDataServicedHandler_ID; |
| 890 | msg->content.__object = (OSObjectRef) this; |
| 891 | msg->content.__hdr.objectRefs = IODataQueueDispatchSource_CopyDataServicedHandler_Msg_ObjRefs; |
| 892 | msg->mach.msgh_body.msgh_descriptor_count = 1; |
| 893 | |
| 894 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 895 | |
| 896 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
| 897 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
| 898 | else ret = ((OSObject *)this)->Invoke(rpc); |
| 899 | |
| 900 | if (kIOReturnSuccess == ret) |
| 901 | do { |
| 902 | { |
| 903 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
| 904 | if (rpl->content.__hdr.msgid != IODataQueueDispatchSource_CopyDataServicedHandler_ID) { ret = kIOReturnIPCError; break; }; |
| 905 | if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; }; |
| 906 | if (IODataQueueDispatchSource_CopyDataServicedHandler_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
| 907 | } |
| 908 | } |
| 909 | while (false); |
| 910 | if (kIOReturnSuccess == ret) |
| 911 | { |
| 912 | *action = OSDynamicCast(OSAction, (OSObject *) rpl->content.action); |
| 913 | if (rpl->content.action && !*action) ret = kIOReturnBadArgument; |
| 914 | } |
| 915 | |
| 916 | |
| 917 | return (ret); |
| 918 | } |
| 919 | |
| 920 | void |
| 921 | IODataQueueDispatchSource::DataAvailable( |
| 922 | OSAction * action, |
| 923 | OSDispatchMethod supermethod) |
| 924 | { |
| 925 | kern_return_t ret; |
| 926 | union |
| 927 | { |
| 928 | IODataQueueDispatchSource_DataAvailable_Msg msg; |
| 929 | } buf; |
| 930 | struct IODataQueueDispatchSource_DataAvailable_Msg * msg = &buf.msg; |
| 931 | |
| 932 | memset(s: msg, c: 0, n: sizeof(struct IODataQueueDispatchSource_DataAvailable_Msg)); |
| 933 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 934 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 935 | msg->content.__hdr.flags = 1*kIORPCMessageOneway |
| 936 | | 1*kIORPCMessageSimpleReply |
| 937 | | 0*kIORPCMessageLocalHost |
| 938 | | 0*kIORPCMessageOnqueue; |
| 939 | msg->content.__hdr.msgid = IODataQueueDispatchSource_DataAvailable_ID; |
| 940 | msg->content.__object = (OSObjectRef) action; |
| 941 | msg->content.__hdr.objectRefs = IODataQueueDispatchSource_DataAvailable_Msg_ObjRefs; |
| 942 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
| 943 | |
| 944 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 945 | |
| 946 | msg->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 947 | msg->content.action = (OSObjectRef) action; |
| 948 | |
| 949 | IORPC rpc = { .message = &buf.msg.mach, .reply = NULL, .sendSize = sizeof(*msg), .replySize = 0 }; |
| 950 | ret = action->Invoke(rpc); |
| 951 | |
| 952 | } |
| 953 | |
| 954 | void |
| 955 | IODataQueueDispatchSource::DataServiced( |
| 956 | OSAction * action, |
| 957 | OSDispatchMethod supermethod) |
| 958 | { |
| 959 | kern_return_t ret; |
| 960 | union |
| 961 | { |
| 962 | IODataQueueDispatchSource_DataServiced_Msg msg; |
| 963 | } buf; |
| 964 | struct IODataQueueDispatchSource_DataServiced_Msg * msg = &buf.msg; |
| 965 | |
| 966 | memset(s: msg, c: 0, n: sizeof(struct IODataQueueDispatchSource_DataServiced_Msg)); |
| 967 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 968 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 969 | msg->content.__hdr.flags = 1*kIORPCMessageOneway |
| 970 | | 1*kIORPCMessageSimpleReply |
| 971 | | 0*kIORPCMessageLocalHost |
| 972 | | 0*kIORPCMessageOnqueue; |
| 973 | msg->content.__hdr.msgid = IODataQueueDispatchSource_DataServiced_ID; |
| 974 | msg->content.__object = (OSObjectRef) action; |
| 975 | msg->content.__hdr.objectRefs = IODataQueueDispatchSource_DataServiced_Msg_ObjRefs; |
| 976 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
| 977 | |
| 978 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 979 | |
| 980 | msg->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 981 | msg->content.action = (OSObjectRef) action; |
| 982 | |
| 983 | IORPC rpc = { .message = &buf.msg.mach, .reply = NULL, .sendSize = sizeof(*msg), .replySize = 0 }; |
| 984 | ret = action->Invoke(rpc); |
| 985 | |
| 986 | } |
| 987 | |
| 988 | kern_return_t |
| 989 | IODataQueueDispatchSource::Create_Invoke(const IORPC _rpc, |
| 990 | Create_Handler func) |
| 991 | { |
| 992 | IODataQueueDispatchSource_Create_Invocation rpc = { .rpc: _rpc }; |
| 993 | kern_return_t ret; |
| 994 | IODispatchQueue * queue; |
| 995 | |
| 996 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 997 | if (IODataQueueDispatchSource_Create_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 998 | if (rpc.message != NULL && rpc.sendSize < sizeof(IODataQueueDispatchSource_Create_Msg)) return (kIOReturnIPCError); |
| 999 | if (rpc.reply != NULL && rpc.replySize < sizeof(IODataQueueDispatchSource_Create_Rpl)) return (kIOReturnIPCError); |
| 1000 | queue = OSDynamicCast(IODispatchQueue, (OSObject *) rpc.message->content.queue); |
| 1001 | if (!queue && rpc.message->content.queue) return (kIOReturnBadArgument); |
| 1002 | |
| 1003 | ret = (*func)( rpc.message->content.queueByteCount, |
| 1004 | queue, |
| 1005 | (IODataQueueDispatchSource **)&rpc.reply->content.source); |
| 1006 | |
| 1007 | if (kIOReturnSuccess != ret) return (ret); |
| 1008 | |
| 1009 | rpc.reply->content.__hdr.msgid = IODataQueueDispatchSource_Create_ID; |
| 1010 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
| 1011 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
| 1012 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
| 1013 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 1; |
| 1014 | rpc.reply->content.__hdr.objectRefs = IODataQueueDispatchSource_Create_Rpl_ObjRefs; |
| 1015 | rpc.reply->source__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 1016 | |
| 1017 | return (ret); |
| 1018 | } |
| 1019 | |
| 1020 | kern_return_t |
| 1021 | IODataQueueDispatchSource::SetDataAvailableHandler_Invoke(const IORPC _rpc, |
| 1022 | OSMetaClassBase * target, |
| 1023 | SetDataAvailableHandler_Handler func) |
| 1024 | { |
| 1025 | IODataQueueDispatchSource_SetDataAvailableHandler_Invocation rpc = { .rpc: _rpc }; |
| 1026 | kern_return_t ret; |
| 1027 | OSAction * action; |
| 1028 | |
| 1029 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 1030 | if (IODataQueueDispatchSource_SetDataAvailableHandler_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 1031 | if (rpc.message != NULL && rpc.sendSize < sizeof(IODataQueueDispatchSource_SetDataAvailableHandler_Msg)) return (kIOReturnIPCError); |
| 1032 | if (rpc.reply != NULL && rpc.replySize < sizeof(IODataQueueDispatchSource_SetDataAvailableHandler_Rpl)) return (kIOReturnIPCError); |
| 1033 | action = OSDynamicCast(OSAction, (OSObject *) rpc.message->content.action); |
| 1034 | if (!action && rpc.message->content.action) return (kIOReturnBadArgument); |
| 1035 | |
| 1036 | ret = (*func)(target, |
| 1037 | action); |
| 1038 | |
| 1039 | if (kIOReturnSuccess != ret) return (ret); |
| 1040 | |
| 1041 | rpc.reply->content.__hdr.msgid = IODataQueueDispatchSource_SetDataAvailableHandler_ID; |
| 1042 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
| 1043 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
| 1044 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
| 1045 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 0; |
| 1046 | rpc.reply->content.__hdr.objectRefs = IODataQueueDispatchSource_SetDataAvailableHandler_Rpl_ObjRefs; |
| 1047 | |
| 1048 | return (ret); |
| 1049 | } |
| 1050 | |
| 1051 | kern_return_t |
| 1052 | IODataQueueDispatchSource::SetDataServicedHandler_Invoke(const IORPC _rpc, |
| 1053 | OSMetaClassBase * target, |
| 1054 | SetDataServicedHandler_Handler func) |
| 1055 | { |
| 1056 | IODataQueueDispatchSource_SetDataServicedHandler_Invocation rpc = { .rpc: _rpc }; |
| 1057 | kern_return_t ret; |
| 1058 | OSAction * action; |
| 1059 | |
| 1060 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 1061 | if (IODataQueueDispatchSource_SetDataServicedHandler_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 1062 | if (rpc.message != NULL && rpc.sendSize < sizeof(IODataQueueDispatchSource_SetDataServicedHandler_Msg)) return (kIOReturnIPCError); |
| 1063 | if (rpc.reply != NULL && rpc.replySize < sizeof(IODataQueueDispatchSource_SetDataServicedHandler_Rpl)) return (kIOReturnIPCError); |
| 1064 | action = OSDynamicCast(OSAction, (OSObject *) rpc.message->content.action); |
| 1065 | if (!action && rpc.message->content.action) return (kIOReturnBadArgument); |
| 1066 | |
| 1067 | ret = (*func)(target, |
| 1068 | action); |
| 1069 | |
| 1070 | if (kIOReturnSuccess != ret) return (ret); |
| 1071 | |
| 1072 | rpc.reply->content.__hdr.msgid = IODataQueueDispatchSource_SetDataServicedHandler_ID; |
| 1073 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
| 1074 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
| 1075 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
| 1076 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 0; |
| 1077 | rpc.reply->content.__hdr.objectRefs = IODataQueueDispatchSource_SetDataServicedHandler_Rpl_ObjRefs; |
| 1078 | |
| 1079 | return (ret); |
| 1080 | } |
| 1081 | |
| 1082 | kern_return_t |
| 1083 | IODataQueueDispatchSource::CopyMemory_Invoke(const IORPC _rpc, |
| 1084 | OSMetaClassBase * target, |
| 1085 | CopyMemory_Handler func) |
| 1086 | { |
| 1087 | IODataQueueDispatchSource_CopyMemory_Invocation rpc = { .rpc: _rpc }; |
| 1088 | kern_return_t ret; |
| 1089 | |
| 1090 | if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 1091 | if (IODataQueueDispatchSource_CopyMemory_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 1092 | if (rpc.message != NULL && rpc.sendSize < sizeof(IODataQueueDispatchSource_CopyMemory_Msg)) return (kIOReturnIPCError); |
| 1093 | if (rpc.reply != NULL && rpc.replySize < sizeof(IODataQueueDispatchSource_CopyMemory_Rpl)) return (kIOReturnIPCError); |
| 1094 | |
| 1095 | ret = (*func)(target, |
| 1096 | (IOMemoryDescriptor **)&rpc.reply->content.memory); |
| 1097 | |
| 1098 | if (kIOReturnSuccess != ret) return (ret); |
| 1099 | |
| 1100 | rpc.reply->content.__hdr.msgid = IODataQueueDispatchSource_CopyMemory_ID; |
| 1101 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
| 1102 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
| 1103 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
| 1104 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 1; |
| 1105 | rpc.reply->content.__hdr.objectRefs = IODataQueueDispatchSource_CopyMemory_Rpl_ObjRefs; |
| 1106 | rpc.reply->memory__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 1107 | |
| 1108 | return (ret); |
| 1109 | } |
| 1110 | |
| 1111 | kern_return_t |
| 1112 | IODataQueueDispatchSource::CopyDataAvailableHandler_Invoke(const IORPC _rpc, |
| 1113 | OSMetaClassBase * target, |
| 1114 | CopyDataAvailableHandler_Handler func) |
| 1115 | { |
| 1116 | IODataQueueDispatchSource_CopyDataAvailableHandler_Invocation rpc = { .rpc: _rpc }; |
| 1117 | kern_return_t ret; |
| 1118 | |
| 1119 | if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 1120 | if (IODataQueueDispatchSource_CopyDataAvailableHandler_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 1121 | if (rpc.message != NULL && rpc.sendSize < sizeof(IODataQueueDispatchSource_CopyDataAvailableHandler_Msg)) return (kIOReturnIPCError); |
| 1122 | if (rpc.reply != NULL && rpc.replySize < sizeof(IODataQueueDispatchSource_CopyDataAvailableHandler_Rpl)) return (kIOReturnIPCError); |
| 1123 | |
| 1124 | ret = (*func)(target, |
| 1125 | (OSAction **)&rpc.reply->content.action); |
| 1126 | |
| 1127 | if (kIOReturnSuccess != ret) return (ret); |
| 1128 | |
| 1129 | rpc.reply->content.__hdr.msgid = IODataQueueDispatchSource_CopyDataAvailableHandler_ID; |
| 1130 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
| 1131 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
| 1132 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
| 1133 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 1; |
| 1134 | rpc.reply->content.__hdr.objectRefs = IODataQueueDispatchSource_CopyDataAvailableHandler_Rpl_ObjRefs; |
| 1135 | rpc.reply->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 1136 | |
| 1137 | return (ret); |
| 1138 | } |
| 1139 | |
| 1140 | kern_return_t |
| 1141 | IODataQueueDispatchSource::CopyDataServicedHandler_Invoke(const IORPC _rpc, |
| 1142 | OSMetaClassBase * target, |
| 1143 | CopyDataServicedHandler_Handler func) |
| 1144 | { |
| 1145 | IODataQueueDispatchSource_CopyDataServicedHandler_Invocation rpc = { .rpc: _rpc }; |
| 1146 | kern_return_t ret; |
| 1147 | |
| 1148 | if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 1149 | if (IODataQueueDispatchSource_CopyDataServicedHandler_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 1150 | if (rpc.message != NULL && rpc.sendSize < sizeof(IODataQueueDispatchSource_CopyDataServicedHandler_Msg)) return (kIOReturnIPCError); |
| 1151 | if (rpc.reply != NULL && rpc.replySize < sizeof(IODataQueueDispatchSource_CopyDataServicedHandler_Rpl)) return (kIOReturnIPCError); |
| 1152 | |
| 1153 | ret = (*func)(target, |
| 1154 | (OSAction **)&rpc.reply->content.action); |
| 1155 | |
| 1156 | if (kIOReturnSuccess != ret) return (ret); |
| 1157 | |
| 1158 | rpc.reply->content.__hdr.msgid = IODataQueueDispatchSource_CopyDataServicedHandler_ID; |
| 1159 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
| 1160 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
| 1161 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
| 1162 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 1; |
| 1163 | rpc.reply->content.__hdr.objectRefs = IODataQueueDispatchSource_CopyDataServicedHandler_Rpl_ObjRefs; |
| 1164 | rpc.reply->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 1165 | |
| 1166 | return (ret); |
| 1167 | } |
| 1168 | |
| 1169 | kern_return_t |
| 1170 | IODataQueueDispatchSource::DataAvailable_Invoke(const IORPC _rpc, |
| 1171 | OSMetaClassBase * target, |
| 1172 | DataAvailable_Handler func) |
| 1173 | { |
| 1174 | return IODataQueueDispatchSource::DataAvailable_Invoke(rpc: _rpc, target, func, NULL); |
| 1175 | } |
| 1176 | |
| 1177 | kern_return_t |
| 1178 | IODataQueueDispatchSource::DataAvailable_Invoke(const IORPC _rpc, |
| 1179 | OSMetaClassBase * target, |
| 1180 | DataAvailable_Handler func, |
| 1181 | const OSMetaClass * targetActionClass) |
| 1182 | { |
| 1183 | IODataQueueDispatchSource_DataAvailable_Invocation rpc = { .rpc: _rpc }; |
| 1184 | OSAction * action; |
| 1185 | |
| 1186 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 1187 | if (IODataQueueDispatchSource_DataAvailable_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 1188 | if (rpc.message != NULL && rpc.sendSize < sizeof(IODataQueueDispatchSource_DataAvailable_Msg)) return (kIOReturnIPCError); |
| 1189 | if (rpc.reply != NULL && rpc.replySize < sizeof(IODataQueueDispatchSource_DataAvailable_Rpl)) return (kIOReturnIPCError); |
| 1190 | if (targetActionClass) { |
| 1191 | action = (OSAction *) OSMetaClassBase::safeMetaCast(anObject: (OSObject *) rpc.message->content.action, toMeta: targetActionClass); |
| 1192 | } else { |
| 1193 | action = OSDynamicCast(OSAction, (OSObject *) rpc.message->content.action); |
| 1194 | } |
| 1195 | if (!action && rpc.message->content.action) return (kIOReturnBadArgument); |
| 1196 | |
| 1197 | (*func)(target, |
| 1198 | action); |
| 1199 | |
| 1200 | |
| 1201 | return (kIOReturnSuccess); |
| 1202 | } |
| 1203 | |
| 1204 | kern_return_t |
| 1205 | IODataQueueDispatchSource::DataServiced_Invoke(const IORPC _rpc, |
| 1206 | OSMetaClassBase * target, |
| 1207 | DataServiced_Handler func) |
| 1208 | { |
| 1209 | return IODataQueueDispatchSource::DataServiced_Invoke(rpc: _rpc, target, func, NULL); |
| 1210 | } |
| 1211 | |
| 1212 | kern_return_t |
| 1213 | IODataQueueDispatchSource::DataServiced_Invoke(const IORPC _rpc, |
| 1214 | OSMetaClassBase * target, |
| 1215 | DataServiced_Handler func, |
| 1216 | const OSMetaClass * targetActionClass) |
| 1217 | { |
| 1218 | IODataQueueDispatchSource_DataServiced_Invocation rpc = { .rpc: _rpc }; |
| 1219 | OSAction * action; |
| 1220 | |
| 1221 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 1222 | if (IODataQueueDispatchSource_DataServiced_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 1223 | if (rpc.message != NULL && rpc.sendSize < sizeof(IODataQueueDispatchSource_DataServiced_Msg)) return (kIOReturnIPCError); |
| 1224 | if (rpc.reply != NULL && rpc.replySize < sizeof(IODataQueueDispatchSource_DataServiced_Rpl)) return (kIOReturnIPCError); |
| 1225 | if (targetActionClass) { |
| 1226 | action = (OSAction *) OSMetaClassBase::safeMetaCast(anObject: (OSObject *) rpc.message->content.action, toMeta: targetActionClass); |
| 1227 | } else { |
| 1228 | action = OSDynamicCast(OSAction, (OSObject *) rpc.message->content.action); |
| 1229 | } |
| 1230 | if (!action && rpc.message->content.action) return (kIOReturnBadArgument); |
| 1231 | |
| 1232 | (*func)(target, |
| 1233 | action); |
| 1234 | |
| 1235 | |
| 1236 | return (kIOReturnSuccess); |
| 1237 | } |
| 1238 | |
| 1239 | |
| 1240 | |
| 1241 | |