Sunshine latest
Self-hosted game stream host for Moonlight.
publish.cpp File Reference

Definitions for Windows mDNS service registration. More...

#include <winsock2.h>
#include <windows.h>
#include <windns.h>
#include <winerror.h>
#include "misc.h"
#include "src/config.h"
#include "src/logging.h"
#include "src/network.h"
#include "src/nvhttp.h"
#include "src/platform/common.h"
#include "src/thread_safe.h"
Include dependency graph for publish.cpp:

Classes

struct  _DNS_SERVICE_CANCEL
 
struct  _DNS_SERVICE_INSTANCE
 
struct  _DNS_SERVICE_REGISTER_REQUEST
 
class  platf::publish::mdns_registration_t
 

Macros

#define __SV(quote)   L##quote##sv
 
#define _FN(x, ret, args)
 
#define SERVICE_DOMAIN   "local"
 
#define SV(quote)   __SV(quote)
 

Typedefs

typedef DWORD(* _DnsServiceDeRegister_fn) (_In_ PDNS_SERVICE_REGISTER_REQUEST pRequest, _Inout_opt_ PDNS_SERVICE_CANCEL pCancel)
 
typedef VOID(* _DnsServiceFreeInstance_fn) (_In_ PDNS_SERVICE_INSTANCE pInstance)
 
typedef DWORD(* _DnsServiceRegister_fn) (_In_ PDNS_SERVICE_REGISTER_REQUEST pRequest, _Inout_opt_ PDNS_SERVICE_CANCEL pCancel)
 
typedef struct _DNS_SERVICE_CANCEL DNS_SERVICE_CANCEL
 
typedef struct _DNS_SERVICE_INSTANCE DNS_SERVICE_INSTANCE
 
typedef VOID WINAPI DNS_SERVICE_REGISTER_COMPLETE(_In_ DWORD Status, _In_ PVOID pQueryContext, _In_ PDNS_SERVICE_INSTANCE pInstance)
 
typedef struct _DNS_SERVICE_REGISTER_REQUEST DNS_SERVICE_REGISTER_REQUEST
 
typedef struct _DNS_SERVICE_CANCELPDNS_SERVICE_CANCEL
 
typedef struct _DNS_SERVICE_INSTANCEPDNS_SERVICE_INSTANCE
 
typedef DNS_SERVICE_REGISTER_COMPLETE * PDNS_SERVICE_REGISTER_COMPLETE
 
typedef struct _DNS_SERVICE_REGISTER_REQUESTPDNS_SERVICE_REGISTER_REQUEST
 

Functions

int platf::publish::load_funcs (HMODULE handle)
 
VOID WINAPI platf::publish::register_cb (DWORD status, PVOID pQueryContext, PDNS_SERVICE_INSTANCE pInstance)
 
std::unique_ptr< deinit_tplatf::publish::start ()
 Main entry point for publication of our service on macOS.
 

Variables

constexpr auto DNS_QUERY_REQUEST_VERSION1 = 0x1
 
constexpr auto DNS_QUERY_RESULTS_VERSION1 = 0x1
 
constexpr auto DNS_REQUEST_PENDING = 9506L
 
constexpr auto SERVICE_TYPE_DOMAIN = LSERVICE_TYPE "." "local"sv
 

Detailed Description

Definitions for Windows mDNS service registration.

Macro Definition Documentation

◆ _FN

#define _FN ( x,
ret,
args )
Value:
typedef ret(*x##_fn) args; \
static x##_fn x
Functions for handling command line arguments.
Definition entry_handler.cpp:39

Function Documentation

◆ start()

std::unique_ptr<::platf::deinit_t > platf::publish::start ( )

Main entry point for publication of our service on macOS.

This function initiates a connection to the macOS mDNS service and requests to register our Sunshine service. Registration will occur asynchronously (unless it fails immediately, which is probably only possible if the host machine is misconfigured).

Returns
Either nullptr (if the registration fails immediately) or a uniqur_ptr<deinit_t>, which will manage polling for a response from the mDNS service, and then, when deconstructed, will deregister the service.