Blame src/log/toks_log_lpc_request.c

f2a689
/*********************************************************/
f2a689
/*  toksvc: a framework-native token broker service      */
f2a689
/*  Copyright (C) 2020  Z. Gilboa                        */
f2a689
/*  Released under GPLv2 and GPLv3; see COPYING.TOKSVC.  */
f2a689
/*********************************************************/
f2a689
f2a689
#include <psxtypes/psxtypes.h>
f2a689
#include <ntapi/nt_tty.h>
f2a689
f2a689
#include <toksvc/toksvc.h>
f2a689
#include "toksvc_driver_impl.h"
f2a689
#include "toksvc_log_impl.h"
f2a689
f2a689
void toks_log_lpc_request(
f2a689
	const struct toks_driver_ctx *  dctx,
f2a689
	const nt_tty_port_msg *  msg)
f2a689
{
f2a689
	TOKS_LOG_LEVEL(dctx,0);
f2a689
f2a689
	nt_cid cid;
f2a689
	char   path[2048];
f2a689
f2a689
	cid.process_id = msg->header.client_id.process_id;
f2a689
	cid.thread_id  = msg->header.client_id.thread_id;
f2a689
f2a689
	toks_log_get_arbitrary_process_name(
f2a689
		&cid,path,sizeof(path));
f2a689
f2a689
	toks_log_header(
f2a689
		dctx,
f2a689
		TOKS_LOG_ENTRY_SERVER_INFO,
f2a689
		"LPC request from %s (syspid %d, systid %d), "
f2a689
		"data_size=%u, msg_size=%u, "
f2a689
		"msg_type=%u, msg_id=%u\n",
f2a689
		toks_log_basename(path),
f2a689
		cid.process_id,
f2a689
		cid.thread_id,
f2a689
		msg->header.data_size,
f2a689
		msg->header.msg_size,
f2a689
		msg->header.msg_type,
f2a689
		msg->header.msg_id);
f2a689
f2a689
	if (cid.process_id)
f2a689
		toks_log_write(
f2a689
			dctx,
f2a689
			TOKS_LOG_ENTRY_SUB_LEVEL_2,
f2a689
			"%s.\n",path);
f2a689
}