mDNSPlatformEnvironment.h   [plain text]

// mDNS-PlatformEnvironment.h needs to ensure that the necessary mDNS types are defined,
// plus whatever additional types are needed to support a particular platform

// To add support for a new target platform with its own networking APIs and types,
// duplicate the "#elif __SOME_OTHER_OS__" section (including its two-line comment
// at the start) and add support for the new target platform in the new section.

#pragma once

#ifdef	__cplusplus
	extern "C" {

// ***************************************************************************
// Classic Mac (Open Transport) structures


// Headers needed for code on this platform
#include <OpenTptInternet.h>
#include <OpenTptClient.h>

typedef enum
	mOT_Reset = 0,
	} mOT_State;

typedef struct { TOptionHeader h; mDNSIPAddr multicastGroupAddress; mDNSIPAddr InterfaceAddress; } TIPAddMulticastOption;
typedef struct { TOptionHeader h; UInt32 flag; } TSetBooleanOption;

// TOptionBlock is a union of various types.
// What they all have in common is that they all start with a TOptionHeader.
typedef union  { TOptionHeader h; TIPAddMulticastOption m; TSetBooleanOption b; } TOptionBlock;

struct mDNS_PlatformSupport_struct
	EndpointRef ep;
	UInt32 mOTstate;				// mOT_State enum
	TOptionBlock optBlock;
	TOptMgmt optReq;
	long OTTimerTask;
	UInt32 nesting;

	// Platforms that support multi-homing will want a list of HostRecordSets instead of just one
	HostRecordSet hostset;

// ***************************************************************************
// Mac OS X structures


// Headers needed for code on this platform
#include <SystemConfiguration/SystemConfiguration.h>
#include <IOKit/pwr_mgt/IOPMLib.h>
#include <sys/socket.h>
#include <netinet/in.h>

struct mDNS_PlatformSupport_struct
	CFRunLoopTimerRef  CFTimer;
	SCDynamicStoreRef  Store;
	CFRunLoopSourceRef StoreRLS;
	io_connect_t       PowerConnection;
	io_object_t        PowerNotifier;
	CFRunLoopSourceRef PowerRLS;

// Set this symbol to 1 to do extra debug checks on malloc() and free()

extern void *mallocL(char *msg, unsigned int size);
extern void freeL(char *msg, void *x);
#define mallocL(X,Y) malloc(Y)
#define freeL(X,Y) free(Y)

// ***************************************************************************
// Placeholder for future platforms

#elif __SOME_OTHER_OS__

// ***************************************************************************
// Generic code for Unix-style platforms


#error Other platforms need to make sure that types like UInt16 are defined


#ifdef	__cplusplus