summaryrefslogtreecommitdiff
path: root/ndb/include/mgmcommon/IPCConfig.hpp
blob: 8e8b99eda73c586076d8cc3ec797d04100f41dc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Copyright (C) 2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#ifndef IPCConfig_H
#define IPCConfig_H

#include <ndb_types.h>
#include <ndb_limits.h>
#include <kernel_types.h>
#include <Properties.hpp>

/**
 * @class IPCConfig
 * @brief Config transporters in TransporterRegistry using Properties config
 */
class IPCConfig 
{
public:
  IPCConfig(Properties * props);
  ~IPCConfig();

  /** @return 0 for OK */
  int init(); 
  
  NodeId ownId() const;
  
  /** @return No of transporters configured */
  int configureTransporters(class TransporterRegistry * theTransporterRegistry);

  /**
   * Supply a nodeId,
   *  and get next higher node id
   * @return false if none found, true otherwise
   *
   * getREPHBFrequency and getNodeType uses the last Id supplied to 
   * getNextRemoteNodeId.
   */
  bool getNextRemoteNodeId(NodeId & nodeId) const;
  Uint32 getREPHBFrequency(NodeId id) const;
  const char* getNodeType(NodeId id) const;
  
  NodeId getNoOfRemoteNodes() const {
    return theNoOfRemoteNodes;
  }

  void print() const { props->print(); }

  static Uint32 configureTransporters(Uint32 nodeId,
				      const struct ndb_mgm_configuration &,
				      class TransporterRegistry &);
  
private:
  NodeId        the_ownId;
  Properties *  props;
  
  bool    addRemoteNodeId(NodeId nodeId);
  NodeId  theNoOfRemoteNodes;
  NodeId  theRemoteNodeIds[MAX_NODES];
};

inline 
NodeId 
IPCConfig::ownId() const
{
  return the_ownId;
}



#endif // IPCConfig_H