~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/network_ms.h

  • Committer: Mark Atwood
  • Date: 2011-12-20 02:32:53 UTC
  • mfrom: (2469.1.1 drizzle-build)
  • Revision ID: me@mark.atwood.name-20111220023253-bvu0kr14kwsdvz7g
mergeĀ lp:~brianaker/drizzle/deprecate-pbms

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2008 PrimeBase Technologies GmbH, Germany
2
 
 *
3
 
 * PrimeBase Media Stream for MySQL
4
 
 *
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.
9
 
 *
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.
14
 
 *
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
18
 
 *
19
 
 * Original author: Paul McCullagh
20
 
 * Continued development: Barry Leslie
21
 
 *
22
 
 * 2007-05-25
23
 
 *
24
 
 * H&G2JCtL
25
 
 *
26
 
 * Network interface.
27
 
 *
28
 
 */
29
 
 
30
 
#pragma once
31
 
#ifndef __NETWORK_MS_H__
32
 
#define __NETWORK_MS_H__
33
 
 
34
 
#include "cslib/CSDefs.h"
35
 
#include "cslib/CSSocket.h"
36
 
#include "cslib/CSThread.h"
37
 
#include "connection_handler_ms.h"
38
 
 
39
 
class MSSystemThread : public CSDaemon {
40
 
public:
41
 
        MSSystemThread(time_t wait_time, CSThreadList *list): CSDaemon(wait_time, list) { }
42
 
 
43
 
        virtual bool doWork();
44
 
};
45
 
 
46
 
class MSNetwork {
47
 
public:
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();
57
 
 
58
 
public:
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;
67
 
 
68
 
private:
69
 
        static int                                      handlerCount;
70
 
};
71
 
 
72
 
#endif