Logo ROOT   6.16/01
Reference Guide
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#include "TObject.h"
38#include "TQObject.h"
39#include "TString.h"
40
41#if !defined(__CINT__)
42#include <dns_sd.h>
43#else
44typedef ULong_t DNSServiceRef;
45typedef UInt_t DNSServiceFlags;
46typedef Int_t DNSServiceErrorType;
47#endif
48
49class TFileHandler;
50class TList;
51
52
53class TBonjourBrowser : public TObject, public TQObject {
54
55private:
56 DNSServiceRef fDNSRef;
60
61 void *GetSender() { return this; } // used to get gTQSender
62
63#if !defined(__CINT__)
64 static void DNSSD_API BonjourBrowseReply(DNSServiceRef,
65 DNSServiceFlags, UInt_t, DNSServiceErrorType,
66 const char *, const char *, const char *, void *);
67#else
68 static void BonjourBrowseReply(DNSServiceRef,
69 DNSServiceFlags, Int_t, DNSServiceErrorType,
70 const char *, const char *, const char *, void *);
71#endif
72
73public:
75 virtual ~TBonjourBrowser();
76
77 Int_t BrowseForServiceType(const char *serviceType);
79 const char *ServiceType() const { return fBrowsingType; }
80
81 void CurrentBonjourRecordsChanged(TList *bonjourRecords); //*SIGNAL*
82
83 void BonjourSocketReadyRead(); // private slot
84
85 ClassDef(TBonjourBrowser,0) // Browse hosts for specific bonjour service type
86};
87
88#endif
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
unsigned long ULong_t
Definition: RtypesCore.h:51
#define ClassDef(name, id)
Definition: Rtypes.h:324
TList * fBonjourRecords
static void DNSSD_API BonjourBrowseReply(DNSServiceRef, DNSServiceFlags, UInt_t, DNSServiceErrorType, const char *, const char *, const char *, void *)
Static Bonjour browser callback function.
void CurrentBonjourRecordsChanged(TList *bonjourRecords)
Emit CurrentBonjourRecordsChanged signal.
TList * CurrentRecords() const
TFileHandler * fBonjourSocketHandler
DNSServiceRef fDNSRef
void BonjourSocketReadyRead()
The Bonjour socket is ready for reading.
Int_t BrowseForServiceType(const char *serviceType)
Tell Bonjour to start browsing for a specific type of service.
TBonjourBrowser()
Default ctor.
virtual ~TBonjourBrowser()
Cleanup.
const char * ServiceType() const
A doubly linked list.
Definition: TList.h:44
Mother of all ROOT objects.
Definition: TObject.h:37
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition: TQObject.h:49
Basic string class.
Definition: TString.h:131