X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=doc%2Fdeveloper%2Fhooks.rst;h=10fe6b9c43605b656e94978a6df37455128eec61;hb=81af03178b7ee8fa772a0707f2cb5166a1d80f61;hp=0afa297aa713b4f6db09e40af9b2e6b35dc2d4de;hpb=d1890d041eae5a4c389321053a1328a277726945;p=mirror_frr.git diff --git a/doc/developer/hooks.rst b/doc/developer/hooks.rst index 0afa297aa..10fe6b9c4 100644 --- a/doc/developer/hooks.rst +++ b/doc/developer/hooks.rst @@ -6,32 +6,32 @@ Hooks Libfrr provides type-safe subscribable hook points where other pieces of code can add one or more callback functions. "type-safe" in this case applies to the function pointers used for subscriptions. The -implementations checks (at compile-time) wheter a callback to be added has +implementations checks (at compile-time) whether a callback to be added has the appropriate function signature (parameters) for the hook. Example: .. code-block:: c - :caption: mydaemon.h + :caption: mydaemon.h - #include "hook.h" - DECLARE_HOOK(some_update_event, (struct eventinfo *info), (info)) + #include "hook.h" + DECLARE_HOOK(some_update_event, (struct eventinfo *info), (info)) .. code-block:: c - :caption: mydaemon.c + :caption: mydaemon.c - #include "mydaemon.h" - DEFINE_HOOK(some_update_event, (struct eventinfo *info), (info)) - ... - hook_call(some_update_event, info); + #include "mydaemon.h" + DEFINE_HOOK(some_update_event, (struct eventinfo *info), (info)) + ... + hook_call(some_update_event, info); .. code-block:: c - :caption: mymodule.c + :caption: mymodule.c - #include "mydaemon.h" - static int event_handler(struct eventinfo *info); - ... - hook_register(some_update_event, event_handler); + #include "mydaemon.h" + static int event_handler(struct eventinfo *info); + ... + hook_register(some_update_event, event_handler); Do not use parameter names starting with "hook", these can collide with names used by the hook code itself.