github.com/igggame/nebulas-go@v2.1.0+incompatible/nbre/util/controller.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  #pragma once
    21  #include "common/common.h"
    22  #include "core/net_ipc/nipc_pkg.h"
    23  #include <ff/network.h>
    24  
    25  enum controller_pkg_type {
    26    ctl_kill_req_pkg = nipc_last_pkg_id,
    27  
    28    ctl_last_pkg_id,
    29  };
    30  
    31  namespace neb {
    32  namespace util {
    33  
    34  typedef ff::net::ntpackage<ctl_kill_req_pkg> ctl_kill_req_t;
    35  
    36  class elfin {
    37  public:
    38    void run();
    39  
    40  protected:
    41    void handle_kill_req();
    42  };
    43  
    44  class magic_wand {
    45  public:
    46    void kill_nbre();
    47  
    48  protected:
    49    void start_and_join();
    50  
    51  protected:
    52    std::shared_ptr<ff::net::package> m_package;
    53  };
    54  
    55  } // namespace util
    56  } // namespace neb
    57