feat(config-repl): add raw capnp shims for OP_replConfig wire protocol
xce_replconfig_reply_raw() - primary sends reply with real bytes via endpoint xce_replconfig_req_ssl() - standby sends request over raw SSL socket xce_replconfig_reply_ssl_decode() - standby decodes reply from raw SSL xce_upgrade_config_req_extract() - documents architectural limitation; returns -ENOTSUP xce_upgrade_config_req_extract_raw() - extract bytes from raw packet for OP_upgradeConfig Same bypass pattern as existing xce_replconfigpush_req_raw(): build the capnp message directly via capn_new_list8 + capn_setv8, sidestepping the encode_Data_ptr path that routes raw bytes through xce_data_t (a discriminated cluster-data union that cannot carry raw byte arrays). Unblocks handle_config_request() and do_one_config_fetch() wiring. Task A research finding: xce_upgrade_config_req_extract(xce_request_t*) is unimplementable because xce_decode() calls capn_free() before any handler runs, and decode_Data_ptr converts the wire-format List(UInt8) into a zero-filled xce_data_t. Task D must capture the raw io_packet_t bytes before xce_decode tears them down, then call the _raw variant.
This commit is contained in:
parent
f3babec5bc
commit
26393e919c
3 changed files with 848 additions and 0 deletions
|
|
@ -6,6 +6,8 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
#include "netio.h"
|
||||
#include "typemap.h"
|
||||
#include "utils.h"
|
||||
|
|
@ -71,4 +73,56 @@ extern int xce_replconfigpush_req_raw(endpoint_t *ep, xce_peerinfo_t *from,
|
|||
const uint8_t *config_bytes,
|
||||
size_t config_len);
|
||||
|
||||
/*
|
||||
* xce_replconfig_reply_raw: primary sends an OP_replConfig reply with
|
||||
* actual config bytes via endpoint (iomgr queued). Bypasses
|
||||
* encode_ReplConfigReply_ptr (which maps sha256/bytes through xce_data_t).
|
||||
*/
|
||||
extern int xce_replconfig_reply_raw(endpoint_t *ep, xce_peerinfo_t *from,
|
||||
uint64_t seq, uint64_t tag,
|
||||
const uint8_t *sha256, size_t sha256_len,
|
||||
const uint8_t *config, size_t config_len);
|
||||
|
||||
/*
|
||||
* xce_replconfig_req_ssl: standby sends OP_replConfig over a raw SSL
|
||||
* socket (no iomgr). Wire framing: uint64_t size + capnp payload
|
||||
* (matches netio.c io_fsm_perform).
|
||||
*/
|
||||
extern int xce_replconfig_req_ssl(SSL *ssl, uint64_t version_tag);
|
||||
|
||||
/*
|
||||
* xce_replconfig_reply_ssl_decode: standby reads + parses an
|
||||
* OP_replConfig reply from a raw SSL socket. Output buffers are
|
||||
* malloc'd and owned by the caller. Both *out_sha256 and *out_bytes
|
||||
* may be NULL on the up_to_date == 1 fast path.
|
||||
*/
|
||||
extern int xce_replconfig_reply_ssl_decode(SSL *ssl,
|
||||
int *out_up_to_date,
|
||||
uint64_t *out_tag,
|
||||
uint8_t **out_sha256,
|
||||
uint8_t **out_bytes,
|
||||
size_t *out_len);
|
||||
|
||||
/*
|
||||
* xce_upgrade_config_req_extract: extract bytes from a decoded
|
||||
* OP_upgradeConfig request. Returns -ENOTSUP — see request.c
|
||||
* for the architectural finding. Use xce_upgrade_config_req_extract_raw
|
||||
* with the raw packet buffer instead.
|
||||
*/
|
||||
extern int xce_upgrade_config_req_extract(const xce_request_t *req,
|
||||
uint8_t **out_bytes,
|
||||
size_t *out_len,
|
||||
uint8_t **out_sha256);
|
||||
|
||||
/*
|
||||
* xce_upgrade_config_req_extract_raw: parse OP_upgradeConfig request
|
||||
* bytes from a raw on-wire packet buffer. Output buffers (*out_bytes,
|
||||
* *out_sha256) are malloc'd and owned by the caller.
|
||||
*/
|
||||
extern int xce_upgrade_config_req_extract_raw(const uint8_t *pkt_data,
|
||||
size_t pkt_sz,
|
||||
uint8_t **out_bytes,
|
||||
size_t *out_len,
|
||||
uint8_t **out_sha256);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue