From b29778a9d2d575013cd9621fc9349d85ffa14754 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 19 Apr 2018 07:01:09 -0600 Subject: [PATCH] Add Command Type to IpcParsedCommand --- nx/include/switch/kernel/ipc.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nx/include/switch/kernel/ipc.h b/nx/include/switch/kernel/ipc.h index 6078db89..83bc08e8 100644 --- a/nx/include/switch/kernel/ipc.h +++ b/nx/include/switch/kernel/ipc.h @@ -37,6 +37,17 @@ typedef enum { BufferDirection_Exch=2, } BufferDirection; +typedef enum { + IpcCommandType_Invalid = 0, + IpcCommandType_LegacyRequest = 1, + IpcCommandType_Close = 2, + IpcCommandType_LegacyControl = 3, + IpcCommandType_Request = 4, + IpcCommandType_Control = 5, + IpcCommandType_RequestWithContext = 6, + IpcCommandType_ControlWithContext = 7 +} IpcCommandType; + typedef struct { size_t NumSend; // A size_t NumRecv; // B @@ -292,6 +303,8 @@ static inline Result ipcDispatch(Handle session) { /// IPC parsed command (response) structure. typedef struct { + IpcCommandType CommandType; ///< Type of the command + bool HasPid; ///< true if the 'Pid' field is filled out. u64 Pid; ///< PID included in the response (only if HasPid is true) @@ -330,6 +343,7 @@ static inline Result ipcParse(IpcParsedCommand* r) { u32 ctrl1 = *buf++; size_t i; + r->CommandType = (IpcCommandType) (ctrl0 & 0xffff); r->HasPid = false; r->RawSize = (ctrl1 & 0x1ff) * 4; r->NumHandles = 0;