client-cpp  0.8.1
DefaultBootstrapChannel.hpp
Go to the documentation of this file.
1 
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, IKaaClientContext &context)
29  : AbstractHttpChannel(channelManager, clientKeys, context) { }
31 
32  virtual const std::string& getId() const { return CHANNEL_ID; }
33  virtual const std::map<TransportType, ChannelDirection>& getSupportedTransportTypes() const { return SUPPORTED_TYPES; }
34 
35 private:
36  virtual std::shared_ptr<IHttpRequest> createRequest(IPTransportInfoPtr server, const std::vector<std::uint8_t>& body)
37  {
39  auto request = processor->createBootstrapRequest(server->getURL() + getURLSuffix(), body);
40  return request;
41  }
42 
43  virtual std::string retrieveResponse(const IHttpResponse& response)
44  {
46  }
47 
48  virtual ServerType getServerType() const {
49  return ServerType::BOOTSTRAP;
50  }
51 
52 protected:
53  virtual std::string getURLSuffix() {
54  return "/BS/Sync";
55  }
56 
57 private:
58  static const std::string CHANNEL_ID;
59  static const std::map<TransportType, ChannelDirection> SUPPORTED_TYPES;
60 };
61 
62 }
63 
64 #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, IKaaClientContext &context)
std::shared_ptr< IPTransportInfo > IPTransportInfoPtr