Apple Network Setup manual

Models: Network Setup

1 184
Download 184 pages 5.56 Kb
Page 33
Image 33
The next routine, shown in Listing 2-6, opens the database for reading, gets the entity references for all of the TCP/IP network connection entities in the default area (using the MyGetEntitiesList routine in Listing 2-5), and prints their user-visible names. This routine calls a routine, MyGetEntityUserVisibleName, which hasn’t been documented yet. It is shown in Listing 2-9 in the section “Reading and Writing Preferences” (page 34).

C H A P T E R 2

Using Network Setup

}

}

return err;

}

The next routine, shown in Listing 2-6, opens the database for reading, gets the entity references for all of the TCP/IP network connection entities in the default area (using the MyGetEntitiesList routine in Listing 2-5), and prints their user-visible names. This routine calls a routine, MyGetEntityUserVisibleName, which hasn’t been documented yet. It is shown in Listing 2-9 in the section “Reading and Writing Preferences” (page 34).

Listing 2-6Printing the user-visible name for an entity

static void PrintAllTCPEntityNames(void)

{

OSStatus err;

CfgDatabaseRef dbRef;

CfgAreaID readArea;

CfgEntityRef **entityRefs;

ItemCount entityCount;

ItemCount entityIndex;

Str255 userVisibleName;

entityRefs = (CfgEntityRef **) NewHandle(0); err = MemError();

if (err == noErr) {

err = MyOpenDatabaseForReading(&dbRef, &readArea); if (err == noErr) {

err = MyGetEntitiesList(dbRef, readArea,

kOTCfgClassNetworkConnection, kOTCfgTypeTCPv4,

 

entityRefs, nil);

 

}

 

 

if (err ==

noErr) {

 

HLock(

(Handle) entityRefs );

assert(MemError() ==

noErr);

 

 

printf("List of TCP/IP Network Connection Entities\n");

Working with Entities

33

Page 33
Image 33
Apple Network Setup manual