client-cpp  0.0.1-SNAPSHOT
DefaultBootstrapChannel.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef DEFAULTBOOTSTRAPCHANNEL_HPP_
18 #define DEFAULTBOOTSTRAPCHANNEL_HPP_
19 
21 
22 namespace kaa {
23 
24 class DefaultBootstrapChannel : public AbstractHttpChannel<ChannelType::HTTP> {
25 public:
26  DefaultBootstrapChannel(IKaaChannelManager *channelManager, const KeyPair& clientKeys) : AbstractHttpChannel(channelManager, clientKeys) { }
28 
29  virtual const std::string& getId() const { return CHANNEL_ID; }
30  virtual const std::map<TransportType, ChannelDirection>& getSupportedTransportTypes() const { return SUPPORTED_TYPES; }
31 
32 private:
33  virtual boost::shared_ptr<IHttpRequest> createRequest(AbstractServerInfoPtr server, const std::vector<boost::uint8_t>& body)
34  {
36  boost::shared_ptr<IHttpRequest> request = processor->createBootstrapRequest(server->getUrl(), body);
37  return request;
38  }
39 
40  virtual std::string retrieveResponse(const IHttpResponse& response)
41  {
43  }
44 
45  virtual ServerType getServerType() const {
46  return ServerType::BOOTSTRAP;
47  }
48 
49 private:
50  static const std::string CHANNEL_ID;
51  static const std::map<TransportType, ChannelDirection> SUPPORTED_TYPES;
52 };
53 
54 }
55 
56 
57 
58 #endif /* DEFAULTBOOTSTRAPCHANNEL_HPP_ */
std::pair< Botan::MemoryVector< boost::uint8_t >, std::string > KeyPair
Definition: KeyUtils.hpp:28
std::string retrieveBootstrapResponse(const IHttpResponse &response)
boost::shared_ptr< IHttpRequest > createBootstrapRequest(const HttpUrl &url, const std::vector< boost::uint8_t > &data)
ServerType
Definition: ServerType.hpp:22
virtual const std::string & getId() const
virtual const std::map< TransportType, ChannelDirection > & getSupportedTransportTypes() const
DefaultBootstrapChannel(IKaaChannelManager *channelManager, const KeyPair &clientKeys)
boost::shared_ptr< AbstractServerInfo< Type > > AbstractServerInfoPtr