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 __NETWORK_MS_H__
32
#define __NETWORK_MS_H__
34
#include "cslib/CSDefs.h"
35
#include "cslib/CSSocket.h"
36
#include "cslib/CSThread.h"
37
#include "connection_handler_ms.h"
39
class MSSystemThread : public CSDaemon {
41
MSSystemThread(time_t wait_time, CSThreadList *list): CSDaemon(wait_time, list) { }
43
virtual bool doWork();
48
static void startUp(int port);
49
static void shutDown();
50
static CSSocket *openConnection(MSConnectionHandler *handler);
51
static void startConnectionHandler();
52
static void startNetwork();
53
static bool lockListenerSocket(MSConnectionHandler *handle);
54
static void unlockListenerSocket();
55
static CSMutex *getListenerLock() { return &gListenerLock; }
56
static bool killListener();
59
static MSSystemThread *gSystemThread;
60
static time_t gCurrentTime;
61
static time_t gLastService;
62
static CSThreadList *gHandlerList;
63
static CSSync gListenerLock;
64
static CSSocket *gListenerSocket;
65
static MSConnectionHandler *gListenerThread;
66
static uint32_t gWaitingToListen;
69
static int handlerCount;