Aktualizr
C++ SOTA Client
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
treehub_server.h
1 #ifndef SOTA_CLIENT_TOOLS_TREEHUB_SERVER_H_
2 #define SOTA_CLIENT_TOOLS_TREEHUB_SERVER_H_
3 
4 #include <string>
5 
6 #include <curl/curl.h>
7 
8 #include "server_credentials.h"
9 #include "utilities/utils.h"
10 
12  public:
13  TreehubServer();
14  void SetToken(const std::string &token);
15  void SetContentType(const std::string &content_type);
16  void SetCerts(const std::string &client_p12);
17  void SetAuthBasic(const std::string &username, const std::string &password);
18 
19  void InjectIntoCurl(const std::string &url_suffix, CURL *curl_handle, bool tufrepo = false) const;
20 
21  void ca_certs(const std::string &cacerts) { ca_certs_ = cacerts; }
22  void root_url(const std::string &_root_url);
23  void repo_url(const std::string &_repo_url);
24  std::string root_url() { return root_url_; };
25 
26  private:
27  std::string ca_certs_;
28  std::string root_url_;
29  std::string repo_url_;
30  std::string username_;
31  std::string password_;
32  std::string root_cert_;
33  TemporaryFile client_p12_path_;
34  AuthMethod method_{AuthMethod::kNone};
35  struct curl_slist auth_header_ {};
36  // Don't modify auth_header_contents_ without updating the pointer in
37  // auth_header_
38  std::string auth_header_contents_;
39  struct curl_slist force_header_ {};
40  // Don't modify force_header_contents_ without updating the pointer in
41  // force_header_
42  std::string force_header_contents_;
43  struct curl_slist content_type_header_ {};
44  // Don't modify content_type_header_contents_ without updating the pointer in
45  // content_type_header_
46  std::string content_type_header_contents_;
47 };
48 
49 // vim: set tabstop=2 shiftwidth=2 expandtab:
50 #endif // SOTA_CLIENT_TOOLS_TREEHUB_SERVER_H_
TreehubServer
Definition: treehub_server.h:11
TemporaryFile
RAII Temporary file creation.
Definition: utils.h:68