rasdaman complete source
rnpservercomm.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 */
23 /*************************************************************
24  *
25  *
26  * PURPOSE:
27  *
28  *
29  * COMMENTS:
30  *
31  ************************************************************/
32 
33 #ifndef RNPSERVERCOMM_HH
34 #define RNPSERVERCOMM_HH
35 
36 //#include <rnprotocol.hh>
37 //#include <rnpembedded.hh>
38 #include "rnpcommunication.hh"
39 #include "raslib/error.hh"
40 
41 using namespace rnp;
42 
43 
48 {
49 public:
50  ClientTimer();
51  void setTimeoutInterval(int seconds);
52  void markAction();
53  bool checkForTimeout();
54 private:
55  time_t interval;
56  time_t lastAction;
57  bool enabled;
58 };
59 
64 {
65 public:
66  RnpRasserverJob() throw();
67 
68 private:
69  bool validateMessage() throw();
70  void executeOnAccept() throw();
71  void executeOnWriteReady() throw();
72  void specificCleanUpOnTimeout() throw();
73  void executeOnReadError() throw();
74  void executeOnWriteError() throw();
75 };
76 
77 
82 {
83 public:
84  RnpRasDaManComm() throw();
85 
86  ~RnpRasDaManComm() throw();
87 
88  void processRequest(CommBuffer *receiverBuffer, CommBuffer *transmiterBuffer, RnpTransport::CarrierProtocol, RnpServerJob *callingJob) throw();
89 
90  void setTimeoutInterval(int seconds);
91  void checkForTimeout();
92 
93 private: // inherited from RnpBaseServerComm
94  RnpServerJob* createJobs(int howMany);
95 
96  void decodeFragment() throw( r_Error );
97 
98  ClientTimer clientTimer;
99 private: // the execution functions:
100  void executeConnect();
101  void executeDisconnect();
102  void executeOpenDB();
103  void executeCloseDB();
104  void executeBeginTA();
105  void executeCommitTA();
106  void executeAbortTA();
107  void executeIsTAOpen();
108  void executeQueryHttp();
109  void executeGetNewOId();
110  void executeQueryRpc();
111  void executeGetNextElement();
112  void executeEndTransfer();
113  void executeGetNextMDD();
114  void executeGetNextTile();
115 
116  void executeUpdateQuery();
117  void executeStartInsertTransMDD();
118  void executeInsertTile();
119  void executeEndInsertMDD();
120  void executeInitUpdate();
121  void executeGetTypeStructure();
122  void executeStartInsertPersMDD();
123  void executeInsertMDD();
124  void executeInsertCollection();
125  void executeRemoveObjFromColl();
126  void executeDeleteObjByOId();
127  void executeDeleteCollByName();
128  void executeGetCollection();
129  void executeGetCollectionOIds();
130  void executeGetObjectType();
131  void executeSetFormat();
132 
133 
134  void executeCreateCollection();
135  void executeCreateMDD();
136  void executeExtendMDD();
137  void executeGetTileDomains();
138 
139  void answerr_Error(r_Error&);
140 private: // helper functions
141  void connectClient();
142  // reset connection, without reporting availability to rasmgr
143  void disconnectInternally();
144  // reset connection, with reporting availability to rasmgr
145  void disconnectClient();
146  void verifyClientID( RnpQuark command ) throw (r_Error);
147  int makeNewClientID();
148 
149  int clientID; // un timestamp, de fapt!
150  int requestCounter; // numara pachetele trimise de un client
151  int fragmentCounter; // numara fragmentele trimise de un client
152 
153  static const int NoClient;
154 };
155 
156 
160 class RasserverCommunicator : public NbCommunicator
161 {
162 public:
164 
165 protected:
166  bool executeOnTimeout() throw();
167 
169 };
170 
171 #endif // RNPSERVERCOMM_HH
172 
Definition: rnpservercomm.hh:81
int RnpQuark
The basic type used in RNP. It is always 32-bit long.
Definition: rnprotocol.hh:51
Definition: rnpcommunication.hh:215
RnpRasDaManComm * commPtr
Definition: rnpservercomm.hh:168
Definition: error.hh:88
Definition: rnpcommunication.hh:44
Definition: rnpcommunication.hh:260
Definition: rnpservercomm.hh:160
CarrierProtocol
Definition: rnpembedded.hh:52
Definition: rnpservercomm.hh:47
Definition: rnpservercomm.hh:63