client-cpp  0.7.0
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 
20 #include "kaa/KaaDefaults.hpp"
21 
23 
24 namespace kaa {
25 
27 public:
28  DefaultBootstrapChannel(IKaaChannelManager *channelManager, const KeyPair& clientKeys) : AbstractHttpChannel(channelManager, clientKeys) { }
30 
31  virtual const std::string& getId() const { return CHANNEL_ID; }
32  virtual const std::map<TransportType, ChannelDirection>& getSupportedTransportTypes() const { return SUPPORTED_TYPES; }
33 
34 private:
35  virtual std::shared_ptr<IHttpRequest> createRequest(IPTransportInfoPtr server, const std::vector<std::uint8_t>& body)
36  {
38  auto request = processor->createBootstrapRequest(server->getURL() + getURLSuffix(), body);
39  return request;
40  }
41 
42  virtual std::string retrieveResponse(const IHttpResponse& response)
43  {
45  }
46 
47  virtual ServerType getServerType() const {
48  return ServerType::BOOTSTRAP;
49  }
50 
51 protected:
52  virtual std::string getURLSuffix() {
53  return "/BS/Sync";
54  }
55 
56 private:
57  static const std::string CHANNEL_ID;
58  static const std::map<TransportType, ChannelDirection> SUPPORTED_TYPES;
59 };
60 
61 }
62 
63 #endif /* DEFAULTBOOTSTRAPCHANNEL_HPP_ */
std::string retrieveBootstrapResponse(const IHttpResponse &response)
HttpDataProcessor * getHttpDataProcessor()
ServerType
Definition: ServerType.hpp:22
virtual const std::string & getId() const
std::shared_ptr< IHttpRequest > createBootstrapRequest(const HttpUrl &url, const std::vector< std::uint8_t > &data)
virtual const std::map< TransportType, ChannelDirection > & getSupportedTransportTypes() const
DefaultBootstrapChannel(IKaaChannelManager *channelManager, const KeyPair &clientKeys)
std::shared_ptr< IPTransportInfo > IPTransportInfoPtr