Blob Blame History Raw
#ifndef TOKSVC_DRIVER_IMPL_H
#define TOKSVC_DRIVER_IMPL_H

#include <psxtypes/psxtypes.h>
#include <ntapi/ntapi.h>

#include <stdint.h>
#include <stdio.h>

#include <toksvc/toksvc.h>
#include "argv/argv.h"

#define TOKS_OPTV_ELEMENTS 64

extern   const struct argv_option toks_default_options[];
extern   const ntapi_vtbl * toks_ntapi;

#define  ntapi toks_ntapi

enum app_tags {
	TAG_HELP,
	TAG_VERSION,
	TAG_DAEMON,
	TAG_SYSROOT,
};

struct toks_client_ctx {
	void *			hprocess;
	void *			hthread;
	nt_cid			cid;
	nt_pty_client_info	clinfo;
};

struct toks_driver_ctx_impl {
	nt_rtdata *		rtdata;
	struct toks_client_ctx	clctx;
	struct toks_common_ctx	cctx;
	struct toks_driver_ctx	ctx;
};

static inline struct toks_driver_ctx_impl * toks_get_driver_ictx(const struct toks_driver_ctx * dctx)
{
	uintptr_t addr;

	if (dctx) {
		addr = (uintptr_t)dctx - offsetof(struct toks_driver_ctx_impl,ctx);
		return (struct toks_driver_ctx_impl *)addr;
	}

	return 0;
}

int32_t toks_open_file(void ** hfile, void * hat, const char * arg, bool fprivate);
int32_t toks_open_dir(void ** hfile, void * hat, const char * arg, bool fprivate);

#endif