ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TBonjourBrowser.h
Go to the documentation of this file.
1 // @(#)root/bonjour:$Id$
2 // Author: Fons Rademakers 29/05/2009
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TBonjourBrowser
13 #define ROOT_TBonjourBrowser
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TBonjourBrowser //
19 // //
20 // This class consists of one main member function, //
21 // BrowseForServiceType(), that looks for the service. //
22 // The rest of the class wraps the various bits of Bonjour service //
23 // browser. The static callback function is marked with the DNSSD_API //
24 // macro to make sure that the callback has the correct calling //
25 // convention on Windows. //
26 // //
27 // Bonjour works out-of-the-box on MacOS X. On Linux you have to //
28 // install the Avahi package and run the avahi-daemon. To compile //
29 // these classes and run Avahi on Linux you need to install the: //
30 // avahi //
31 // avahi-compat-libdns_sd-devel //
32 // nss-mdns //
33 // packages. After installation make sure the avahi-daemon is started. //
34 // //
35 //////////////////////////////////////////////////////////////////////////
36 
37 #ifndef ROOT_TObject
38 #include "TObject.h"
39 #endif
40 #ifndef ROOT_TQObject
41 #include "TQObject.h"
42 #endif
43 #ifndef ROOT_TString
44 #include "TString.h"
45 #endif
46 
47 #if !defined(__CINT__)
48 #include <dns_sd.h>
49 #else
50 typedef ULong_t DNSServiceRef;
51 typedef UInt_t DNSServiceFlags;
52 typedef Int_t DNSServiceErrorType;
53 #endif
54 
55 class TFileHandler;
56 class TList;
57 
58 
59 class TBonjourBrowser : public TObject, public TQObject {
60 
61 private:
62  DNSServiceRef fDNSRef;
66 
67  void *GetSender() { return this; } // used to get gTQSender
68 
69 #if !defined(__CINT__)
70  static void DNSSD_API BonjourBrowseReply(DNSServiceRef,
71  DNSServiceFlags, UInt_t, DNSServiceErrorType,
72  const char *, const char *, const char *, void *);
73 #else
74  static void BonjourBrowseReply(DNSServiceRef,
75  DNSServiceFlags, Int_t, DNSServiceErrorType,
76  const char *, const char *, const char *, void *);
77 #endif
78 
79 public:
81  virtual ~TBonjourBrowser();
82 
83  Int_t BrowseForServiceType(const char *serviceType);
84  TList *CurrentRecords() const { return fBonjourRecords; }
85  const char *ServiceType() const { return fBrowsingType; }
86 
87  void CurrentBonjourRecordsChanged(TList *bonjourRecords); //*SIGNAL*
88 
89  void BonjourSocketReadyRead(); // private slot
90 
91  ClassDef(TBonjourBrowser,0) // Browse hosts for specific bonjour service type
92 };
93 
94 #endif
const char * ServiceType() const
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Definition: TQObject.h:53
void BonjourSocketReadyRead()
The Bonjour socket is ready for reading.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
static void DNSSD_API BonjourBrowseReply(DNSServiceRef, DNSServiceFlags, UInt_t, DNSServiceErrorType, const char *, const char *, const char *, void *)
Static Bonjour browser callback function.
TList * fBonjourRecords
#define ClassDef(name, id)
Definition: Rtypes.h:254
void CurrentBonjourRecordsChanged(TList *bonjourRecords)
Emit CurrentBonjourRecordsChanged signal.
A doubly linked list.
Definition: TList.h:47
DNSServiceRef fDNSRef
TFileHandler * fBonjourSocketHandler
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual ~TBonjourBrowser()
Cleanup.
unsigned long ULong_t
Definition: RtypesCore.h:51
Mother of all ROOT objects.
Definition: TObject.h:58
Int_t BrowseForServiceType(const char *serviceType)
Tell Bonjour to start browsing for a specific type of service.
TList * CurrentRecords() const