-
Notifications
You must be signed in to change notification settings - Fork 3
/
ServiceBrowserDlg.h
91 lines (82 loc) · 3.57 KB
/
ServiceBrowserDlg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//
// Copyright (c) 2011 Mark Nelson
//
// This software is licensed under the OSI MIT License, contained in
// the file license.txt included with this project.
//
// ServiceBrowserDlg.h : header file
//
#pragma once
#include "afxcmn.h"
#include <unordered_map>
#include <unordered_set>
#include <string>
#include "dns_sd.h"
#include "afxwin.h"
// CServiceBrowserDlg dialog
class CServiceBrowserDlg : public CDialogEx
{
// Construction
public:
CServiceBrowserDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_SERVICEBROWSER_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
static const int BROWSER_TIMER = 1001;
CTreeCtrl m_Tree;
CEdit m_Text;
std::unordered_map<DNSServiceRef,int> m_ClientToFdMap;
std::unordered_map<DNSServiceRef,HTREEITEM> m_TreeInsertionMap;
std::unordered_set<std::string> m_ServiceTypes;
std::unordered_set<std::string> m_ServiceInstances;
//
// DNS-SD browser items
//
void StartBrowser();
afx_msg void OnTimer(UINT_PTR nIDEvent);
static void DNSSD_API IterateServiceTypes( DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *serviceName,
const char *regtype,
const char *replyDomain,
void *context );
static void DNSSD_API IterateServiceInstances( DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *serviceName,
const char *regtype,
const char *replyDomain,
void *context );
static void DNSSD_API ResolveInstance( DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *fullname,
const char *hosttarget,
uint16_t port,
uint16_t txtLen,
const unsigned char *txtRecord,
void *context );
static void DNSSD_API GetAddress( DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *hostname,
const struct sockaddr *address,
uint32_t ttl,
void *context );
};