openATV enigma2
openATV is an open source SetTopBox Graphical user interface.
httpsstream.h
Go to the documentation of this file.
1 #ifndef __lib_base_httpsstream_h
2 #define __lib_base_httpsstream_h
3 
4 #include <string>
5 #include <lib/base/ebase.h>
6 #include <lib/base/itssource.h>
7 #include <lib/base/thread.h>
8 
9 #include <openssl/bio.h>
10 #include <openssl/ssl.h>
11 #include <openssl/err.h>
12 
13 class eHttpsStream: public iTsSource, public sigc::trackable, public eThread
14 {
15  DECLARE_REF(eHttpsStream);
16 
17  int streamSocket;
18  enum { BUSY, CONNECTED, FAILED } connectionStatus;
19  bool isChunked;
20  size_t currentChunkSize;
21  std::string streamUrl;
22  std::string authorizationData;
23  char partialPkt[192];
24  size_t partialPktSz;
25  char* tmpBuf;
26  size_t tmpBufSize;
27  int startDelay;
28 
29  int openUrl(const std::string &url, std::string &newurl);
30  void thread();
31  ssize_t httpChunkedRead(void *buf, size_t count);
32  ssize_t syncNextRead(void *buf, ssize_t count);
33 
34  /* iTsSource */
35  ssize_t read(off_t offset, void *buf, size_t count);
36  off_t length();
37  off_t offset();
38  int valid();
39  bool isStream() { return true; };
40 
41  /* OpenSSL More Info https://wiki.openssl.org/index.php/SSL/TLS_Client */
42  SSL_CTX *ctx;
43  SSL *ssl;
44  SSL_CTX* initCTX();
45  void showCerts(SSL *ssl);
46  ssize_t SSL_writeAll(SSL *ssl, const void *buf, size_t count);
47  ssize_t SSL_singleRead(SSL *ssl, void *buf, size_t count);
48  ssize_t SSL_readLine(SSL *ssl, char** buffer, size_t* bufsize);
49 public:
50  eHttpsStream();
51  ~eHttpsStream();
52  int open(const char *url);
53  int close();
54 };
55 
56 #endif
Definition: httpsstream.h:14
eHttpsStream()
Definition: httpsstream.cpp:13
int close()
Definition: httpsstream.cpp:352
~eHttpsStream()
Definition: httpsstream.cpp:35
int open(const char *url)
Definition: httpsstream.cpp:305
Definition: thread.h:27
Definition: itssource.h:7
int count
Definition: newplugin.py:14