TBonjourBrowser.h

Go to the documentation of this file.
00001 // @(#)root/bonjour:$Id: TBonjourBrowser.h 29385 2009-07-07 15:27:23Z rdm $
00002 // Author: Fons Rademakers   29/05/2009
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TBonjourBrowser
00013 #define ROOT_TBonjourBrowser
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TBonjourBrowser                                                      //
00019 //                                                                      //
00020 // This class consists of one main member function,                     //
00021 // BrowseForServiceType(), that looks for the service.                  //
00022 // The rest of the class wraps the various bits of Bonjour service      //
00023 // browser. The static callback function is marked with the DNSSD_API   //
00024 // macro to make sure that the callback has the correct calling         //
00025 // convention on Windows.                                               //
00026 //                                                                      //
00027 // Bonjour works out-of-the-box on MacOS X. On Linux you have to        //
00028 // install the Avahi package and run the avahi-daemon. To compile       //
00029 // these classes and run Avahi on Linux you need to install the:        //
00030 //    avahi                                                             //
00031 //    avahi-compat-libdns_sd-devel                                      //
00032 //    nss-mdns                                                          //
00033 // packages. After installation make sure the avahi-daemon is started.  //
00034 //                                                                      //
00035 //////////////////////////////////////////////////////////////////////////
00036 
00037 #ifndef ROOT_TObject
00038 #include "TObject.h"
00039 #endif
00040 #ifndef ROOT_TQObject
00041 #include "TQObject.h"
00042 #endif
00043 #ifndef ROOT_TString
00044 #include "TString.h"
00045 #endif
00046 
00047 #if !defined(__CINT__)
00048 #include <dns_sd.h>
00049 #else
00050 typedef ULong_t DNSServiceRef;
00051 typedef UInt_t  DNSServiceFlags;
00052 typedef Int_t   DNSServiceErrorType;
00053 #endif
00054 
00055 class TFileHandler;
00056 class TList;
00057 
00058 
00059 class TBonjourBrowser : public TObject, public TQObject {
00060 
00061 private:
00062    DNSServiceRef    fDNSRef;
00063    TFileHandler    *fBonjourSocketHandler;
00064    TList           *fBonjourRecords;
00065    TString          fBrowsingType;
00066 
00067    void *GetSender() { return this; }  // used to get gTQSender
00068 
00069 #if !defined(__CINT__)
00070    static void DNSSD_API BonjourBrowseReply(DNSServiceRef,
00071                                             DNSServiceFlags, UInt_t, DNSServiceErrorType,
00072                                             const char *, const char *, const char *, void *);
00073 #else
00074    static void BonjourBrowseReply(DNSServiceRef,
00075                                   DNSServiceFlags, Int_t, DNSServiceErrorType,
00076                                   const char *, const char *, const char *, void *);
00077 #endif
00078 
00079 public:
00080    TBonjourBrowser();
00081    virtual ~TBonjourBrowser();
00082 
00083    Int_t       BrowseForServiceType(const char *serviceType);
00084    TList      *CurrentRecords() const { return fBonjourRecords; }
00085    const char *ServiceType() const { return fBrowsingType; }
00086 
00087    void CurrentBonjourRecordsChanged(TList *bonjourRecords);  //*SIGNAL*
00088 
00089    void BonjourSocketReadyRead();  // private slot
00090 
00091    ClassDef(TBonjourBrowser,0)  // Browse hosts for specific bonjour service type
00092 };
00093 
00094 #endif

Generated on Tue Jul 5 14:45:38 2011 for ROOT_528-00b_version by  doxygen 1.5.1