channel_defs.h (901B)
1 #pragma once 2 3 #include <stdbool.h> 4 #include <uv.h> 5 6 #include "nvim/api/private/dispatch.h" 7 #include "nvim/map_defs.h" 8 #include "nvim/ui_defs.h" 9 10 typedef struct Channel Channel; 11 typedef struct Unpacker Unpacker; 12 13 typedef enum { 14 kClientTypeUnknown = -1, 15 kClientTypeRemote = 0, 16 kClientTypeMsgpackRpc = 5, 17 kClientTypeUi = 1, 18 kClientTypeEmbedder = 2, 19 kClientTypeHost = 3, 20 kClientTypePlugin = 4, 21 } ClientType; 22 23 typedef struct { 24 uint32_t request_id; 25 bool returned, errored; 26 Object result; 27 ArenaMem result_mem; 28 } ChannelCallFrame; 29 30 typedef struct { 31 MessageType type; 32 Channel *channel; 33 MsgpackRpcRequestHandler handler; 34 Array args; 35 uint32_t request_id; 36 Arena used_mem; 37 } RequestEvent; 38 39 typedef struct { 40 bool closed; 41 Unpacker *unpacker; 42 RemoteUI *ui; 43 uint32_t next_request_id; 44 kvec_t(ChannelCallFrame *) call_stack; 45 Dict info; 46 ClientType client_type; 47 } RpcState;