general/communicate.h

Go to the documentation of this file.
00001 /* $Id: communicate.h jjs $ */
00002 /*
00003    Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
00004    Part of the Moros Project http://moros.sourceforge.net/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License.
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY.
00010 
00011    See the COPYING file for more details.
00012 */
00013 #ifndef COMMUNICATE_H_
00014 #define COMMUNICATE_H_
00015 
00016 #include "channel.h"
00017 #include <gnutls/gnutls.h>
00018 #include <gnutls/extra.h>
00019 
00020 extern void set_blocking(int fileno, bool blocking);
00021 extern bool is_nonblocking_error (void);
00022 
00024 
00025 class communicate {
00026   private:
00028     list<channel> conns_;
00030     int serv_socket_;
00032     int type;
00034     sigc::signal<void, channel*> serv_handler;
00036     int channelnr;
00038     gnutls_certificate_credentials_t cred;
00039     gnutls_dh_params_t dh_params;
00040     gnutls_rsa_params_t rsa_params;
00041     std::string data_dir;
00042     bool init;
00043 
00044   public:
00045     communicate();
00046 
00048     ~communicate();
00049 
00050     void set_dir(std::string dir);
00052     std::string user;
00054     std::string session;
00056     long sessnr;
00057 
00059 
00062     channel* reading(const std::string file, sigc::signal<void, channel*> handler);
00063 
00065 
00068     channel* writing(const std::string file);
00069 
00071 
00074     channel* client(const std::string host, int port, sigc::signal<void, channel*> handler);
00075 
00077 
00080     bool reconnect(channel* ch);
00081 
00083     void server(int port, sigc::signal<void, channel*> handler);
00084 
00085 
00086     #ifndef no_gnutls
00088 
00091     channel* tls_client(const std::string host, int port, sigc::signal<void, channel*> handler);
00092 
00094     void tls_server(int port, sigc::signal<void, channel*> handler);
00095 
00097     void tls_reload();
00098     #endif
00099 
00101     void poll();
00102 
00104     void complete(int timeout);
00105 
00107     void server_close();
00108 };
00109 
00110 #endif


Generated on Tue Jan 1 17:30:00 2008 for general/communicate.h Source File by  doxygen   Visit the project page on SourceForge.net Logo