Apple Network Setup User Manual

Page 51

Advertising
background image

C H A P T E R 2

Using Network Setup

Protocol-specific Topics

51

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;

}

Advertising