|
BRL-CAD
|
#include <pkg.h>
Data Fields | |
| int | pkc_fd |
| TCP connection fd. | |
| int | pkc_in_fd |
| input fd for split-fd (pipe) transports | |
| int | pkc_out_fd |
| output fd for split-fd (pipe) transports | |
| const struct pkg_switch * | pkc_switch |
| Array of message handlers. | |
| pkg_errlog | pkc_errlog |
| Error message logger. | |
| struct pkg_header | pkc_hdr |
| hdr of cur msg | |
| size_t | pkc_len |
| pkg_len, in host order | |
| unsigned short | pkc_type |
| pkg_type, in host order | |
| void * | pkc_user_data |
| User defined pointer to data for the current pkg_type. | |
| char | pkc_stream [PKG_STREAMLEN] |
| output stream | |
| unsigned int | pkc_magic |
| for validating pointers | |
| int | pkc_strpos |
| index into stream buffer | |
| char * | pkc_inbuf |
| input stream buffer | |
| int | pkc_incur |
| current pos in inbuf | |
| int | pkc_inend |
| first unused pos in inbuf | |
| int | pkc_inlen |
| length of pkc_inbuf | |
| int | pkc_left |
| # bytes pkg_get expects | |
| char * | pkc_buf |
| start of dynamic buf | |
| char * | pkc_curpos |
| current position in pkg_buf | |
| void * | pkc_server_data |
| used to hold server data for callbacks | |
| void * | pkc_tls_ctx |
| opaque TLS state (e.g. SSL *) | |
| ptrdiff_t(* | pkc_tls_read )(void *ctx, void *buf, size_t n) |
| TLS read callback; NULL = use raw fd. | |
| ptrdiff_t(* | pkc_tls_write )(void *ctx, const void *buf, size_t n) |
| TLS write callback; NULL = use raw fd. | |
| void(* | pkc_tls_free )(void *ctx) |
| called by pkg_close() to free TLS state | |
| char | pkc_addr [128] |
| transport address string (populated by future phases) | |
| char | pkc_addr_env [160] |
| PKG_ADDR=... env string for child spawn (future phases) | |
| int | pkc_tx_kind |
| transport kind: 0=socket/TCP, 1=pipe pair | |
| int | pkc_listen_fd |
| listening socket fd for lazy-accept (TCP, future phases) | |
| const struct pkg_switch* pkc_switch |
| pkg_errlog pkc_errlog |
| struct pkg_header pkc_hdr |
| void* pkc_user_data |
| char pkc_stream[PKG_STREAMLEN] |
| void* pkc_tls_ctx |
opaque TLS state (e.g. SSL *)
Pluggable I/O layer for TLS (or any other stream cipher / framing).
When pkc_tls_read / pkc_tls_write are non-NULL they completely replace the raw fd reads/writes inside pkg_suckin(), pkg_send(), pkg_2send(), and pkg_flush(). pkc_tls_ctx is the opaque context pointer forwarded as the first argument to both callbacks.
pkc_tls_free (if non-NULL) is called by pkg_close() before closing the socket, giving the TLS layer a chance to send a clean close_notify and free its own state.
All four fields are zero-initialized by _pkg_makeconn().
The callback signatures use ptrdiff_t (always defined via <stddef.h>) rather than ssize_t to avoid POSIX-only header dependencies in this public header.
called by pkg_close() to free TLS state
| char pkc_addr[128] |
| char pkc_addr_env[160] |
| int pkc_listen_fd |