client-cpp  0.10.0
GenericTransportInfo.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 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 KAA_CHANNEL_GENERICTRANSPORTINFO_HPP_
18 #define KAA_CHANNEL_GENERICTRANSPORTINFO_HPP_
19 
20 #include <botan/base64.h>
21 
23 
24 namespace kaa {
25 
26 
28 {
29 public:
30  GenericTransportInfo(ServerType type, const ProtocolMetaData& metaData) :
31  serverType_(type), accessPointId_(metaData.accessPointId)
32  , protocolId_(metaData.protocolVersionInfo), connectionData_(metaData.connectionInfo), isFailedState_(false) {}
33 
34  GenericTransportInfo(ServerType type, const std::int32_t& accessPointId
35  , const TransportProtocolId& protocolId, const std::vector<std::uint8_t>& connectionData)
36  : serverType_(type), accessPointId_(accessPointId)
37  , protocolId_(protocolId), connectionData_(connectionData), isFailedState_(false) {}
38 
39  virtual ServerType getServerType() const {
40  return serverType_;
41  }
42 
43  virtual std::int32_t getAccessPointId() const {
44  return accessPointId_;
45  }
46 
48  return protocolId_;
49  }
50 
51  virtual const std::vector<std::uint8_t>& getConnectionInfo() const {
52  return connectionData_;
53  }
54 
55  virtual bool isFailedState() const {
56  return isFailedState_;
57  }
58 
59  virtual void setFailedState() {
60  isFailedState_ = true;
61  }
62 
63  virtual void resetFailedState() {
64  isFailedState_ = false;
65  }
66 
67 protected:
69  std::int32_t accessPointId_;
71  std::vector<std::uint8_t> connectionData_;
73 };
74 
75 } /* namespace kaa */
76 
77 #endif /* KAA_CHANNEL_GENERICTRANSPORTINFO_HPP_ */
GenericTransportInfo(ServerType type, const ProtocolMetaData &metaData)
ServerType
Definition: ServerType.hpp:22
virtual const std::vector< std::uint8_t > & getConnectionInfo() const
std::vector< std::uint8_t > connectionData_
virtual TransportProtocolId getTransportId() const
virtual bool isFailedState() const
virtual std::int32_t getAccessPointId() const
GenericTransportInfo(ServerType type, const std::int32_t &accessPointId, const TransportProtocolId &protocolId, const std::vector< std::uint8_t > &connectionData)
virtual ServerType getServerType() const