Logo ROOT   6.16/01
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#include "TObject.h"
30#include "TQObject.h"
31#include "TInetAddress.h"
32
33#if !defined(__CINT__)
34#include <dns_sd.h>
35#else
36typedef ULong_t DNSServiceRef;
37typedef UInt_t DNSServiceFlags;
38typedef Int_t DNSServiceErrorType;
39#endif
40
41class TFileHandler;
42class TBonjourRecord;
43
44
45class TBonjourResolver : public TObject, public TQObject {
46
47private:
48 DNSServiceRef fDNSRef;
53
54 void *GetSender() { return this; } // used to get gTQSender
55
56#if !defined(__CINT__)
57 static void DNSSD_API BonjourResolveReply(DNSServiceRef, DNSServiceFlags, UInt_t,
58 DNSServiceErrorType,
59 const char *, const char *,
60 UShort_t, UShort_t, const char *, void *);
61#else
62 static void BonjourResolveReply(DNSServiceRef, DNSServiceFlags, UInt_t,
63 DNSServiceErrorType,
64 const char *, const char *,
65 UShort_t, UShort_t, const char *, void *);
66#endif
67
68public:
70 virtual ~TBonjourResolver();
71
73 Int_t GetPort() const { return fPort; }
74 const char * GetTXTRecord() const { return fTXTRecord; }
75
77
78 void RecordResolved(const TInetAddress *hostInfo, Int_t port); //*SIGNAL*
79
80 void BonjourSocketReadyRead(); // private slot
81
82 ClassDef(TBonjourResolver,0) // Resolve Bonjour to actual IP address and port
83};
84
85#endif
unsigned short UShort_t
Definition: RtypesCore.h:36
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
TInetAddress GetInetAddress() const
void BonjourSocketReadyRead()
The Bonjour socket is ready for reading.
Int_t ResolveBonjourRecord(const TBonjourRecord &record)
Resolve Bonjour service to IP address and port.
void RecordResolved(const TInetAddress *hostInfo, Int_t port)
Emit RecordResolved signal.
TInetAddress fHostAddress
DNSServiceRef fDNSRef
TBonjourResolver()
Default ctor.
Int_t GetPort() const
TFileHandler * fBonjourSocketHandler
const char * GetTXTRecord() const
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.
virtual ~TBonjourResolver()
Cleanup.
This class represents an Internet Protocol (IP) address.
Definition: TInetAddress.h:36
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