Blame src/daemon/toks_daemon_ioctl.c

e6c547
/*********************************************************/
e6c547
/*  toksvc: a framework-native token broker service      */
e6c547
/*  Copyright (C) 2020  Z. Gilboa                        */
e6c547
/*  Released under GPLv2 and GPLv3; see COPYING.TOKSVC.  */
e6c547
/*********************************************************/
e6c547
e6c547
#include <psxtypes/psxtypes.h>
e6c547
#include <ntapi/ntapi.h>
e6c547
#include <ntapi/nt_termios.h>
e6c547
e6c547
#include "toksvc_daemon_impl.h"
e6c547
#include "toksvc_driver_impl.h"
e6c547
e6c547
static int32_t toks_daemon_ioctl_get_token_count(struct toks_daemon_ctx * dctx)
e6c547
{
e6c547
	nt_tty_port_msg * msg = &dctx->reply;
e6c547
	msg->ttyinfo.exarg = (void *)(intptr_t)toks_get_driver_ntokens(dctx->driver_ctx);
e6c547
	return NT_STATUS_SUCCESS;
e6c547
}
e6c547
e6c547
int32_t __stdcall toks_daemon_ioctl(struct toks_daemon_ctx * dctx)
e6c547
{
e6c547
	nt_tty_port_msg * msg;
e6c547
	uint32_t          ctlcode;
e6c547
e6c547
	msg     = &dctx->reply;
e6c547
	ctlcode = msg->ttyinfo.opdata;
e6c547
e6c547
	switch (ctlcode) {
e6c547
		case TOKS_IOCTL_GET_TOKEN_COUNT:
e6c547
			return toks_daemon_ioctl_get_token_count(dctx);
e6c547
e6c547
		default:
e6c547
			return NT_STATUS_NOT_IMPLEMENTED;
e6c547
	}
e6c547
}