server.h
Go to the documentation of this file.
00001 /*
00002  *
00003  *  D-Bus++ - C++ bindings for D-Bus
00004  *
00005  *  Copyright (C) 2005-2007  Paolo Durante <shackan@gmail.com>
00006  *
00007  *
00008  *  This library is free software; you can redistribute it and/or
00009  *  modify it under the terms of the GNU Lesser General Public
00010  *  License as published by the Free Software Foundation; either
00011  *  version 2.1 of the License, or (at your option) any later version.
00012  *
00013  *  This library is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  *  Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public
00019  *  License along with this library; if not, write to the Free Software
00020  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 
00025 #ifndef __DBUSXX_SERVER_H
00026 #define __DBUSXX_SERVER_H
00027 
00028 #include <list>
00029 
00030 #include "api.h"
00031 #include "error.h"
00032 #include "connection.h"
00033 #include "util.h"
00034 #include "dispatcher.h"
00035 
00036 namespace DBus
00037 {
00038 
00039 class Server;
00040 
00041 typedef std::list<Server> ServerList;
00042 
00043 class DXXAPI Server
00044 {
00045 public:
00046 
00047   Server(const char *address);
00048 
00049   Dispatcher *setup(Dispatcher *);
00050 
00051   virtual ~Server();
00052 
00053   bool listening() const;
00054 
00055   bool operator == (const Server &) const;
00056 
00057   void disconnect();
00058 
00059   void enable_auth(bool);
00060 
00061   void enable_anon(bool);
00062 
00063   struct Private;
00064 
00065 protected:
00066 
00067   Server(const Server &s)
00068   {}
00069 
00070   virtual void on_new_connection(Connection &c) = 0;
00071 
00072   virtual bool on_user_auth(unsigned long uid);
00073 
00074 private:
00075 
00076   RefPtrI<Private> _pvt;
00077 };
00078 
00079 } /* namespace DBus */
00080 
00081 #endif//__DBUSXX_SERVER_H