STRUCT TB_PROTOCOL_HANDLER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ struct tb_protocol_handler(9) πŸ’œ

okay bestie, so this is a page straight out of the Kernel API Manual β€” it's <pink>struct tb_protocol_handler</pink> and it's literally the blueprint for a protocol-specific handler. tiny struct, big job. let's get into it ✨


🌸 NAME 🌸

struct tb_protocol_handler β€” a protocol specific handler, no cap. that's the whole name, that's the whole vibe 🫢


πŸŽ€ SYNOPSIS πŸŽ€

struct tb_protocol_handler {
    const uuid_t *uuid;
    int (*callback)(const void *buf, size_t size, void *data);
    void *data;
    struct list_head list;
 };

look at her. four members. perfectly curated. iconic πŸ’…


πŸ¦‹ Members πŸ¦‹

  • uuid β€” any XDomain messages rockin' this UUID get dispatched to this handler. it's the ✨vibe check✨ that decides who gets the message πŸ’Œ
  • callback β€” the callback that gets called with the XDomain message. here's the tea: if you return 1 in here, you're telling the XDomain core "yep, I got it, message handled by me" and it will not be forwared to other handlers. (yes, that's how the original spells it β€” "forwared" β€” we keep the receipts πŸ’€)
  • data β€” the data that gets passed along with the callback πŸ“
  • list β€” handlers get linked together using this, like a little linked-list friendship bracelet πŸŽ€

🌈 Description 🌈

so Thunderbolt services can absolutely hook into incoming XDomain requests by registering a protocol handler. main character energy fr fr πŸ‘‘

there's only one limitation, and it's lowkey important: the XDomain discovery protocol UUID cannot be registered, because that one's already handled by the core XDomain code. not yours. don't even try it. πŸ™ˆ

also, the callback must check that the message is really directed to the service the driver implements. like, actually check. don't just assume every message is for you, that's not the vibe 😭

⚠️ bestie please read this twice: the discovery UUID is off-limits, and your callback has to verify the message is genuinely for your service. both of these are in the original, both of these matter, and i'm not being dramatic (okay maybe a little) πŸ’…

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./include/linux/thunderbolt.h
  • enum tb_security_level(9)
  • struct tb(9)
  • struct tb_property_dir(9)
  • struct tb_property(9)
  • enum tb_link_width(9)
  • struct tb_xdomain(9)
  • struct tb_service(9)
  • struct tb_service_driver(9)
  • struct tb_nhi(9)
  • struct tb_ring(9)
  • enum ring_desc_flags(9)
  • struct ring_frame(9)
  • tb_ring_rx(9)
  • tb_ring_tx(9)
  • tb_ring_dma_device(9)

go read them all, i'll wait πŸ§šπŸ’–


and that's the whole page, bestie!! this one came from ./include/linux, dated October 2026 β€” so like, freshly stamped, very demure, very mindful. mwah πŸ’‹βœ¨πŸ¦‹

πŸ“¦ where this page comes from