Blame src/internal/toksvc_daemon_impl.h

5e5175
#ifndef TOKSVC_DAEMON_IMPL_H
5e5175
#define TOKSVC_DAEMON_IMPL_H
5e5175
5e5175
#include <psxtypes/psxtypes.h>
5e5175
#include <ntapi/ntapi.h>
7c2549
#include <toksvc/toksvc.h>
5e5175
5e5175
enum toks_daemon_opcodes {
5e5175
	TOKS_DAEMON_OPCODE_BASE	= 0x20000,
5e5175
	TOKS_DAEMON_CONNECT	= TOKS_DAEMON_OPCODE_BASE,
5e5175
	TOKS_DAEMON_DISCONNECT,
5e5175
	TOKS_DAEMON_TTYSIGNAL,
5e5175
	TOKS_DAEMON_IPCSIGNAL,
5e5175
	TOKS_DAEMON_SIGCHLD,
5e5175
	TOKS_DAEMON_THREADEXIT,
d27132
	TOKS_DAEMON_CIDQUERY,
44e933
	TOKS_DAEMON_ACQUIRE,
c78a06
	TOKS_DAEMON_RELEASE,
3034d1
	TOKS_DAEMON_CANCEL,
5ab1f5
	TOKS_DAEMON_ABORT,
e6c547
	TOKS_DAEMON_IOCTL,
5e5175
	TOKS_DAEMON_OPCODE_CAP
5e5175
};
5e5175
9985a1
struct toks_daemon_ctx;
f2a689
struct toks_driver_ctx;
f2a689
74d496
struct toks_client_ctx {
74d496
	void *  hprocess;
719840
	void *  hcaller;
44e933
	void *  hinstance;
74d496
	void *  hport;
74d496
	void *  hswap;
44e933
	void *  halert;
658181
	void *  hevent;
c78a06
	void *  hdaemon;
344692
	int32_t tokpid;
74d496
	nt_cid  cid;
74d496
};
74d496
7c2549
struct toks_token_sctx {
7c2549
	int32_t			allocated;
7c2549
	int32_t			available;
18ccef
	int32_t			pending;
7c2549
	int32_t			tused;
7c2549
	int32_t			tfree;
620f32
	struct toks_token_info	tokens[512];
7c2549
};
7c2549
c847e3
struct toks_token {
44e933
	struct toks_token *	self;
a6e87d
	struct toks_client_ctx	client;
a6e87d
	struct _nt_port_keys	keys;
34ac34
	struct _nt_port_keys	meta;
c847e3
};
c847e3
d73408
struct toks_waiter {
d73408
	struct toks_client_ctx  client;
d73408
	struct _nt_tty_port_msg msg;
d73408
};
d73408
9985a1
typedef int32_t __stdcall toks_daemon_routine(struct toks_daemon_ctx *);
9985a1
5e5175
struct toks_daemon_ctx {
ba64ae
	struct toks_driver_ctx *    driver_ctx;
f2a689
ba64ae
	struct toks_waiter *        waiter_base;
ba64ae
	struct toks_waiter *        waiter_first;
ba64ae
	struct toks_waiter *        waiter_next;
ba64ae
	struct toks_waiter *        waiter_cap;
681a45
ba64ae
	nt_port_keys                daemon_keys;
ba64ae
	nt_port_attr                daemon_attr;
ba64ae
	nt_port_name                daemon_name;
5e5175
8f6a66
	int                         ftokens;
8f6a66
	int                         utokens;
8f6a66
35e873
	intptr_t                    ctrlpid;
35e873
	intptr_t                    csyspid;
35e873
35e873
	void *                      hctrl;
35e873
	void *                      hswap;
35e873
ba64ae
	void *                      hport_daemon;
ba64ae
	void *                      hevent_daemon_ready;
5e5175
ba64ae
	void *                      hport_internal_client;
ba64ae
	void *                      hevent_internal_client_ready;
9985a1
0c1a80
	enum toks_daemon_opcodes    opcode;
0c1a80
ba64ae
	nt_tty_port_msg             request;
ba64ae
	nt_tty_port_msg             reply;
344692
344692
	intptr_t                    reqtokpid;
344692
	intptr_t                    reqsyspid;
6f1c85
6f1c85
	nt_filetime                 pcnt;
9e552e
	uint64_t                    noise;
5e5175
};
5e5175
618937
int32_t __stdcall toks_daemon_init(struct toks_daemon_ctx *, const nt_guid *);
5e5175
int32_t __stdcall toks_daemon_loop(void *);
9985a1
9985a1
int32_t __stdcall toks_daemon_connect(struct toks_daemon_ctx *);
d27132
int32_t __stdcall toks_daemon_cidquery(struct toks_daemon_ctx *);
9985a1
int32_t __stdcall toks_daemon_signal(struct toks_daemon_ctx *);
44e933
int32_t __stdcall toks_daemon_acquire(struct toks_daemon_ctx *);
500bc3
int32_t __stdcall toks_daemon_pidopen(struct toks_daemon_ctx *);
c78a06
int32_t __stdcall toks_daemon_release(struct toks_daemon_ctx *);
3034d1
int32_t __stdcall toks_daemon_cancel(struct toks_daemon_ctx *);
5ab1f5
int32_t __stdcall toks_daemon_abort(struct toks_daemon_ctx *);
e6c547
int32_t __stdcall toks_daemon_ioctl(struct toks_daemon_ctx *);
5e5175
5e5175
#endif