ConnKey: Extend DoPopulateConnIdVal() with ctx

This prepares the move where ConnKey implementations should fill out
ctx rather than filling conn_id directly. The API continues to receive
both, conn_id and ctx, as adding fields to `conn_id` is reasonable
use-case even if it's just for logging purposes.
This commit is contained in:
Arne Welzel 2025-06-27 14:02:31 +02:00
parent 112e3c1c03
commit b7a22a87c6
7 changed files with 48 additions and 22 deletions

View file

@ -230,9 +230,10 @@ const RecordValPtr& Connection::GetVal() {
id_val->Assign(2, make_intrusive<AddrVal>(resp_addr));
id_val->Assign(3, val_mgr->Port(ntohs(resp_port), prot_type));
id_val->Assign(4, KeyProto());
auto* ctx = id_val->GetFieldAs<zeek::RecordVal>(5);
// Allow customized ConnKeys to augment the conn_id:
key->PopulateConnIdVal(*id_val);
// Allow customized ConnKeys to augment conn_id and ctx.
key->PopulateConnIdVal(*id_val, *ctx);
auto orig_endp = make_intrusive<RecordVal>(id::endpoint);
orig_endp->Assign(0, 0);