rasdaman complete source
rasmgr_rascontrol.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
36 #ifndef RASMGR_RASCONTROL_HH
37 #define RASMGR_RASCONTROL_HH
38 
39 #include "rasmgr.hh"
40 #include "rasmgr_comm.hh"
41 #include "rasmgr_users.hh"
42 #include "rasmgr_host.hh"
43 
44 
48 class RasControl
49 {
50 public:
51  int processRequest(char* reqMessage, char *answMessage);
52  void setConfigDirty( bool isDirty );
53  void setAuthDirty( bool isDirty );
54 
55 private:
56  void helloCommand();
57  void exitCommand();
58  void helpCommand();
59  void helpHelp();
60  void exitHelp();
61  void listCommand();
62  void listRasServers();
63  void listRasHosts();
64  void listDBHosts();
65  void listDatabases();
66  void listUsers();
67  void listModus();
68  void listVersion();
69  void listConnections();
70  void listRights();
71  void listHelp();
72  void defineCommand();
73  void defineRasServers();
74  void defineRasHosts();
75  void defineDBHosts();
76  void defineDatabases();
77  void defineUsers();
78  void defineHelp();
79  void removeCommand();
80  void removeRasServers();
81  void removeRasHosts();
82  void removeDBHosts();
83  void removeDatabases();
84  void removeUsers();
85  void removeHelp();
86  void checkCommand();
87  void checkRasHosts();
88  void checkHelp();
89  void upCommand();
90  void upRasServers();
91  int upAllServersOnHost(const char*hostName);
92  void upHelp();
93  void downCommand();
94  void downRasServers();
95  int downAllServersOnHost(const char *hostName);
96  void downRasHosts();
97  int downRasHost(const char *hostName);
98  void downHelp();
99  void changeCommand();
100  void changeHost();
101  void changeUser();
102  void changeRasServer();
103  void changeRasServer(const char *serverName, const char *dbhName, const char *countString, const char *extraString, const char *autoRestart, const char* execName);
104  void changeDBHost();
105  void changeDB();
106  void changeHelp();
107  void saveCommand();
108  void saveHelp();
109  // void stopCommand();
110  void resetCommand();
111 
112  void grantCommand();
113  void revokeCommand();
114 
115  // flag whether conf or auth file must be written before exit
116  bool configDirty;
117  bool authDirty;
118 
119  void errorInCommand(const char*);
120  int prepareAnswer(char *answMessage);
121  char answBuffer[MAXMSGOUTBUFF+20];
122  bool isCommand(const char *key);
123  char commandBuffer[MAXMSG+20]; //for bug search blva
124 
125  void splitRequest(const char* reqMessage);
126  bool isFlag(const char*,int pos=-1);
127  const char * getValueOf(const char*,bool acceptMinus=false); //'-' alone, only void right string
128  const char * getValueIfFlag(const char*,bool acceptMinus=false);
129  void checkUnexpectedTokens();
130  void checkPermission(int reqRights);
131  void checkNotNull(const char *ptr, const char *what);
132  unsigned long convertToULong(const char *stringValue,const char *what);
133 
134  RasServer& getServer(const char*); //later, just use rasmanager[serverName]
135  Database& getDatabase(const char *name);
136  DatabaseHost& getDatabaseHost(const char *name);
137  ServerHost& getServerHost(const char *name);
138  User& getUser(const char *name);
139 
140  struct Token
141  {
142  char *argv;
143  bool used;
144  void set(char*);
145  const char *take();
146  };
147  int argc;
148  Token token[30];
149 
150 };
151 extern RasControl rascontrol;
152 
153 /* obsolete, but in the future...
154  void grantCommand();
155  void revokeCommand();
156 
157  void connectCommand();
158  void connectRasServerToDBH();
159  void connectDatabaseToDBH();
160  void connectHelp();
161  void disconnectCommand();
162  void disconnectRasServerFromDBH();
163  void disconnectDatabaseFromDBH();
164  void disconnectHelp();
165  void listRasServersOnDBH(const char*);
166  void listRasServersDatabase(const char*);
167 
168 */
169 #endif
170