4 * Created on: 2014. 6. 10.
19 //----------------------------------------------------------------------
21 int strtollu(std::string data);
22 std::string ultostr(int64_t data);
23 std::string trim(std::string& s, const std::string& drop = " \t\n\v\r");
24 int split(std::string data, const char delimiter, std::vector<std::string>& tokens);
25 bool split_key_value(std::string data, std::string delimiter, std::string &key, std::string &value);
27 std::string read_request();
28 //----------------------------------------------------------------------
33 REQ_TYPE_TRANSCODING_LIVE,
35 REQ_TYPE_TRANSCODING_FILE
37 //----------------------------------------------------------------------
46 std::map<std::string, std::string> params;
47 std::map<std::string, std::string> extension;
50 bool parse_header(std::string header);
52 //----------------------------------------------------------------------
54 #define HTTP_OK "HTTP/1.1 200 OK\r\n"
55 #define HTTP_PARTIAL "HTTP/1.1 206 Partial Content\r\n"
56 #define HTTP_PARAMS "Connection: Close\r\n" \
57 "Content-Type: video/mpeg\r\n" \
58 "Server: transtreamproxy\r\n"
59 #define HTTP_DONE "\r\n"
60 //----------------------------------------------------------------------
62 typedef struct _thread_params_t {
65 RequestHeader *request;
67 //----------------------------------------------------------------------
69 off_t make_response(ThreadParams *params, std::string& response);
70 //----------------------------------------------------------------------
75 static void vlog(const char * format, ...) throw();
77 //----------------------------------------------------------------------
79 void kill_process(int pid);
80 std::string get_host_addr();
81 std::vector<int> find_process_by_name(std::string name, int mypid);
82 //----------------------------------------------------------------------