Port RPC interface introduced.

Usage:
1. Register handlers in incoming port with nxt_port_rpc_register_handler().
2. Use return value as a stream identifier for next nxt_port_socket_write().
This commit is contained in:
Max Romanov
2017-08-02 13:14:31 +03:00
parent 3812ffd336
commit f2e9afdf42
9 changed files with 369 additions and 0 deletions

24
src/nxt_port_rpc.h Normal file
View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) Max Romanov
* Copyright (C) NGINX, Inc.
*/
#ifndef _NXT_PORT_RPC_H_INCLUDED_
#define _NXT_PORT_RPC_H_INCLUDED_
typedef void (*nxt_port_rpc_handler_t)(nxt_task_t *task,
nxt_port_recv_msg_t *msg, void *data);
uint32_t nxt_port_rpc_register_handler(nxt_task_t *task, nxt_port_t *port,
nxt_port_rpc_handler_t ready_handler, nxt_port_rpc_handler_t error_handler,
nxt_pid_t peer, void *data);
void nxt_port_rpc_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
void nxt_port_rpc_remove_peer(nxt_task_t *task, nxt_port_t *port,
nxt_pid_t peer);
void nxt_port_rpc_cancel(nxt_task_t *task, nxt_port_t *port, uint32_t stream);
#endif /* _NXT_PORT_RPC_H_INCLUDED_ */