Apple OS X manual Working with Nodes

Page 26

C H A P T E R 2

Working with Nodes

tContextData context = NULL;

dirStatus = dsGetDirNodeCount( gDirRef, &nodeCount ); printf( "Registered node count is: %lu\n", nodeCount ); if ( (dirStatus == eDSNoErr) && (nodeCount != 0) )

{

//Allocate a 32k buffer.

dataBuffer = dsDataBufferAllocate( gDirRef, 32 * 1024 ); if ( dataBuffer != NULL )

{

while ( (dirStatus == eDSNoErr) && (done == false) )

{

dirStatus = dsGetDirNodeList( gDirRef, dataBuffer, &bufferCount,

&context );

if ( dirStatus == eDSNoErr )

{

for ( index = 1; index <= bufferCount; index++ )

{

dirStatus = dsGetDirNodeName( gDirRef, dataBuffer,

index, &nodeName );

if ( dirStatus == eDSNoErr )

{

printf( "#%4ld ", index ); PrintNodeName( nodeName );

//Deallocate the data list containing the node

name.

dirStatus = dsDataListDeallocate( gDirRef, nodeName

);

free(nodeName);

}

else

{

printf("dsGetDirNodeName error = %ld\n", dirStatus

);

}

}

}

done = (context == NULL);

}

if (context != NULL)

{

dsReleaseContinueData( gDirRef, context );

}

dsDataBufferDeAllocate( gDirRef, dataBuffer ); dataBuffer = NULL;

}

}

} // ListNodes

void PrintNodeName ( tDataListPtr inNode ) { char* pPath;

pPath = dsGetPathFromList( gDirRef, inNode, "/" ); printf( "%s\n", pPath );

if ( pPath != NULL )

{

free( pPath ); pPath = NULL;

}

26Listing Registered Nodes

2007-01-08 © 2007 Apple Inc. All Rights Reserved.

Image 26
Contents Open Directory Programming Guide Apple Inc Contents N T E N T S Figures, Tables, and Listings G U R E S , T a B L E S , a N D L I S T I N G S Organization of This Document See AlsoIntroduction See Also Concepts Open Directory OverviewNodes 1Flow of an Open Directory request2An Open Directory request over a network Search Policies and Search Nodes Record TypesConstant Description Standard Attribute Types Standard attribute for storing a unique ID commonly foundAuthentication Native Attribute TypesBasic Authentication Open Directory Overview Local Windows Hash Authentication Local Cached User Authentication Disabled User Authentication Directory Native Authentication Directory ProxyOpen Directory, lookupd, and NetInfo 3lookupd and NetInfo interaction when using SSH Directory Service Command Line Utility DebuggingWorking with Nodes Listing Registered NodesWorking with Nodes Finding a Node Opening and Closing a Node Authenticating a User to a Node Directory Native Authentication Authenticating using directory native authenticationWorking with Nodes Working with Nodes Authenticating a User to a Node Working with Records Listing RecordsListing Records Getting Information About a Record’s Attribute Working with RecordsGetting Information About a Record’s Attribute Setting the Name of a Record Working with Records Listing 3-3Setting the name of a record Creating a Record and Adding an Attribute Void CreateRecord const tDirNodeReference inDirNodeRef Deleting a Record Working with Records Document Revision History Document Revision History
Related manuals
Manual 32 pages 7.58 Kb