BRL-CAD
Loading...
Searching...
No Matches
fbserv.h File Reference

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...

#include "common.h"
#include "pkg.h"
#include "dm/defines.h"
Include dependency graph for fbserv.h:
This graph shows which files directly or indirectly include this file:

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_switchfbs_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 charfbs_ipc_child_addr_env (struct fbserv_obj *fbsp)
 Return the "PKG_ADDR=<addr>" env string for the spawned child.
 
const charfbs_generate_token (struct fbserv_obj *fbsp)
 

Detailed Description

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.