1
/* Copyright (C) 2008 PrimeBase Technologies GmbH, Germany
3
* PrimeBase Media Stream for MySQL
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
* Original author: Paul McCullagh
20
* Continued development: Barry Leslie
31
#ifndef __CONNECTIONHANDLER_MS_H__
32
#define __CONNECTIONHANDLER_MS_H__
34
#include "cslib/CSDefs.h"
35
#include "cslib/CSThread.h"
36
#include "cslib/CSHTTPStream.h"
38
#include "engine_ms.h"
40
class MSConnectionHandler : public CSDaemon {
42
bool amWaitingToListen;
46
MSConnectionHandler(CSThreadList *list);
47
virtual ~MSConnectionHandler(){} // Do nothing here because 'self' will no longer be valid, use completeWork().
51
virtual bool initializeWork();
53
virtual bool doWork();
55
virtual void *completeWork();
57
virtual bool handleException();
59
static int getHTTPStatus(int err);
61
void writeException(const char *qualifier);
62
void writeException();
67
void serviceConnection();
68
void parseRequestURI();
69
void freeRequestURI();
71
void writeFile(CSString *file_path);
72
void handleGet(bool info_only);
77
static MSConnectionHandler *newHandler(CSThreadList *list);
80
CSHTTPInputStream *iInputStream;
81
CSHTTPOutputStream *iOutputStream;
86
static u_long gMaxKeepAlive;