#ifndef _NT_MSQ_H_
#define _NT_MSQ_H_
#include "nt_abi.h"
#include "nt_object.h"
/* semaphore command flags */
#define NT_MSQ_FLAG_NOWAIT (0x0800)
#define NT_MSQ_FLAG_NOERROR (0x1000)
/* msgqueue info */
typedef struct __attr_ptr_size_aligned__ _nt_msq_info {
void * hport;
void * section;
void * section_addr;
size_t section_size;
void * hevent;
void * apc_routine;
void * apc_context;
int32_t msqkey;
int32_t msqid;
int32_t msqspid;
int32_t msqrpid;
intptr_t msqrank;
uintptr_t msqslots;
uintptr_t msqcbytes;
uintptr_t msqqbytes;
uint32_t msqscnt;
uint32_t msqrcnt;
nt_filetime msqstime;
nt_filetime msqrtime;
nt_filetime msqctime;
uint64_t ipcuid;
uint64_t ipcgid;
uint64_t ipccuid;
uint64_t ipccgid;
uint32_t ipcmode;
int32_t ipcseq;
uint32_t ntaccess;
uint32_t ntattr;
uint32_t ntshare;
uint32_t ntoptions;
nt_iosb ntiosb;
nt_iosb * riosb;
} nt_msq_info;
/* msgqueue client interfaces */
typedef int32_t __stdcall ntapi_msq_create(
__in void * hport,
__out nt_msq_info * msq,
__in uint32_t access,
__in nt_object_attributes * oa,
__out nt_iosb * iosb,
__in uint32_t share,
__in uint32_t nslots);
typedef int32_t __stdcall ntapi_msq_open(
__in void * hport,
__out nt_msq_info * msq,
__in uint32_t access,
__in nt_object_attributes * oa,
__out nt_iosb * iosb,
__in uint32_t share,
__in uint32_t nslots);
typedef int32_t __stdcall ntapi_msq_send(
__in nt_msq_info * msq,
__in void * hevent __optional,
__in nt_io_apc_routine * apc_routine __optional,
__in void * apc_context __optional,
__in const void * buffer,
__in size_t len,
__in intptr_t rank,
__in uint32_t options,
__out nt_io_status_block * iosb);
typedef int32_t __stdcall ntapi_msq_recv(
__in nt_msq_info * msq,
__in void * hevent __optional,
__in nt_io_apc_routine * apc_routine __optional,
__in void * apc_context __optional,
__out void * buffer,
__in size_t len,
__in intptr_t rank,
__in uint32_t options,
__out nt_io_status_block * iosb);
typedef int32_t __stdcall ntapi_msq_fcntl(
__in nt_msq_info * msq,
__in void * hevent __optional,
__in nt_io_apc_routine * apc_routine __optional,
__in void * apc_context __optional,
__out nt_iosb * iosb,
__in uint32_t tty_control_code,
__in void * input_buffer __optional,
__in uint32_t input_buffer_length,
__out void * output_buffer __optional,
__in uint32_t output_buffer_length);
typedef int32_t __stdcall ntapi_msq_ioctl(
__in nt_msq_info * msq,
__in void * hevent __optional,
__in nt_io_apc_routine * apc_routine __optional,
__in void * apc_context __optional,
__out nt_iosb * iosb,
__in uint32_t ipc_control_code,
__in void * input_buffer __optional,
__in uint32_t input_buffer_length,
__out void * output_buffer __optional,
__in uint32_t output_buffer_length);
typedef int32_t __stdcall ntapi_msq_query(
__in nt_msq_info * msq,
__out nt_io_status_block * iosb,
__out void * sem_info,
__in uint32_t sem_info_length,
__in int32_t sem_ipc_cmd);
typedef int32_t __stdcall ntapi_msq_set(
__in nt_msq_info * msq,
__out nt_io_status_block * iosb,
__in void * sem_info,
__in uint32_t sem_info_length,
__in int32_t sem_ipc_cmd);
typedef int32_t __stdcall ntapi_msq_cancel(
__in nt_msq_info * msq,
__out nt_iosb * iosb);
typedef int32_t __stdcall ntapi_msq_free(
__in nt_msq_info * msq,
__out nt_iosb * iosb);
#endif