DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
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 //
10 
11 #ifndef MEDIA_BASE_HTTP_KEY_FETCHER_H_
12 #define MEDIA_BASE_HTTP_KEY_FETCHER_H_
13 
14 #include "packager/base/compiler_specific.h"
15 #include "packager/media/base/key_fetcher.h"
16 #include "packager/media/base/status.h"
17 
18 namespace edash_packager {
19 namespace media {
20 
26 class HttpKeyFetcher : public KeyFetcher {
27  public:
32  HttpKeyFetcher(uint32_t timeout_in_seconds);
33  ~HttpKeyFetcher() override;
34 
36  Status FetchKeys(const std::string& url,
37  const std::string& request,
38  std::string* response) override;
39 
45  virtual Status Get(const std::string& url, std::string* response);
46 
52  virtual Status Post(const std::string& url,
53  const std::string& data,
54  std::string* response);
55 
56  private:
57  enum HttpMethod {
58  GET,
59  POST,
60  PUT
61  };
62 
63  // Internal implementation of HTTP functions, e.g. Get and Post.
64  Status FetchInternal(HttpMethod method, const std::string& url,
65  const std::string& data, std::string* response);
66 
67  const uint32_t timeout_in_seconds_;
68 
69  DISALLOW_COPY_AND_ASSIGN(HttpKeyFetcher);
70 };
71 
72 } // namespace media
73 } // namespace edash_packager
74 
75 #endif // MEDIA_BASE_HTTP_KEY_FETCHER_H_
HttpKeyFetcher()
Creates a fetcher with no timeout.
Base class for fetching keys from the license service.
Definition: key_fetcher.h:17
virtual Status Get(const std::string &url, std::string *response)
virtual Status Post(const std::string &url, const std::string &data, std::string *response)
Status FetchKeys(const std::string &url, const std::string &request, std::string *response) override