#include <assert.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include "nvim/ascii.h"
#include "nvim/eval.h"
#include "nvim/event/socket.h"
#include "nvim/fileio.h"
#include "nvim/garray.h"
#include "nvim/log.h"
#include "nvim/main.h"
#include "nvim/memory.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/server.h"
#include "nvim/os/os.h"
#include "nvim/path.h"
#include "nvim/strings.h"
#include "nvim/vim.h"
Macros | |
#define | MAX_CONNECTIONS 32 |
#define | ENV_LISTEN "NVIM_LISTEN_ADDRESS" |
#define | ENV_NVIM "NVIM" |
Functions | |
bool | server_init (const char *listen_addr) |
Initializes the module. More... | |
void | server_teardown (void) |
Teardown the server module. More... | |
char * | server_address_new (void) |
bool | server_owns_pipe_address (const char *path) |
int | server_start (const char *endpoint) |
bool | server_stop (char *endpoint) |
char ** | server_address_list (size_t *size) FUNC_ATTR_NONNULL_ALL |
#define ENV_LISTEN "NVIM_LISTEN_ADDRESS" |
#define ENV_NVIM "NVIM" |
#define MAX_CONNECTIONS 32 |
char** server_address_list | ( | size_t * | size | ) |
Returns an allocated array of server addresses.
[out] | size | The size of the returned array. |
char* server_address_new | ( | void | ) |
Generates unique address for local server.
In Windows this is a named pipe in the format \.\pipe\nvim-<PID>-<COUNTER>.
For other systems it is a path returned by vim_tempname().
This function is NOT thread safe
bool server_init | ( | const char * | listen_addr | ) |
Initializes the module.
bool server_owns_pipe_address | ( | const char * | path | ) |
Check if this instance owns a pipe address. The argument must already be resolved to an absolute path!
int server_start | ( | const char * | endpoint | ) |
Starts listening for API calls.
The socket type is determined by parsing endpoint
: If it's a valid IPv4 or IPv6 address in 'ip:[port]' format, then it will be a TCP socket. Otherwise it will be a Unix socket or named pipe (Windows).
If no port is given, a random one will be assigned.
endpoint | Address of the server. Either a 'ip:[port]' string or an arbitrary identifier (trimmed to 256 bytes) for the Unix socket or named pipe. |
bool server_stop | ( | char * | endpoint | ) |
Stops listening on the address specified by endpoint
.
endpoint | Address of the server. |