00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef qpid_framing_AMQP_ServerOperations__
00029 #define qpid_framing_AMQP_ServerOperations__
00030
00031 #include <sstream>
00032
00033 #include <FieldTable.h>
00034 #include <ProtocolVersion.h>
00035 #include <ProtocolVersionException.h>
00036
00037 namespace qpid {
00038 namespace framing {
00039
00040 class AMQP_ServerProxy;
00041 class AMQP_ClientProxy;
00042
00043 class AMQP_ServerOperations
00044 {
00045 protected:
00046 ProtocolVersion version;
00047 AMQP_ServerOperations() {}
00048
00049 public:
00050 AMQP_ServerOperations(u_int8_t major, u_int8_t minor) : version(major, minor) {}
00051 AMQP_ServerOperations(ProtocolVersion& version) : version(version) {}
00052 virtual ~AMQP_ServerOperations() {}
00053
00054 inline u_int8_t getMajor() const { return version.getMajor(); }
00055 inline u_int8_t getMinor() const { return version.getMinor(); }
00056 inline const ProtocolVersion& getVersion() const { return version; }
00057 inline bool isVersion(u_int8_t _major, u_int8_t _minor) const
00058 {
00059 return version.equals(_major, _minor);
00060 }
00061 inline bool isVersion(ProtocolVersion& _version) const
00062 {
00063 return version.equals(_version);
00064 }
00065
00066
00067 #include <AMQP_Constants.h>
00068
00069
00070
00071
00072 class AccessHandler
00073 {
00074 private:
00075 AMQP_ServerProxy* parent;
00076
00077
00078
00079 protected:
00080 AccessHandler() {}
00081 public:
00082 AccessHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00083 virtual ~AccessHandler() {}
00084
00085
00086
00087 virtual void request( u_int16_t channel,
00088 const string& realm,
00089 bool exclusive,
00090 bool passive,
00091 bool active,
00092 bool write,
00093 bool read ) = 0;
00094 };
00095
00096
00097 class BasicHandler
00098 {
00099 private:
00100 AMQP_ServerProxy* parent;
00101
00102
00103
00104 protected:
00105 BasicHandler() {}
00106 public:
00107 BasicHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00108 virtual ~BasicHandler() {}
00109
00110
00111
00112 virtual void ack( u_int16_t channel,
00113 u_int64_t deliveryTag,
00114 bool multiple ) = 0;
00115
00116 virtual void cancel( u_int16_t channel,
00117 const string& consumerTag,
00118 bool nowait ) = 0;
00119
00120 virtual void consume( u_int16_t channel,
00121 u_int16_t ticket,
00122 const string& queue,
00123 const string& consumerTag,
00124 bool noLocal,
00125 bool noAck,
00126 bool exclusive,
00127 bool nowait,
00128 const FieldTable& arguments ) = 0;
00129
00130 virtual void get( u_int16_t channel,
00131 u_int16_t ticket,
00132 const string& queue,
00133 bool noAck ) = 0;
00134
00135 virtual void publish( u_int16_t channel,
00136 u_int16_t ticket,
00137 const string& exchange,
00138 const string& routingKey,
00139 bool mandatory,
00140 bool immediate ) = 0;
00141
00142 virtual void qos( u_int16_t channel,
00143 u_int32_t prefetchSize,
00144 u_int16_t prefetchCount,
00145 bool global ) = 0;
00146
00147 virtual void recover( u_int16_t channel,
00148 bool requeue ) = 0;
00149
00150 virtual void reject( u_int16_t channel,
00151 u_int64_t deliveryTag,
00152 bool requeue ) = 0;
00153 };
00154
00155
00156 class ChannelHandler
00157 {
00158 private:
00159 AMQP_ServerProxy* parent;
00160
00161
00162
00163 protected:
00164 ChannelHandler() {}
00165 public:
00166 ChannelHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00167 virtual ~ChannelHandler() {}
00168
00169
00170
00171 virtual void close( u_int16_t channel,
00172 u_int16_t replyCode,
00173 const string& replyText,
00174 u_int16_t classId,
00175 u_int16_t methodId ) = 0;
00176
00177 virtual void closeOk( u_int16_t channel ) = 0;
00178
00179 virtual void flow( u_int16_t channel,
00180 bool active ) = 0;
00181
00182 virtual void flowOk( u_int16_t channel,
00183 bool active ) = 0;
00184
00185 virtual void open( u_int16_t channel,
00186 const string& outOfBand ) = 0;
00187 };
00188
00189
00190 class ConnectionHandler
00191 {
00192 private:
00193 AMQP_ServerProxy* parent;
00194
00195
00196
00197 protected:
00198 ConnectionHandler() {}
00199 public:
00200 ConnectionHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00201 virtual ~ConnectionHandler() {}
00202
00203
00204
00205 virtual void close( u_int16_t channel,
00206 u_int16_t replyCode,
00207 const string& replyText,
00208 u_int16_t classId,
00209 u_int16_t methodId ) = 0;
00210
00211 virtual void closeOk( u_int16_t channel ) = 0;
00212
00213 virtual void open( u_int16_t channel,
00214 const string& virtualHost,
00215 const string& capabilities,
00216 bool insist ) = 0;
00217
00218 virtual void secureOk( u_int16_t channel,
00219 const string& response ) = 0;
00220
00221 virtual void startOk( u_int16_t channel,
00222 const FieldTable& clientProperties,
00223 const string& mechanism,
00224 const string& response,
00225 const string& locale ) = 0;
00226
00227 virtual void tuneOk( u_int16_t channel,
00228 u_int16_t channelMax,
00229 u_int32_t frameMax,
00230 u_int16_t heartbeat ) = 0;
00231 };
00232
00233
00234 class DtxHandler
00235 {
00236 private:
00237 AMQP_ServerProxy* parent;
00238
00239
00240
00241 protected:
00242 DtxHandler() {}
00243 public:
00244 DtxHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00245 virtual ~DtxHandler() {}
00246
00247
00248
00249 virtual void select( u_int16_t channel ) = 0;
00250
00251 virtual void start( u_int16_t channel,
00252 const string& dtxIdentifier ) = 0;
00253 };
00254
00255
00256 class ExchangeHandler
00257 {
00258 private:
00259 AMQP_ServerProxy* parent;
00260
00261
00262
00263 protected:
00264 ExchangeHandler() {}
00265 public:
00266 ExchangeHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00267 virtual ~ExchangeHandler() {}
00268
00269
00270
00271 virtual void declare( u_int16_t channel,
00272 u_int16_t ticket,
00273 const string& exchange,
00274 const string& type,
00275 bool passive,
00276 bool durable,
00277 bool autoDelete,
00278 bool internal,
00279 bool nowait,
00280 const FieldTable& arguments ) = 0;
00281
00282 virtual void delete_( u_int16_t channel,
00283 u_int16_t ticket,
00284 const string& exchange,
00285 bool ifUnused,
00286 bool nowait ) = 0;
00287 };
00288
00289
00290 class FileHandler
00291 {
00292 private:
00293 AMQP_ServerProxy* parent;
00294
00295
00296
00297 protected:
00298 FileHandler() {}
00299 public:
00300 FileHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00301 virtual ~FileHandler() {}
00302
00303
00304
00305 virtual void ack( u_int16_t channel,
00306 u_int64_t deliveryTag,
00307 bool multiple ) = 0;
00308
00309 virtual void cancel( u_int16_t channel,
00310 const string& consumerTag,
00311 bool nowait ) = 0;
00312
00313 virtual void consume( u_int16_t channel,
00314 u_int16_t ticket,
00315 const string& queue,
00316 const string& consumerTag,
00317 bool noLocal,
00318 bool noAck,
00319 bool exclusive,
00320 bool nowait ) = 0;
00321
00322 virtual void open( u_int16_t channel,
00323 const string& identifier,
00324 u_int64_t contentSize ) = 0;
00325
00326 virtual void openOk( u_int16_t channel,
00327 u_int64_t stagedSize ) = 0;
00328
00329 virtual void publish( u_int16_t channel,
00330 u_int16_t ticket,
00331 const string& exchange,
00332 const string& routingKey,
00333 bool mandatory,
00334 bool immediate,
00335 const string& identifier ) = 0;
00336
00337 virtual void qos( u_int16_t channel,
00338 u_int32_t prefetchSize,
00339 u_int16_t prefetchCount,
00340 bool global ) = 0;
00341
00342 virtual void reject( u_int16_t channel,
00343 u_int64_t deliveryTag,
00344 bool requeue ) = 0;
00345
00346 virtual void stage( u_int16_t channel ) = 0;
00347 };
00348
00349
00350 class QueueHandler
00351 {
00352 private:
00353 AMQP_ServerProxy* parent;
00354
00355
00356
00357 protected:
00358 QueueHandler() {}
00359 public:
00360 QueueHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00361 virtual ~QueueHandler() {}
00362
00363
00364
00365 virtual void bind( u_int16_t channel,
00366 u_int16_t ticket,
00367 const string& queue,
00368 const string& exchange,
00369 const string& routingKey,
00370 bool nowait,
00371 const FieldTable& arguments ) = 0;
00372
00373 virtual void declare( u_int16_t channel,
00374 u_int16_t ticket,
00375 const string& queue,
00376 bool passive,
00377 bool durable,
00378 bool exclusive,
00379 bool autoDelete,
00380 bool nowait,
00381 const FieldTable& arguments ) = 0;
00382
00383 virtual void delete_( u_int16_t channel,
00384 u_int16_t ticket,
00385 const string& queue,
00386 bool ifUnused,
00387 bool ifEmpty,
00388 bool nowait ) = 0;
00389
00390 virtual void purge( u_int16_t channel,
00391 u_int16_t ticket,
00392 const string& queue,
00393 bool nowait ) = 0;
00394 };
00395
00396
00397 class StreamHandler
00398 {
00399 private:
00400 AMQP_ServerProxy* parent;
00401
00402
00403
00404 protected:
00405 StreamHandler() {}
00406 public:
00407 StreamHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00408 virtual ~StreamHandler() {}
00409
00410
00411
00412 virtual void cancel( u_int16_t channel,
00413 const string& consumerTag,
00414 bool nowait ) = 0;
00415
00416 virtual void consume( u_int16_t channel,
00417 u_int16_t ticket,
00418 const string& queue,
00419 const string& consumerTag,
00420 bool noLocal,
00421 bool exclusive,
00422 bool nowait ) = 0;
00423
00424 virtual void publish( u_int16_t channel,
00425 u_int16_t ticket,
00426 const string& exchange,
00427 const string& routingKey,
00428 bool mandatory,
00429 bool immediate ) = 0;
00430
00431 virtual void qos( u_int16_t channel,
00432 u_int32_t prefetchSize,
00433 u_int16_t prefetchCount,
00434 u_int32_t consumeRate,
00435 bool global ) = 0;
00436 };
00437
00438
00439 class TestHandler
00440 {
00441 private:
00442 AMQP_ServerProxy* parent;
00443
00444
00445
00446 protected:
00447 TestHandler() {}
00448 public:
00449 TestHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00450 virtual ~TestHandler() {}
00451
00452
00453
00454 virtual void content( u_int16_t channel ) = 0;
00455
00456 virtual void contentOk( u_int16_t channel,
00457 u_int32_t contentChecksum ) = 0;
00458
00459 virtual void integer( u_int16_t channel,
00460 u_int8_t integer1,
00461 u_int16_t integer2,
00462 u_int32_t integer3,
00463 u_int64_t integer4,
00464 u_int8_t operation ) = 0;
00465
00466 virtual void integerOk( u_int16_t channel,
00467 u_int64_t result ) = 0;
00468
00469 virtual void string_( u_int16_t channel,
00470 const string& string1,
00471 const string& string2,
00472 u_int8_t operation ) = 0;
00473
00474 virtual void stringOk( u_int16_t channel,
00475 const string& result ) = 0;
00476
00477 virtual void table( u_int16_t channel,
00478 const FieldTable& table,
00479 u_int8_t integerOp,
00480 u_int8_t stringOp ) = 0;
00481
00482 virtual void tableOk( u_int16_t channel,
00483 u_int64_t integerResult,
00484 const string& stringResult ) = 0;
00485 };
00486
00487
00488 class TunnelHandler
00489 {
00490 private:
00491 AMQP_ServerProxy* parent;
00492
00493
00494
00495 protected:
00496 TunnelHandler() {}
00497 public:
00498 TunnelHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00499 virtual ~TunnelHandler() {}
00500
00501
00502
00503 virtual void request( u_int16_t channel,
00504 const FieldTable& metaData ) = 0;
00505 };
00506
00507
00508 class TxHandler
00509 {
00510 private:
00511 AMQP_ServerProxy* parent;
00512
00513
00514
00515 protected:
00516 TxHandler() {}
00517 public:
00518 TxHandler(AMQP_ServerProxy* _parent) {parent = _parent;}
00519 virtual ~TxHandler() {}
00520
00521
00522
00523 virtual void commit( u_int16_t channel ) = 0;
00524
00525 virtual void rollback( u_int16_t channel ) = 0;
00526
00527 virtual void select( u_int16_t channel ) = 0;
00528 };
00529
00530
00531
00532 virtual AMQP_ServerOperations::AccessHandler* getAccessHandler() = 0;
00533 virtual AMQP_ServerOperations::BasicHandler* getBasicHandler() = 0;
00534 virtual AMQP_ServerOperations::ChannelHandler* getChannelHandler() = 0;
00535 virtual AMQP_ServerOperations::ConnectionHandler* getConnectionHandler() = 0;
00536 virtual AMQP_ServerOperations::DtxHandler* getDtxHandler() = 0;
00537 virtual AMQP_ServerOperations::ExchangeHandler* getExchangeHandler() = 0;
00538 virtual AMQP_ServerOperations::FileHandler* getFileHandler() = 0;
00539 virtual AMQP_ServerOperations::QueueHandler* getQueueHandler() = 0;
00540 virtual AMQP_ServerOperations::StreamHandler* getStreamHandler() = 0;
00541 virtual AMQP_ServerOperations::TestHandler* getTestHandler() = 0;
00542 virtual AMQP_ServerOperations::TunnelHandler* getTunnelHandler() = 0;
00543 virtual AMQP_ServerOperations::TxHandler* getTxHandler() = 0;
00544
00545 };
00546
00547 }
00548 }
00549
00550 #endif