Apple manual Using Network Setup, Protocol-specific Topics, cursor = UInt8 * packedPref

Models: Network Setup

1 184
Download 184 pages 5.56 Kb
Page 51
Image 51

C H A P T E R 2

Using Network Setup

cursor = (UInt8 *) packedPref;

//For each field in the unpacked pref, copy the field to the

//packed preference cursor and advance the cursor appropriately. if (unpackedPref->fCount != 1) goto prefDataErr;

*((UInt16 *) cursor) = unpackedPref->fCount; cursor += sizeof(UInt16);

*cursor = unpackedPref->fConfigMethod; cursor += sizeof(UInt8);

*((InetHost *) cursor) = unpackedPref->fIPAddress; cursor += sizeof(InetHost);

*((InetHost *) cursor) = unpackedPref->fSubnetMask; cursor += sizeof(InetHost);

//Writing an AppleTalk zone longer than 32 characters is an error.

if ( unpackedPref->fAppleTalkZone[0] > 32 ) goto prefDataErr;

BlockMoveData(unpackedPref->fAppleTalkZone, cursor, unpackedPref->fAppleTalkZone[0] + 1);

cursor += (unpackedPref->fAppleTalkZone[0] + 1); BlockMoveData(unpackedPref->path, cursor, 36); cursor += 36; BlockMoveData(unpackedPref->module, cursor, 32); cursor += 32;

*((UInt32 *) cursor) = unpackedPref->framing; cursor += sizeof(UInt32);

//Now calculate the packed preference size by taking the difference

//between the final cursor position and the initial cursor position. *packedPrefSize = (cursor - ((UInt8 *) packedPref));

return noErr;

prefDataErr: return paramErr;

}

Protocol-specific Topics

51

Page 51
Image 51
Apple manual Using Network Setup, Protocol-specific Topics, cursor = UInt8 * packedPref