|
BRL-CAD
|
This header holds generic routines and data structures used for TCP based (and, via libpkg, local-IPC based) communication between a framebuffer and a remote process. Variations on this logic, based originally on the stand-alone fbserv program, are at the core of MGED and Archer's ability to display incoming image data from a separate rt process. More...
Go to the source code of this file.
Data Structures | |
| struct | fbserv_listener |
| struct | fbserv_client |
| struct | fbserv_obj |
Macros | |
| #define | NET_LONG_LEN 4 |
| # bytes to network long | |
| #define | MAX_CLIENTS 32 |
| #define | MAX_PORT_TRIES 100 |
| #define | FBS_CALLBACK_NULL (void (*)(void))NULL |
| #define | FBSERV_OBJ_NULL (struct fbserv_obj *)NULL |
Functions | |
| int | fbs_open (struct fbserv_obj *fbsp, int port) |
| int | fbs_close (struct fbserv_obj *fbsp) |
| struct pkg_switch * | fbs_pkg_switch (void) |
| void | fbs_setup_socket (int fd) |
| int | fbs_new_client (struct fbserv_obj *fbsp, struct pkg_conn *pcp, void *data) |
| void | fbs_existing_client_handler (void *clientData, int mask) |
| int | fbs_open_ipc (struct fbserv_obj *fbsp) |
| Open an IPC-based framebuffer server (no TCP listen socket). | |
| const char * | fbs_ipc_child_addr_env (struct fbserv_obj *fbsp) |
| Return the "PKG_ADDR=<addr>" env string for the spawned child. | |
| const char * | fbs_generate_token (struct fbserv_obj *fbsp) |
This header holds generic routines and data structures used for TCP based (and, via libpkg, local-IPC based) communication between a framebuffer and a remote process. Variations on this logic, based originally on the stand-alone fbserv program, are at the core of MGED and Archer's ability to display incoming image data from a separate rt process.
Asynchronous interprocess communication and event monitoring is (as of 2021) still very much platform and toolkit specific. Hence, these data structures contain some void pointers which are used by individual applications to connect their own specific methods (for example, Tcl_Channel) to handle this problem. Improving this to be more generic and less dependent on specific toolkits and/or platform mechanisms would be a laudable goal, if practical.
pkg IPC path (fbs_open_ipc): Instead of binding a TCP listen socket, creates a pkg_pair() and immediately wraps the parent end as a pre-connected pkg_conn client. The child-end address is retrieved via fbs_ipc_child_addr_env() and passed to the spawned rt subprocess via the PKG_ADDR environment variable (set with bu_setenv() before the fork, cleared after).
Definition in file fbserv.h.