Apple Network Setup Network Card User Manual


 
CHAPTER 2
Using Network Setup
34 Reading and Writing Preferences
entityCount = GetHandleSize( (Handle) entityRefs ) / sizeof(CfgEntityRef);
for (entityIndex = 0; entityIndex < entityCount; entityIndex++) {
err = MyGetEntityUserVisibleName(dbRef,
&(*entityRefs)[entityIndex],
userVisibleName);
if (err == noErr) {
printf("%ld) "%#s"\n", entityIndex, userVisibleName);
}
}
}
MyCloseDatabaseAfterReading(dbRef, readArea);
}
if (entityRefs != nil) {
DisposeHandle( (Handle) entityRefs ); assert(MemError() ==
noErr);
}
if (err != noErr) {
printf("Failed with error %ld.\n", err);
}
}
Finding an Active Entity 2
Currently, only one entity can be active for any given network connection type.
This is not a restriction of Network Setup itself, but a limitation in the network
protocol stacks. When you look for an active entity for a particular network
protocol, you should be aware that, in the future, there may be more than one.
Because of the complexity of this algorithm and because its implementation
relies on concepts that haven’t been discussed yet, the steps and sample code
for finding an active entity are shown in “Working with Sets” (page 42), later in
this chapter.
Reading and Writing Preferences 2
Once you have an entity reference, reading and writing preferences in the entity
is a straightforward exercise. The basic steps are to open the entity, read and