root/maint/mocked/based.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright 2019-2020 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * Licensed under the GNU General Public License version 2 or later (GPLv2+).
   7  */
   8 
   9 #pragma once
  10 
  11 #include <stdlib.h>  /* size_t */
  12 #include <stdbool.h>  /* bool */
  13 
  14 #include <crm/common/ipc_internal.h>  /* pcmk__client_t */
  15 
  16 
  17 struct module_s;
  18 
  19 typedef struct mock_based_context_s {
  20     size_t modules_cnt;
  21     struct module_s** modules;
  22 } mock_based_context_t;
  23 
  24 
  25 typedef int (*mock_based_argparse_hook)(mock_based_context_t *,
  26                                         bool, int,
  27                                         const char *[]);
  28 
  29 typedef void (*mock_based_destroy_hook)(struct module_s *);
  30 
  31 /* specialized callbacks... */
  32 typedef void (*mock_based_cib_notify_hook)(pcmk__client_t *);
  33 
  34 typedef struct mock_based_hooks_s {
  35     /* generic ones */
  36     mock_based_argparse_hook argparse;
  37     mock_based_destroy_hook destroy;
  38 
  39     /* specialized callbacks... */
  40     mock_based_cib_notify_hook cib_notify;
  41 } mock_based_hooks_t;
  42 
  43 typedef struct module_s {
  44     char shortopt;
  45     mock_based_hooks_t hooks;
  46     void *priv;
  47 } module_t;
  48 
  49 size_t mock_based_register_module(module_t mod);

/* [previous][next][first][last][top][bottom][index][help] */