Beispiel #1
0
// mDNS core calls this routine to initialise the platform-specific data.
mDNSexport mStatus mDNSPlatformInit(mDNS *const m)
	{
	int err;
	assert(m != NULL);

	// Tell mDNS core the names of this machine.

	// Set up the nice label
	m->nicelabel.c[0] = 0;
	GetUserSpecifiedFriendlyComputerName(&m->nicelabel);
	if (m->nicelabel.c[0] == 0) MakeDomainLabelFromLiteralString(&m->nicelabel, "Macintosh");

	// Set up the RFC 1034-compliant label
	m->hostlabel.c[0] = 0;
	GetUserSpecifiedRFC1034ComputerName(&m->hostlabel);
	if (m->hostlabel.c[0] == 0) MakeDomainLabelFromLiteralString(&m->hostlabel, "Macintosh");

	mDNS_GenerateFQDN(m);

	// Tell mDNS core about the network interfaces on this machine.
	err = SetupInterfaceList(m);

	// We don't do asynchronous initialization on the Posix platform, so by the time
	// we get here the setup will already have succeeded or failed.  If it succeeded,
	// we should just call mDNSCoreInitComplete() immediately.
	if (err == 0)
		mDNSCoreInitComplete(m, mStatus_NoError);

	return PosixErrorToStatus(err);
	}
Beispiel #2
0
extern mStatus mDNSPlatformPosixRefreshInterfaceList(mDNS *const m)
	{
	int err;
	ClearInterfaceList(m);
	err = SetupInterfaceList(m);
	return PosixErrorToStatus(err);
	}
Beispiel #3
0
mDNSexport int embedded_mDNSInit() {
	mStatus err;
	if (mDNSIsInitialized != 0) {
		return 0;
	}

	mDNSPlatformMemZero( &mDNSStorage, sizeof(mDNSStorage));
	mDNSPlatformMemZero( &platformSupport, sizeof(platformSupport));

//	mDNSStorage.AutoTargetServices = 1;

	err = mDNS_Init(
		&mDNSStorage,
		&platformSupport,
		rrcachestorage,
		RR_CACHE_SIZE,
		mDNS_Init_AdvertiseLocalAddresses,
		mDNS_Init_NoInitCallback,
		mDNS_Init_NoInitCallbackContext
	);
	if (err)
		return err;

#ifdef WIN32
	platformSupport.reportStatusFunc = embedded_mDNSInit_ReportStatus;
	err = SetupInterfaceList( &mDNSStorage );
	if (err)
		return err;
	err = uDNS_SetupDNSConfig( &mDNSStorage );
#endif

	if (err == 0) {
		mDNSIsInitialized = 1;
	}
	return err;
}