Apple Network Setup Manuel d'utilisateur Page 31

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 184
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 30
CHAPTER 2
Using Network Setup
Working with Entities 31
Getting all entities. Set entityClass and entityType to the wildcard values
kCfgClassAnyEntity and kCfgTypeAnyEntity, respectively.
The entityRefs and entityInfos parameters are handles containing an array of
elements of type CfgEntityRef and CfgEntityInfo, respectively. You must create
these handles before calling MyGetEntitiesList. You can set entityInfos to NULL
if you’re not interested in the information returned in that handle. The
MyGetEntitiesList routine resizes the handles appropriately to hold
information about each of the entities that it finds.
The MyGetEntitiesList routine calls two key Network Setup functions:
OTCfgGetEntitiesCount to count the number of entities of the specified class and
type and OTCfgGetEntitiesList to get the actual entity information. The rest of
the MyGetEntitiesList routine is just memory management.
Listing 2-5 Finding all entities of a particular class and type
static OSStatus MyGetEntitiesList(CfgDatabaseRef dbRef,
CfgAreaID area,
OSType entityClass,
OSType entityType,
CfgEntityRef **entityRefs,
CfgEntityInfo **entityInfos)
{
OSStatus err;
ItemCount entityCount;
CfgEntityRef *paramRefs;
CfgEntityInfo *paramInfos;
SInt8 sRefs;
SInt8 sInfos;
assert(dbRef != nil);
assert(area != kInvalidCfgAreaID);
assert((entityRefs != nil) || (entityInfos != nil));
assert((entityRefs == nil) || (*entityRefs != nil));
assert((entityInfos == nil) || (*entityInfos != nil));
err = OTCfgGetEntitiesCount(dbRef, area, entityClass, entityType, &entityCount);
if ((err == noErr) && (entityRefs != nil)) {
Vue de la page 30
1 2 ... 26 27 28 29 30 31 32 33 34 35 36 ... 183 184

Commentaires sur ces manuels

Pas de commentaire