aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/msgpack_rpc/channel_defs.h
blob: de328af1ce38d19b9cefa92549cf06be504b8017 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef NVIM_MSGPACK_RPC_CHANNEL_DEFS_H
#define NVIM_MSGPACK_RPC_CHANNEL_DEFS_H

#include <stdbool.h>
#include <uv.h>
#include <msgpack.h>

#include "nvim/api/private/defs.h"
#include "nvim/event/socket.h"
#include "nvim/event/process.h"
#include "nvim/vim.h"

typedef struct Channel Channel;

typedef struct {
  uint32_t request_id;
  bool returned, errored;
  Object result;
} ChannelCallFrame;

typedef struct {
  MessageType type;
  Channel *channel;
  MsgpackRpcRequestHandler handler;
  Array args;
  uint32_t request_id;
} RequestEvent;

typedef struct {
  PMap(cstr_t) subscribed_events[1];
  bool closed;
  msgpack_unpacker *unpacker;
  uint32_t next_request_id;
  kvec_t(ChannelCallFrame *) call_stack;
  Dictionary info;
} RpcState;

#endif  // NVIM_MSGPACK_RPC_CHANNEL_DEFS_H