maskit opened a new pull request, #13338:
URL: https://github.com/apache/trafficserver/pull/13338

   ## Summary
   
   Reduces per-connection memory work in the `jax_fingerprint` plugin and makes 
the set of compiled-in fingerprint methods a configure-time choice.
   
   - **ContextMap** is now an inline fixed-size table of `(method-name, 
JAxContext*)` pairs, replacing the `std::unordered_map<std::string, 
JAxContext*>` used previously. Lookup is a short linear scan; the bucket array 
and node allocations that the map performed on every TLS connection are gone.
   
   - **`set_fingerprint`** takes `std::string_view`, dropping the temporary 
`std::string` that was materialised at every call site purely to bind a `const 
std::string &` parameter.
   
   - **`ENABLE_JAX_METHODS`** is a new CMake cache variable (default 
`"ja3;ja4;ja4h"`) that drives, from a single list:
     - which method subdirectories contribute sources to the plugin and to 
`test_jax`,
     - which `ENABLE_JAX_METHOD_<NAME>` preprocessor defines are set, and
     - the value of `JAX_FINGERPRINT_MAX_METHODS` (the inline context-table 
size, derived from the list length).
   
     Build slim: `cmake -B build -DENABLE_JAX_METHODS="ja4"`. Empty list or 
unknown directory name causes a `FATAL_ERROR` at configure time.
   
   - **`plugin.cc`** dispatcher is now a `constexpr` table of `Method const *` 
entries, each gated by the per-method `ENABLE_JAX_METHOD_*` macro. The 
dispatcher and the method `#include`s are the only place in the plugin that 
names concrete methods; `method.h` stays method-agnostic.
   
   - **`README`** in the plugin directory documents the per-method file layout, 
the build-time switches, and the file-naming rules the CMake glob relies on 
(including the `tls_client_hello_summary.cc` historical carve-out and how to 
handle similar cases going forward).
   
   ## Test plan
   
   - [x] `cmake --build my-b-bssl -t jax_fingerprint` — default 
(`ja3;ja4;ja4h`) builds cleanly.
   - [x] `cmake --build my-b-bssl -t test_jax` and run `test_jax` — 67 
assertions across 5 Catch2 test cases pass.
   - [x] `cmake --build my-b-bssl -t format` — clang-format / cmake-format 
clean.
   - [x] AuTest `jax_fingerprint*` passes against the installed plugin.
   - [x] Slim build: `cmake -B my-b-bssl -DENABLE_JAX_METHODS="ja4"` — only 
`ja4/*.cc` compiled into the plugin.
   - [x] Negative configure paths: `-DENABLE_JAX_METHODS=""` and 
`-DENABLE_JAX_METHODS="ja99"` both fail at configure time with the intended 
messages.
   
   ## Notes for reviewers
   
   - `ContextMap` keys are `std::string_view`s that alias `Method::name` (which 
is itself a `string_view` pointing at a string literal). The slot table stays 
valid as long as the `Method` struct does, i.e. for the lifetime of the process.
   - The plugin's other lookup against a heterogeneous-lookup hash (the SNI 
server-name set in `plugin.cc`) is unchanged. The 
`__cpp_lib_generic_unordered_lookup` `#ifdef` there is still needed and is 
unrelated to ContextMap.
   - `JAX_FINGERPRINT_MAX_METHODS` is not a separate user knob; CMake derives 
it from the length of `ENABLE_JAX_METHODS`. The `#ifndef ... #define ... 8` in 
`context_map.h` is a fallback so the header is valid when compiled standalone 
(e.g. IDE indexing). A `static_assert` in `context_map.h` enforces a minimum of 
1, and `set()` `TSReleaseAssert`s on overflow.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to