msl2010.h

00001 
00002 /***************************************************************************
00003  *  msl2010.h - Fawkes mid-size refbox 2008 protocol repeater
00004  *
00005  *  Created: Wed Apr 01 18:41:00 2010
00006  *  Copyright  2010  Stefan Schiffer [stefanschiffer.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __TOOLS_REFBOXREP_MSL2010_H_
00024 #define __TOOLS_REFBOXREP_MSL2010_H_
00025 
00026 #include "refbox_state_sender.h"
00027 
00028 #include <cstdlib>
00029 #include <string>
00030 #include <vector>
00031 
00032 namespace fawkes {
00033   class Socket;
00034   class StreamSocket;
00035   class MulticastDatagramSocket;
00036 }
00037 
00038 namespace xmlpp {
00039   class DomParser;
00040   class Node;
00041 }
00042 
00043 class Msl2010RefBoxRepeater
00044 {
00045  public:
00046   Msl2010RefBoxRepeater(RefBoxStateSender &rss,
00047                         const char *refbox_host, unsigned short int refbox_port,
00048                         const bool use_multicast = true );
00049   ~Msl2010RefBoxRepeater();
00050 
00051   void run();
00052 
00053  private:
00054   void process_string(char *buf, size_t len);
00055   void reconnect();
00056 
00057  private:
00058   RefBoxStateSender    &__rss;
00059   fawkes::Socket *__s;
00060   //fawkes::StreamSocket *__s;
00061   //fawkes::MulticastDatagramSocket *__s;
00062 
00063   unsigned int __score_cyan;
00064   unsigned int __score_magenta;
00065 
00066   bool __quit;
00067 
00068   char *__refbox_host;
00069   unsigned short int __refbox_port;
00070 
00071   bool __use_multicast;
00072 
00073   xmlpp::DomParser *dom;
00074   xmlpp::Node      *root;
00075 
00076 };
00077 
00078 #endif