github.com/igggame/nebulas-go@v2.1.0+incompatible/nbre/core/neb_ipc/ipc_interface.h (about)

     1  // Copyright (C) 2018 go-nebulas authors
     2  //
     3  // This file is part of the go-nebulas library.
     4  //
     5  // the go-nebulas library is free software: you can redistribute it and/or
     6  // modify
     7  // it under the terms of the GNU General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // (at your option) any later version.
    10  //
    11  // the go-nebulas library is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU General Public License
    17  // along with the go-nebulas library.  If not, see
    18  // <http://www.gnu.org/licenses/>.
    19  //
    20  #ifndef NBRE_CORE_NEB_IPC_IPC_INTERFACE_H_
    21  #define NBRE_CORE_NEB_IPC_IPC_INTERFACE_H_
    22  #ifdef __cplusplus
    23  #include <cstdint>
    24  extern "C" {
    25  #else
    26  #include <stdint.h>
    27  #endif
    28  
    29  enum ipc_status_code {
    30    ipc_status_succ = 0,
    31    ipc_status_fail,
    32    ipc_status_timeout,
    33    ipc_status_exception,
    34    ipc_status_nbre_not_ready,
    35  };
    36  
    37  // interface get nbre version
    38  int ipc_nbre_version(void *holder, uint64_t height);
    39  typedef void (*nbre_version_callback_t)(enum ipc_status_code isc, void *holder,
    40                                          uint32_t major, uint32_t minor,
    41                                          uint32_t patch);
    42  void set_recv_nbre_version_callback(nbre_version_callback_t func);
    43  
    44  // interface get nbre ir list
    45  int ipc_nbre_ir_list(void *holder);
    46  typedef void (*nbre_ir_list_callback_t)(enum ipc_status_code isc, void *holder,
    47                                          const char *ir_name_list);
    48  void set_recv_nbre_ir_list_callback(nbre_ir_list_callback_t func);
    49  
    50  // interface get ir version list
    51  int ipc_nbre_ir_versions(void *holder, const char *ir_name);
    52  typedef void (*nbre_ir_versions_callback_t)(enum ipc_status_code isc,
    53                                              void *holder,
    54                                              const char *ir_versions);
    55  void set_recv_nbre_ir_versions_callback(nbre_ir_versions_callback_t func);
    56  
    57  // interface get nr handler
    58  int ipc_nbre_nr_handler(void *holder, uint64_t start_block, uint64_t end_block,
    59                          uint64_t nr_version);
    60  typedef void (*nbre_nr_handler_callback_t)(enum ipc_status_code isc,
    61                                             void *holder,
    62                                             const char *nr_handler);
    63  void set_recv_nbre_nr_handler_callback(nbre_nr_handler_callback_t func);
    64  
    65  // interface get nr result
    66  int ipc_nbre_nr_result(void *holder, const char *nr_handler);
    67  typedef void (*nbre_nr_result_callback_t)(enum ipc_status_code isc,
    68                                            void *holder, const char *nr_result);
    69  void set_recv_nbre_nr_result_callback(nbre_nr_result_callback_t func);
    70  
    71  // interface get dip reward
    72  int ipc_nbre_dip_reward(void *holder, uint64_t height, uint64_t version);
    73  typedef void (*nbre_dip_reward_callback_t)(enum ipc_status_code isc,
    74                                             void *holder,
    75                                             const char *dip_reward);
    76  void set_recv_nbre_dip_reward_callback(nbre_dip_reward_callback_t func);
    77  
    78  typedef struct {
    79    const char *m_nbre_root_dir;
    80    const char *m_nbre_exe_name;
    81    const char *m_neb_db_dir;
    82    const char *m_nbre_db_dir;
    83    const char *m_nbre_log_dir;
    84    const char *m_admin_pub_addr;
    85    uint64_t m_nbre_start_height;
    86  } nbre_params_t;
    87  
    88  // nbre ipc start and shutdown
    89  int start_nbre_ipc(const nbre_params_t params);
    90  
    91  void nbre_ipc_shutdown();
    92  
    93  #ifdef __cplusplus
    94  }
    95  #endif
    96  
    97  #endif