/* * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ /* -------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * , , * wrote this file. As long as you retain this notice you can do whatever you * want with this stuff. If you meet any of us some day, and you think this * stuff is worth it, you can buy us a beer in return. - The sys-clk authors * -------------------------------------------------------------------------- */ #pragma once #ifdef __cplusplus extern "C" { #endif #include #define IPC_SERVER_EXT_RESPONSE_MAX_DATA_SIZE (0x100 - 0x10 - sizeof(IpcServerRawHeader)) typedef struct { u64 magic; union { u64 cmdId; u64 result; }; } IpcServerRawHeader; typedef struct { SmServiceName srvName; Handle handles[MAX_WAIT_OBJECTS]; u32 max; u32 count; } IpcServer; typedef struct { u64 cmdId; void *ptr; size_t size; } IpcServerRequestData; typedef struct { HipcParsedRequest hipc; IpcServerRequestData data; } IpcServerRequest; typedef Result (*IpcServerRequestHandler)(void *userdata, const IpcServerRequest *r, u8 *out_data, size_t *out_dataSize); Result ipcServerInit(IpcServer *server, const char *name, u32 max_sessions); Result ipcServerExit(IpcServer *server); Result ipcServerProcess(IpcServer *server, IpcServerRequestHandler handler, void *userdata); Result ipcServerParseCommand(const IpcServerRequest *r, size_t *out_datasize, void **out_data, u64 *out_cmd); #ifdef __cplusplus } #endif