Logo ROOT   6.07/09
Reference Guide
TBonjourResolver.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_TBonjourResolver
13 #define ROOT_TBonjourResolver
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TBonjourResolver //
19 // //
20 // This class consists of one main member function, //
21 // ResolveBonjourRecord(), that resolves the service to an actual //
22 // IP address and port number. The rest of the class wraps the various //
23 // bits of Bonjour service resolver. The static callback function //
24 // is marked with the DNSSD_API macro to make sure that the callback //
25 // has the correct calling convention on Windows. //
26 // //
27 //////////////////////////////////////////////////////////////////////////
28 
29 #ifndef ROOT_TObject
30 #include "TObject.h"
31 #endif
32 #ifndef ROOT_TQObject
33 #include "TQObject.h"
34 #endif
35 #ifndef ROOT_TInetAddress
36 #include "TInetAddress.h"
37 #endif
38 
39 #if !defined(__CINT__)
40 #include <dns_sd.h>
41 #else
42 typedef ULong_t DNSServiceRef;
43 typedef UInt_t DNSServiceFlags;
44 typedef Int_t DNSServiceErrorType;
45 #endif
46 
47 class TFileHandler;
48 class TBonjourRecord;
49 
50 
51 class TBonjourResolver : public TObject, public TQObject {
52 
53 private:
54  DNSServiceRef fDNSRef;
59 
60  void *GetSender() { return this; } // used to get gTQSender
61 
62 #if !defined(__CINT__)
63  static void DNSSD_API BonjourResolveReply(DNSServiceRef, DNSServiceFlags, UInt_t,
64  DNSServiceErrorType,
65  const char *, const char *,
66  UShort_t, UShort_t, const char *, void *);
67 #else
68  static void BonjourResolveReply(DNSServiceRef, DNSServiceFlags, UInt_t,
69  DNSServiceErrorType,
70  const char *, const char *,
71  UShort_t, UShort_t, const char *, void *);
72 #endif
73 
74 public:
76  virtual ~TBonjourResolver();
77 
79  Int_t GetPort() const { return fPort; }
80  const char * GetTXTRecord() const { return fTXTRecord; }
81 
83 
84  void RecordResolved(const TInetAddress *hostInfo, Int_t port); //*SIGNAL*
85 
86  void BonjourSocketReadyRead(); // private slot
87 
88  ClassDef(TBonjourResolver,0) // Resolve Bonjour to actual IP address and port
89 };
90 
91 #endif
void BonjourSocketReadyRead()
The Bonjour socket is ready for reading.
Int_t ResolveBonjourRecord(const TBonjourRecord &record)
Resolve Bonjour service to IP address and port.
unsigned short UShort_t
Definition: RtypesCore.h:36
This class represents an Internet Protocol (IP) address.
Definition: TInetAddress.h:40
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Definition: TQObject.h:53
const char * GetTXTRecord() const
Int_t GetPort() const
Basic string class.
Definition: TString.h:137
TBonjourResolver()
Default ctor.
int Int_t
Definition: RtypesCore.h:41
TInetAddress GetInetAddress() const
void RecordResolved(const TInetAddress *hostInfo, Int_t port)
Emit RecordResolved signal.
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual ~TBonjourResolver()
Cleanup.
DNSServiceRef fDNSRef
unsigned int UInt_t
Definition: RtypesCore.h:42
static void DNSSD_API BonjourResolveReply(DNSServiceRef, DNSServiceFlags, UInt_t, DNSServiceErrorType, const char *, const char *, UShort_t, UShort_t, const char *, void *)
Static Bonjour resolver callback function.
TFileHandler * fBonjourSocketHandler
unsigned long ULong_t
Definition: RtypesCore.h:51
Mother of all ROOT objects.
Definition: TObject.h:44
TInetAddress fHostAddress