Ejemplo n.º 1
0
int64_t DNSSDPluginAPI::daemon_version() {
#ifdef kDNSServiceProperty_DaemonVersion
  uint32_t value;
  uint32_t size = sizeof(value);
  const char* property = kDNSServiceProperty_DaemonVersion;
  DNSServiceErrorType err = DNSServiceGetProperty(property, &value, &size);
  if (err != kDNSServiceErr_NoError) return -1;
  return (int64_t) value;
#else
  return -2;
#endif
}
Ejemplo n.º 2
0
bool CZeroconfWIN::IsZCdaemonRunning()
{
  uint32_t version;
  uint32_t size = sizeof(version);
  DNSServiceErrorType err = DNSServiceGetProperty(kDNSServiceProperty_DaemonVersion, &version, &size);
  if(err != kDNSServiceErr_NoError)
  {
    CLog::Log(LOGERROR, "ZeroconfWIN: Zeroconf can't be started probably because Apple's Bonjour Service isn't installed. You can get it by either installing Itunes or Apple's Bonjour Print Service for Windows (http://support.apple.com/kb/DL999)");
    CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(34300), g_localizeStrings.Get(34301), 10000, true);
    return false;
  }
  CLog::Log(LOGDEBUG, "ZeroconfWIN:Bonjour version is %d.%d", version / 10000, version / 100 % 100);
  return true;
}
Ejemplo n.º 3
0
/*
 * call-seq:
 *   service.get_property(property)
 *
 * Binding for DNSServiceGetProperty.  The only property currently supported in
 * DNSSD is DaemonVersion
 */
static VALUE
dnssd_service_s_get_property(VALUE klass, VALUE _property) {
  char * property;
  uint32_t result = 0;
  uint32_t size = sizeof(result);
  DNSServiceErrorType e;

  dnssd_utf8_cstr(_property, property);

  e = DNSServiceGetProperty(property, (void *)&result, &size);

  dnssd_check_error_code(e);

  /* as of this writing only a uint32_t will be returned */
  return ULONG2NUM(result);
}
Ejemplo n.º 4
0
STDMETHODIMP CDNSSD::GetProperty(BSTR prop, VARIANT * value )
{
	std::string			propUTF8;
	std::vector< BYTE >	byteArray;
	SAFEARRAY		*	psa			= NULL;
	BYTE			*	pData		= NULL;
	uint32_t			elems		= 0;
	DNSServiceErrorType	err			= 0;
	BOOL				ok = TRUE;

	// Convert BSTR params to utf8
	ok = BSTRToUTF8( prop, propUTF8 );
	require_action( ok, exit, err = kDNSServiceErr_BadParam );

	// Setup the byte array
	require_action( V_VT( value ) == ( VT_ARRAY|VT_UI1 ), exit, err = kDNSServiceErr_Unknown );
	psa = V_ARRAY( value );
	require_action( psa, exit, err = kDNSServiceErr_Unknown );
	require_action( SafeArrayGetDim( psa ) == 1, exit, err = kDNSServiceErr_Unknown );
	byteArray.reserve( psa->rgsabound[0].cElements );
	byteArray.assign( byteArray.capacity(), 0 );
	elems = ( uint32_t ) byteArray.capacity();

	// Call the function and package the return value in the Variant
	err = DNSServiceGetProperty( propUTF8.c_str(), &byteArray[ 0 ], &elems );
	require_noerr( err, exit );
	ok = ByteArrayToVariant( &byteArray[ 0 ], elems, value );
	require_action( ok, exit, err = kDNSSDError_Unknown );

exit:

	if ( psa )
	{
		SafeArrayUnaccessData( psa );
		psa = NULL;
	}

	return err;
}