IoTeX client
host.h
1#ifndef HOST_H
2#define HOST_H
3
4#include "helpers/client_helper.h"
5#include <string>
6
7namespace iotex
8{
9namespace
10{
11constexpr const size_t IP_MAX_STRING_LEN = 128U;
12constexpr const size_t BASEURL_MAX_STRING_LEN = 128U;
13constexpr const size_t PORT_MAX_STRING_LEN = 6U;
14} // namespace
15
16class Host
17{
18 public:
19 Host() = default;
20 Host(const char* ip, int port, const char* baseUrl = nullptr);
21
22 bool set(const char* ip, int port, const char* baseUrl = nullptr);
23
24 IotexString ip() const noexcept;
25 int port() const noexcept;
26
27 IotexString toString();
28
29 protected:
30 char _hostname[IP_MAX_STRING_LEN + 1];
31 char _baseUrl[BASEURL_MAX_STRING_LEN + 1];
32 int _port = -1;
33}; // class Host
34
35} // namespace iotex
36
37#endif
Definition: host.h:17
Definition: abi.h:12