2010-11-12 16:16:22 +01:00
|
|
|
#ifndef __SERVER_H_
|
|
|
|
#define __SERVER_H_
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2010-11-12 21:37:12 +01:00
|
|
|
#include <list>
|
2010-11-15 18:18:28 +01:00
|
|
|
|
|
|
|
#include <glibmm/timeval.h>
|
|
|
|
|
2010-11-12 16:16:22 +01:00
|
|
|
#include <boost/array.hpp>
|
|
|
|
#include <boost/asio.hpp>
|
|
|
|
|
2010-11-16 20:27:22 +01:00
|
|
|
#include <ncurses.h>
|
|
|
|
|
2010-11-12 16:16:22 +01:00
|
|
|
#include "Buffers.h"
|
|
|
|
#include "Buffer.h"
|
|
|
|
#include "defines.h"
|
|
|
|
|
2010-11-17 15:38:40 +01:00
|
|
|
enum modes
|
|
|
|
{
|
|
|
|
FRAME,
|
|
|
|
FRAME_VALUES,
|
|
|
|
CLIENTS
|
|
|
|
};
|
2010-11-12 16:16:22 +01:00
|
|
|
|
|
|
|
using boost::asio::ip::udp;
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class Server : public sigc::trackable
|
|
|
|
{
|
|
|
|
public:
|
2010-11-12 21:37:12 +01:00
|
|
|
Server(int _port);
|
2010-11-12 16:16:22 +01:00
|
|
|
~Server();
|
2010-11-16 20:27:22 +01:00
|
|
|
|
|
|
|
void launch_threads();
|
|
|
|
|
|
|
|
private:
|
2010-11-17 15:38:40 +01:00
|
|
|
Glib::Mutex mutex_;
|
|
|
|
|
2010-11-16 20:27:22 +01:00
|
|
|
void console();
|
|
|
|
void input();
|
2010-11-17 12:38:53 +01:00
|
|
|
void test();
|
|
|
|
|
|
|
|
char brtoc(unsigned char);
|
|
|
|
int brtoi(unsigned char);
|
|
|
|
|
|
|
|
void console_printframe(frame_t _frame);
|
|
|
|
void console_printframe_values(frame_t _frame);
|
2010-11-16 20:27:22 +01:00
|
|
|
void console_printstats();
|
2010-11-17 15:38:40 +01:00
|
|
|
void console_printclients();
|
2010-11-12 16:16:22 +01:00
|
|
|
|
|
|
|
void listen();
|
|
|
|
void mix();
|
2010-11-17 15:38:40 +01:00
|
|
|
void output(frame_t);
|
2010-11-15 18:18:28 +01:00
|
|
|
int get_size();
|
2010-11-22 17:41:21 +01:00
|
|
|
void expire();
|
2010-11-16 20:27:22 +01:00
|
|
|
|
|
|
|
bool consoleinit;
|
|
|
|
int console_input;
|
|
|
|
long displaycounter, packetcounter;
|
2010-11-12 21:37:12 +01:00
|
|
|
|
2010-11-12 16:16:22 +01:00
|
|
|
vector<Glib::Thread*> threads;
|
2010-11-15 18:18:28 +01:00
|
|
|
|
2010-11-12 16:16:22 +01:00
|
|
|
vector<Buffer*> buffers;
|
2010-11-12 21:37:12 +01:00
|
|
|
vector<udp::endpoint> endpoints;
|
2010-11-15 18:18:28 +01:00
|
|
|
vector<time_t> times;
|
2010-11-12 21:37:12 +01:00
|
|
|
|
2010-11-15 18:18:28 +01:00
|
|
|
time_t currenttime;
|
2010-11-16 20:27:22 +01:00
|
|
|
|
|
|
|
frame_t frame;
|
2010-11-12 16:16:22 +01:00
|
|
|
|
|
|
|
int port;
|
2010-11-17 12:38:53 +01:00
|
|
|
char mode;
|
2010-11-12 16:16:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|