Macros | Functions
server.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <inttypes.h>
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/server.h"
#include "nvim/os/os.h"
#include "nvim/event/socket.h"
#include "nvim/ascii.h"
#include "nvim/eval.h"
#include "nvim/garray.h"
#include "nvim/vim.h"
#include "nvim/main.h"
#include "nvim/memory.h"
#include "nvim/log.h"
#include "nvim/fileio.h"
#include "nvim/path.h"
#include "nvim/strings.h"


#define MAX_CONNECTIONS   32


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

Macro Definition Documentation

#define MAX_CONNECTIONS   32

Function Documentation

char** server_address_list ( size_t *  size)

Returns an allocated array of server addresses.

[out]sizeThe 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 \.-<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.

endpointAddress of the server. Either a 'ip:[port]' string or an arbitrary identifier (trimmed to 256 bytes) for the Unix socket or named pipe.
0: success, 1: validation error, 2: already listening, -errno: failed to bind or listen.
bool server_stop ( char *  endpoint)

Stops listening on the address specified by endpoint.

endpointAddress of the server.
void server_teardown ( void  )

Teardown the server module.