Shaka Packager SDK
http_key_fetcher.h
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_MEDIA_BASE_HTTP_KEY_FETCHER_H_
8 #define PACKAGER_MEDIA_BASE_HTTP_KEY_FETCHER_H_
9 
10 #include <string>
11 
12 #include "packager/base/compiler_specific.h"
13 #include "packager/file/http_file.h"
14 #include "packager/media/base/key_fetcher.h"
15 #include "packager/status.h"
16 
17 namespace shaka {
18 namespace media {
19 
25 class HttpKeyFetcher : public KeyFetcher {
26  public:
31  HttpKeyFetcher(uint32_t timeout_in_seconds);
32  ~HttpKeyFetcher() override;
33 
35  Status FetchKeys(const std::string& url,
36  const std::string& request,
37  std::string* response) override;
38 
44  virtual Status Get(const std::string& url, std::string* response);
45 
51  virtual Status Post(const std::string& url,
52  const std::string& data,
53  std::string* response);
54 
55  private:
56  Status FetchInternal(HttpMethod method, const std::string& url,
57  const std::string& data, std::string* response);
58 
59  const uint32_t timeout_in_seconds_;
60 
61  DISALLOW_COPY_AND_ASSIGN(HttpKeyFetcher);
62 };
63 
64 } // namespace media
65 } // namespace shaka
66 
67 #endif // PACKAGER_MEDIA_BASE_HTTP_KEY_FETCHER_H_
shaka::media::HttpKeyFetcher::Post
virtual Status Post(const std::string &url, const std::string &data, std::string *response)
Definition: http_key_fetcher.cc:42
shaka::media::KeyFetcher
Base class for fetching keys from the license service.
Definition: key_fetcher.h:17
shaka
All the methods that are virtual are virtual for mocking.
Definition: gflags_hex_bytes.cc:11
shaka::media::HttpKeyFetcher
Definition: http_key_fetcher.h:25
shaka::Status
Definition: status.h:110
shaka::media::HttpKeyFetcher::Get
virtual Status Get(const std::string &url, std::string *response)
Definition: http_key_fetcher.cc:38
shaka::media::HttpKeyFetcher::HttpKeyFetcher
HttpKeyFetcher()
Creates a fetcher with no timeout.
Definition: http_key_fetcher.cc:25
shaka::media::HttpKeyFetcher::FetchKeys
Status FetchKeys(const std::string &url, const std::string &request, std::string *response) override
Definition: http_key_fetcher.cc:32