Virtru SDK for C++  2.8.0
Virtru C++ SDK library - Create, Read, and Manage TDF3 Files
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
network_interface.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Virtru Corporation
3  *
4  * SPDX - License Identifier: BSD-3-Clause-Clear
5  *
6  */
7 //
8 // TDF SDK
9 //
10 // Created by Sujan Reddy on 2019/05/15.
11 //
12 
13 #ifndef VIRTRU_NETWORK_INTERFACE_H
14 #define VIRTRU_NETWORK_INTERFACE_H
15 
16 #include "map"
17 #include "tuple"
18 #include <functional>
19 #include <memory>
20 #include <string>
21 #include <unordered_map>
22 #include "numeric"
23 
24 namespace virtru {
25 
26  // Http headers
27  using HttpHeaders = std::unordered_map<std::string, std::string>;
28 
29  // callback once the http request is completed.
30  using HTTPServiceCallback = std::function<void(unsigned int statusCode, std::string &&response)>;
31 
36  class INetwork {
37  public:
38  virtual ~INetwork() = default;
43  virtual void executeGet(const std::string &url, const HttpHeaders &headers, HTTPServiceCallback &&callback,
44  const std::string &certAuth = "", const std::string &clientKeyFileName = "", const std::string &clientCertFileName = "") = 0;
45 
51  virtual void executePut(const std::string &url, const HttpHeaders &headers, std::string &&body, HTTPServiceCallback &&callback,
52  const std::string &certAuth = "", const std::string &clientKeyFileName = "", const std::string &clientCertFileName = "") = 0;
53 
59  virtual void executePost(const std::string &url, const HttpHeaders &headers, std::string &&body, HTTPServiceCallback &&callback,
60  const std::string &certAuth = "", const std::string &clientKeyFileName = "", const std::string &clientCertFileName = "") = 0;
61 
67  virtual void executePatch(const std::string &url, const HttpHeaders &headers, std::string &&body, HTTPServiceCallback &&callback,
68  const std::string &certAuth = "", const std::string &clientKeyFileName = "", const std::string &clientCertFileName = "") = 0;
69 
74  virtual void executeHead(const std::string &url, const HttpHeaders &headers, HTTPServiceCallback &&callback,
75  const std::string &certAuth = "", const std::string &clientKeyFileName = "", const std::string &clientCertFileName = "") = 0;
76 
77  };
78 
79 } // namespace virtru
80 
81 #endif //VIRTRU_NETWORK_INTERFACE_H
Definition: network_interface.h:36
virtual void executeHead(const std::string &url, const HttpHeaders &headers, HTTPServiceCallback &&callback, const std::string &certAuth="", const std::string &clientKeyFileName="", const std::string &clientCertFileName="")=0
virtual void executeGet(const std::string &url, const HttpHeaders &headers, HTTPServiceCallback &&callback, const std::string &certAuth="", const std::string &clientKeyFileName="", const std::string &clientCertFileName="")=0
std::unordered_map< std::string, std::string > HttpHeaders
Definition: network_interface.h:27
virtual void executePost(const std::string &url, const HttpHeaders &headers, std::string &&body, HTTPServiceCallback &&callback, const std::string &certAuth="", const std::string &clientKeyFileName="", const std::string &clientCertFileName="")=0
std::function< void(unsigned int statusCode, std::string &&response)> HTTPServiceCallback
Definition: network_interface.h:30
virtual void executePatch(const std::string &url, const HttpHeaders &headers, std::string &&body, HTTPServiceCallback &&callback, const std::string &certAuth="", const std::string &clientKeyFileName="", const std::string &clientCertFileName="")=0
virtual ~INetwork()=default
virtual void executePut(const std::string &url, const HttpHeaders &headers, std::string &&body, HTTPServiceCallback &&callback, const std::string &certAuth="", const std::string &clientKeyFileName="", const std::string &clientCertFileName="")=0