rstpclientif.h

00001 /* libradar_stp
00002  * <http://www.k9nl.net/radar/> <radar@k9nl.net>
00003  * 
00004  * rstpclientif.h - RSTP client class interface
00005  *
00006  * Copyright (C) 2007 Nicholas J. Luther
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License,
00010  * version 2, as published by the Free Software Foundation.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  * You may contact the author by writing to Nick Luther, 1655 South
00021  * Westhaven Drive, Oshkosh, Wisconsin 54904, USA.
00022  * 
00023  */
00024  
00025 #ifndef _LIBRSTP_INC_RSTPCLIENTIF_H
00026 #define _LIBRSTP_INC_RSTPCLIENTIF_H
00027  
00028 #include <string>
00029 #include <iostream>
00030 
00031 // Windows DLL stuff
00032 #if defined(WIN32) || defined(WIN_NATIVE)
00033 #ifdef LIBRADAR_STP_EXPORTS
00034 #define LIBRADAR_STP_INTERFACE __declspec(dllexport)
00035 #else
00036 #define LIBRADAR_STP_INTERFACE __declspec(dllimport)
00037 #endif
00038 #else
00039 #define LIBRADAR_STP_INTERFACE 
00040 #endif
00041 
00042 
00043 namespace libradar_stp {
00044 
00053 class 
00054 LIBRADAR_STP_INTERFACE
00055 RSTPClientIf {
00056 public:
00057   
00058   RSTPClientIf();
00059   ~RSTPClientIf();
00060   
00066   void addStream( const std::string& stream );
00067   
00076   void addServer( const std::string& addr, unsigned short port, unsigned int timeout = 1000,
00077                   const std::string& login = "", const std::string& pass = "" );
00078   
00086   void start();               
00087   
00094   void quit();
00095   
00096   typedef void (*CBFUNC)( void*, const std::string&, const std::string& );
00097   typedef void (*CBFUNC3)( void*, const std::string& );
00098 
00106   void setDataCallback( CBFUNC func, void* arg = 0 );
00107   
00117   void setErrorCallback( CBFUNC3 func, void* arg = 0 );
00118   
00124   bool loadFile( const std::string& filename );
00125   
00132   bool readConfig( std::istream& fin, bool have_client_head = false );
00133   
00134 private:
00135 
00136   CBFUNC m_data_cb;
00137   void* m_data_arg;
00138   CBFUNC3 m_error_cb;
00139   void* m_error_cb_arg;
00140   
00141   void* m_red_client;
00142   
00143 public:
00144 
00145   static void _data_cb( void* arg, const std::string& stream, const std::string& data );
00146   static void _error_cb( void* arg, const std::string& msg );
00147     
00148 }; // class
00149 
00150 
00151 };// namespace
00152 
00153 #endif
00154 
00155 
00156 

Generated on Tue Jul 1 20:25:26 2008 for libradar_stp by  doxygen 1.4.7