This repository has been archived by the owner on Sep 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vompclient.h
133 lines (104 loc) · 3.29 KB
/
vompclient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
Copyright 2004-2008 Chris Tallon
This file is part of VOMP.
VOMP is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
VOMP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with VOMP; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*
The new async protocol design forced the server side change from the mvpclient
class to the mess it is now. Maybe in a couple of versions time it will become
more apparent how better to design all this.
The reason for the class split is that with the current Thread class system,
you can only have one thread per object. The vompclient class would have needed
two, one for RR stuff and one for the keepalives.
So the new design is this: the VompClient class represents one connection from
one client as the MVPClient class did before. But because two threads are now
needed, a helper class VompClientRRProc contains all the RR processing functions,
and the thread needed to process them. All the state data is still kept in the
VompClient class.
*/
#ifndef VOMPCLIENT_H
#define VOMPCLIENT_H
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
#include <endian.h>
#include <unistd.h> // sleep
#ifndef VOMPSTANDALONE
class RecPlayer;
class MVPReceiver;
class cChannel;
class cPlugin;
#endif
#include "defines.h"
#include "tcp.h"
#include "config.h"
#include "media.h"
#include "i18n.h"
#include "vompclientrrproc.h"
class ResponsePacket;
class ServerMediaFile;
class SerializeBuffer;
class MediaPlayer;
class PictureReader;
class VompClient
{
friend class VompClientRRProc;
friend class PictureReader;
public:
VompClient(Config* baseConfig, char* configDir, char* logoDir,
char* resourceDir, char* imageDir, char*cacheDir, int tsocket);
~VompClient();
int run();
// not for external use
void run2();
static int getNrClients();
private:
static int nr_clients;
static void incClients();
static void decClients();
static ULLONG ntohll(ULLONG a);
static ULLONG htonll(ULLONG a);
VompClientRRProc rrproc;
pthread_t runThread;
int initted;
Log* log;
TCP tcp;
Config config;
Config* baseConfig;
I18n i18n;
bool loggedIn;
char* configDir;
void netLog();
FILE* netLogFile;
//void cleanConfig();
#ifndef VOMPSTANDALONE
void writeResumeData();
MVPReceiver* lp;
RecPlayer* recplayer;
static cPlugin * scraper;
static time_t lastScrapQuery;
static cPlugin* scrapQuery();
PictureReader * pict;
char *logoDir;
char *imageDir;
char *resourceDir;
char *cacheDir;
#endif
MediaPlayer *media;
ServerMediaFile *mediaprovider;
void setCharset(int charset);
int charcoding; // 1= latin1 2= UTF-8
cCharSetConv *charconvutf8;
cCharSetConv *charconvsys;
};
#endif