]> git.sesse.net Git - cubemap/blob - udpinput.h
Make backlog_size changeable across HUPs.
[cubemap] / udpinput.h
1 #ifndef _UDPINPUT_H
2 #define _UDPINPUT_H 1
3
4 #include <string>
5 #include <vector>
6
7 #include "input.h"
8
9 class InputProto;
10
11 class UDPInput : public Input {
12 public:
13         UDPInput(const std::string &stream_id, const std::string &url);
14
15         // Serialization/deserialization.
16         UDPInput(const InputProto &serialized);
17         virtual InputProto serialize() const;
18
19         virtual std::string get_url() const { return url; }
20         virtual void close_socket();
21
22 private:
23         // Actually gets the packets.
24         virtual void do_work();
25
26         // Create the HTTP header.
27         void construct_header();
28
29         std::string stream_id;
30
31         // The URL and its parsed components.
32         std::string url;
33         std::string host, port, path;
34
35         // The socket we are receiving on (or -1).
36         int sock;
37 };
38
39 #endif  // !defined(_UDPINPUT_H)