hlswmaster-ng/hlswserver.h

58 lines
989 B
C
Raw Normal View History

2006-02-02 16:55:44 +01:00
#ifndef _HLSWSERVER_H_
#define _HLSWSERVER_H_
#include <string.h>
#include "thread.h"
#include "config.h"
#include "gamelist.h"
2006-03-05 02:28:19 +01:00
#include "netpkt.h"
#include "socket.h"
2006-02-06 20:58:32 +01:00
#include "mutex.h"
2006-02-02 16:55:44 +01:00
class HlswServer : public Thread {
public:
2006-02-20 21:58:59 +01:00
HlswServer(Config& conf, GameList& glist);
2006-02-02 16:55:44 +01:00
~HlswServer();
int execute(void* arg);
2006-02-20 21:58:59 +01:00
void rebuild(GameList& gl);
2006-03-05 02:28:19 +01:00
2006-02-02 16:55:44 +01:00
protected:
HlswServer(const HlswServer& hs);
HlswServer& operator=(const HlswServer& hs);
private:
2006-02-20 21:58:59 +01:00
class RebuildEvent : public Event {
public:
RebuildEvent(HlswServer& hs, GameList& gl) : hs(hs), gl(gl) {}
~RebuildEvent() {}
void execute() { hs.rebuild(gl); }
2006-03-05 02:28:19 +01:00
2006-02-20 21:58:59 +01:00
private:
HlswServer& hs;
GameList& gl;
};
2006-03-05 02:28:19 +01:00
class HlswPacket : private NetPkt {
2006-02-02 16:55:44 +01:00
public:
2006-02-06 20:58:32 +01:00
HlswPacket(HlswPacket* next);
~HlswPacket();
2006-02-02 16:55:44 +01:00
2006-02-19 18:45:56 +01:00
bool addGame(GameEntry* ge);
2006-03-05 02:28:19 +01:00
void send(Socket* socket, struct sockaddr_in* dst);
2006-02-02 16:55:44 +01:00
2006-02-06 20:58:32 +01:00
private:
2006-02-02 16:55:44 +01:00
HlswPacket* next;
};
2006-03-05 02:28:19 +01:00
Socket* socket;
2006-02-06 20:58:32 +01:00
HlswPacket* pktlist;
Mutex mutex;
2006-02-20 21:58:59 +01:00
long lastUpdate;
2006-02-02 16:55:44 +01:00
};
#endif // _HLSWSERVER_H_