X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=udpstream.h;fp=udpstream.h;h=3424b984955ded48e1f17c620b60d429b4efa8ac;hb=adbeb2f8972672ed1059509662d006df47762228;hp=0000000000000000000000000000000000000000;hpb=0ff463f4df8e085ba88f8ede735f16b140a2bf8e;p=cubemap diff --git a/udpstream.h b/udpstream.h new file mode 100644 index 0000000..3424b98 --- /dev/null +++ b/udpstream.h @@ -0,0 +1,33 @@ +#ifndef _UDPSTREAM_H +#define _UDPSTREAM_H 1 + +// A single UDP destination. This is done a lot less efficient than HTTP streaming +// since we expect to have so few of them, which also means things are a lot simpler. +// In particular, we run in the input's thread, so there is no backlog, which means +// that there is no state (UDP itself is, of course, stateless). + +#include +#include +#include +#include + +class MarkPool; + +class UDPStream { +public: + // can be NULL. Does not take ownership of the mark pool. + UDPStream(const sockaddr_in6 &dst, MarkPool *mark_pool); + ~UDPStream(); + + void send(const char *data, size_t bytes); + +private: + UDPStream(const UDPStream& other); + + sockaddr_in6 dst; + int sock; + MarkPool *mark_pool; + int fwmark; +}; + +#endif // !defined(_UDPSTREAM_H)