00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TBonjourResolver
00013 #define ROOT_TBonjourResolver
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef ROOT_TObject
00030 #include "TObject.h"
00031 #endif
00032 #ifndef ROOT_TQObject
00033 #include "TQObject.h"
00034 #endif
00035 #ifndef ROOT_TInetAddress
00036 #include "TInetAddress.h"
00037 #endif
00038
00039 #if !defined(__CINT__)
00040 #include <dns_sd.h>
00041 #else
00042 typedef ULong_t DNSServiceRef;
00043 typedef UInt_t DNSServiceFlags;
00044 typedef Int_t DNSServiceErrorType;
00045 #endif
00046
00047 class TFileHandler;
00048 class TBonjourRecord;
00049
00050
00051 class TBonjourResolver : public TObject, public TQObject {
00052
00053 private:
00054 DNSServiceRef fDNSRef;
00055 TFileHandler *fBonjourSocketHandler;
00056 TInetAddress fHostAddress;
00057 Int_t fPort;
00058 TString fTXTRecord;
00059
00060 void *GetSender() { return this; }
00061
00062 #if !defined(__CINT__)
00063 static void DNSSD_API BonjourResolveReply(DNSServiceRef, DNSServiceFlags, UInt_t,
00064 DNSServiceErrorType,
00065 const char *, const char *,
00066 UShort_t, UShort_t, const char *, void *);
00067 #else
00068 static void BonjourResolveReply(DNSServiceRef, DNSServiceFlags, UInt_t,
00069 DNSServiceErrorType,
00070 const char *, const char *,
00071 UShort_t, UShort_t, const char *, void *);
00072 #endif
00073
00074 public:
00075 TBonjourResolver();
00076 virtual ~TBonjourResolver();
00077
00078 TInetAddress GetInetAddress() const { return fHostAddress; }
00079 Int_t GetPort() const { return fPort; }
00080 const char * GetTXTRecord() const { return fTXTRecord; }
00081
00082 Int_t ResolveBonjourRecord(const TBonjourRecord &record);
00083
00084 void RecordResolved(const TInetAddress *hostInfo, Int_t port);
00085
00086 void BonjourSocketReadyRead();
00087
00088 ClassDef(TBonjourResolver,0)
00089 };
00090
00091 #endif