summaryrefslogtreecommitdiff
path: root/include/webserver.h
blob: 250987059be32561021b717ec747e570414b3627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * webserver.h
 *
 *  Created on: 06.08.2012
 *      Author: savop
 */

#ifndef WEBSERVER_H_
#define WEBSERVER_H_

#include <tnt/tntnet.h>
#include <stdint.h>
#include <string>
#include <vdr/thread.h>

namespace upnp {

  class cMediaServer;

  class cWebserver {
  public:
    cWebserver(std::string address);
    virtual ~cWebserver();

    void SetKeepAliveTimeout(unsigned int seconds);
    void SetMaxRequestTime(unsigned int seconds);
    void SetWebserverRootDir(std::string rootDirectory);
    void SetPresentationUrl(std::string presentationUrl);

    void SetListenerPort(uint16_t port);

    bool Initialise();

    bool Start();
    void Stop();

    const std::string GetBaseUrl() const;
    const std::string GetServiceUrl() const;
    const std::string GetControlUrl() const;
    const std::string GetStaticContentUrl() const;
    const std::string GetPresentationUrl() const;

    const std::string GetThumbnailDir() const;

    std::string GetListenerAddress() const { return mListenerAddress; }
    uint16_t GetListenerPort() const { return mListenerPort; }

  private:
    tnt::Tntnet mApplication;
    std::string mWebserverRootDir;
    std::string mListenerAddress;
    uint16_t    mListenerPort;

    std::string mPresentationUrl;
    std::string mStaticContentUrl;
    std::string mServiceUrl;

    class cWSThread : public cThread {
    public:
      cWSThread(cWebserver& webServer);
      virtual ~cWSThread();
      void Stop();
      virtual void Action(void);
    private:
      cWebserver& mWebserver;
    } mWebserverThread;
  };

};

#endif /* WEBSERVER_H_ */