/usr/share/cruisecontrol-bin-2.6.1/projects/qpid-trunk/cpp/src/qpid/broker/ConnectionHandler.h

00001 /*
00002  *
00003  * Licensed to the Apache Software Foundation (ASF) under one
00004  * or more contributor license agreements.  See the NOTICE file
00005  * distributed with this work for additional information
00006  * regarding copyright ownership.  The ASF licenses this file
00007  * to you under the Apache License, Version 2.0 (the
00008  * "License"); you may not use this file except in compliance
00009  * with the License.  You may obtain a copy of the License at
00010  * 
00011  *   http://www.apache.org/licenses/LICENSE-2.0
00012  * 
00013  * Unless required by applicable law or agreed to in writing,
00014  * software distributed under the License is distributed on an
00015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00016  * KIND, either express or implied.  See the License for the
00017  * specific language governing permissions and limitations
00018  * under the License.
00019  *
00020  */
00021 #ifndef _ConnectionAdapter_
00022 #define _ConnectionAdapter_
00023 
00024 #include <memory>
00025 #include "qpid/framing/amqp_types.h"
00026 #include "qpid/framing/AMQFrame.h"
00027 #include "qpid/framing/AMQP_ClientOperations.h"
00028 #include "qpid/framing/AMQP_ClientProxy.h"
00029 #include "qpid/framing/AMQP_ServerOperations.h"
00030 #include "qpid/framing/AMQP_ServerProxy.h"
00031 #include "qpid/framing/FrameHandler.h"
00032 #include "qpid/framing/ProtocolInitiation.h"
00033 #include "qpid/framing/ProtocolVersion.h"
00034 #include "qpid/Exception.h"
00035 
00036 namespace qpid {
00037 namespace broker {
00038 
00039 class Connection;
00040 
00041 class ConnectionHandler : public framing::FrameHandler
00042 {
00043     struct Handler : public framing::AMQP_ServerOperations::Connection010Handler, 
00044         public framing::AMQP_ClientOperations::ConnectionHandler
00045     {
00046         framing::AMQP_ClientProxy::Connection010 client;
00047         framing::AMQP_ServerProxy::Connection server;
00048         Connection& connection;
00049         bool serverMode;
00050     
00051         Handler(Connection& connection);
00052         void startOk(const qpid::framing::FieldTable& clientProperties,
00053                      const std::string& mechanism, const std::string& response,
00054                      const std::string& locale); 
00055         void secureOk(const std::string& response); 
00056         void tuneOk(uint16_t channelMax, uint16_t frameMax, uint16_t heartbeat); 
00057         void heartbeat() {}
00058         void open(const std::string& virtualHost,
00059                   const framing::Array& capabilities, bool insist); 
00060         void close(uint16_t replyCode, const std::string& replyText,
00061                    uint16_t classId, uint16_t methodId); 
00062         void closeOk(); 
00063 
00064 
00065         void start(uint8_t versionMajor,
00066                    uint8_t versionMinor,
00067                    const qpid::framing::FieldTable& serverProperties,
00068                    const std::string& mechanisms,
00069                    const std::string& locales);
00070         
00071         void secure(const std::string& challenge);
00072         
00073         void tune(uint16_t channelMax,
00074                   uint32_t frameMax,
00075                   uint16_t heartbeat);
00076         
00077         void openOk(const std::string& knownHosts);
00078         
00079         void redirect(const std::string& host, const std::string& knownHosts);        
00080     };
00081     std::auto_ptr<Handler> handler;
00082   public:
00083     ConnectionHandler(Connection& connection);
00084     void close(framing::ReplyCode code, const std::string& text, framing::ClassId classId, framing::MethodId methodId);
00085     void handle(framing::AMQFrame& frame);
00086 };
00087 
00088 
00089 }}
00090 
00091 #endif

Generated on Thu Apr 10 11:08:17 2008 for Qpid by  doxygen 1.4.7