BRL-CAD
Loading...
Searching...
No Matches
pkg_conn Struct Reference

#include <pkg.h>

Collaboration diagram for pkg_conn:
[legend]

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_switchpkc_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
 
voidpkc_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
 
charpkc_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
 
charpkc_buf
 start of dynamic buf
 
charpkc_curpos
 current position in pkg_buf
 
voidpkc_server_data
 used to hold server data for callbacks
 
voidpkc_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)
 

Detailed Description

Definition at line 81 of file pkg.h.

Field Documentation

◆ pkc_fd

int pkc_fd

TCP connection fd.

Definition at line 82 of file pkg.h.

◆ pkc_in_fd

int pkc_in_fd

input fd for split-fd (pipe) transports

Definition at line 83 of file pkg.h.

◆ pkc_out_fd

int pkc_out_fd

output fd for split-fd (pipe) transports

Definition at line 84 of file pkg.h.

◆ pkc_switch

const struct pkg_switch* pkc_switch

Array of message handlers.

Definition at line 86 of file pkg.h.

◆ pkc_errlog

pkg_errlog pkc_errlog

Error message logger.

Definition at line 87 of file pkg.h.

◆ pkc_hdr

struct pkg_header pkc_hdr

hdr of cur msg

Definition at line 88 of file pkg.h.

◆ pkc_len

size_t pkc_len

pkg_len, in host order

Definition at line 89 of file pkg.h.

◆ pkc_type

unsigned short pkc_type

pkg_type, in host order

Definition at line 90 of file pkg.h.

◆ pkc_user_data

void* pkc_user_data

User defined pointer to data for the current pkg_type.

Definition at line 91 of file pkg.h.

◆ pkc_stream

char pkc_stream[PKG_STREAMLEN]

output stream

Definition at line 93 of file pkg.h.

◆ pkc_magic

unsigned int pkc_magic

for validating pointers

Definition at line 94 of file pkg.h.

◆ pkc_strpos

int pkc_strpos

index into stream buffer

Definition at line 95 of file pkg.h.

◆ pkc_inbuf

char* pkc_inbuf

input stream buffer

Definition at line 97 of file pkg.h.

◆ pkc_incur

int pkc_incur

current pos in inbuf

Definition at line 98 of file pkg.h.

◆ pkc_inend

int pkc_inend

first unused pos in inbuf

Definition at line 99 of file pkg.h.

◆ pkc_inlen

int pkc_inlen

length of pkc_inbuf

Definition at line 100 of file pkg.h.

◆ pkc_left

int pkc_left

# bytes pkg_get expects

Definition at line 102 of file pkg.h.

◆ pkc_buf

char* pkc_buf

start of dynamic buf

Definition at line 104 of file pkg.h.

◆ pkc_curpos

char* pkc_curpos

current position in pkg_buf

Definition at line 105 of file pkg.h.

◆ pkc_server_data

void* pkc_server_data

used to hold server data for callbacks

Definition at line 106 of file pkg.h.

◆ pkc_tls_ctx

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.

Definition at line 126 of file pkg.h.

◆ pkc_tls_read

ptrdiff_t(* pkc_tls_read) (void *ctx, void *buf, size_t n)

TLS read callback; NULL = use raw fd.

Definition at line 127 of file pkg.h.

◆ pkc_tls_write

ptrdiff_t(* pkc_tls_write) (void *ctx, const void *buf, size_t n)

TLS write callback; NULL = use raw fd.

Definition at line 128 of file pkg.h.

◆ pkc_tls_free

void(* pkc_tls_free) (void *ctx)

called by pkg_close() to free TLS state

Definition at line 129 of file pkg.h.

◆ pkc_addr

char pkc_addr[128]

transport address string (populated by future phases)

Definition at line 130 of file pkg.h.

◆ pkc_addr_env

char pkc_addr_env[160]

PKG_ADDR=... env string for child spawn (future phases)

Definition at line 131 of file pkg.h.

◆ pkc_tx_kind

int pkc_tx_kind

transport kind: 0=socket/TCP, 1=pipe pair

Definition at line 132 of file pkg.h.

◆ pkc_listen_fd

int pkc_listen_fd

listening socket fd for lazy-accept (TCP, future phases)

Definition at line 133 of file pkg.h.


The documentation for this struct was generated from the following file: