view dstep/coreservices/osservices/NSLCore.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Jul 22, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.coreservices.osservices.NSLCore;

//import dstep.AvailabilityMacros;
import dstep.coreservices.carboncore.CarbonCore;

alias NSLError* NSLErrorPtr;
alias ushort NSLSearchState;
alias uint NSLEventCode;
alias uint NSLClientRef;
alias uint NSLRequestRef;
alias uint NSLOneBasedIndex;
alias char* NSLPath;
alias char* NSLServiceType;
alias Handle NSLServicesList;
alias char* NSLNeighborhood;
alias NSLClientAsyncInfo* NSLClientAsyncInfoPtr;
alias NSLPluginAsyncInfo* NSLPluginAsyncInfoPtr;
alias NSLMgrNotifyProcPtr NSLMgrNotifyUPP;
alias NSLClientNotifyProcPtr NSLClientNotifyUPP;
alias NSLTypedData* NSLTypedDataPtr;
alias NSLServicesListHeader* NSLServicesListHeaderPtr;
alias NSLPluginData* NSLPluginDataPtr;

extern (C)
{
	alias void function (NSLClientAsyncInfo*) NSLClientNotifyProcPtr;
	alias void function (NSLPluginAsyncInfo*) NSLMgrNotifyProcPtr;
}

enum
{
	kNSLMinSystemVersion = 0x0900,
	kNSLMinOTVersion = 0x0130
}

enum
{
	kNSLDefaultListSize = 256
}

enum
{
	kNSLURLDelimiter = ','
}

enum
{
	kNSLNoContext = 0
}

enum
{
	kNSLDuplicateSearchInProgress = 100,
	kNSLUserCanceled = userCanceledErr,
	kNSLInvalidEnumeratorRef = 0
}

enum
{
	kNSLSearchStateBufferFull = 1,
	kNSLSearchStateOnGoing = 2,
	kNSLSearchStateComplete = 3,
	kNSLSearchStateStalled = 4,
	kNSLWaitingForContinue = 5
}

enum
{
	kNSLServicesLookupDataEvent = 6,
	kNSLNeighborhoodLookupDataEvent = 7,
	kNSLNewDataEvent = 8,
	kNSLContinueLookupEvent = 9
}

struct NSLError
{
	int theErr;
	uint theContext;
}


struct NSLClientAsyncInfo
{
	void* clientContextPtr;
	void* mgrContextPtr;
	char* resultBuffer;
	int bufferLen;
	int maxBufferSize;
	uint startTime;
	uint intStartTime;
	uint maxSearchTime;
	uint alertInterval;
	uint totalItems;
	uint alertThreshold;
	ushort searchState;
	NSLError searchResult;
	uint searchDataType;
}


struct NSLPluginAsyncInfo
{
	void* mgrContextPtr;
	void* pluginContextPtr;
	void* pluginPtr;
	char* resultBuffer;
	int bufferLen;
	int maxBufferSize;
	uint maxSearchTime;
	uint reserved1;
	uint reserved2;
	uint reserved3;
	uint clientRef;
	uint requestRef;
	ushort searchState;
	int searchResult;
}


struct NSLTypedData
{
	uint dataType;
	uint lengthOfData;
}


struct NSLServicesListHeader
{
	uint numServices;
	uint logicalLen;
}


struct NSLPluginData
{
	int reserved1;
	int reserved2;
	int reserved3;
	ubyte supportsRegistration;
	ubyte isPurgeable;
	ushort totalLen;
	ushort dataTypeOffset;
	ushort serviceListOffset;
	ushort protocolListOffset;
	ushort commentStringOffset;
}

extern (C)
{
	NSLMgrNotifyUPP NewNSLMgrNotifyUPP (NSLMgrNotifyProcPtr userRoutine);
	NSLClientNotifyUPP NewNSLClientNotifyUPP (NSLClientNotifyProcPtr userRoutine);
	void DisposeNSLMgrNotifyUPP (NSLMgrNotifyUPP userUPP);
	void DisposeNSLClientNotifyUPP (NSLClientNotifyUPP userUPP);
	void InvokeNSLMgrNotifyUPP (NSLPluginAsyncInfo* thePluginAsyncInfo, NSLMgrNotifyUPP userUPP);
	void InvokeNSLClientNotifyUPP (NSLClientAsyncInfo* theClientAsyncInfo, NSLClientNotifyUPP userUPP);
}