Read Me About MoreNetworkSetup

1.0b1

Mac OS 8.5 introduced a new programming interface, Network Setup, that allows you to programmatically configure the network interfaces on the machine (AppleTalk, TCP/IP, Remote Access, etc). This sample includes two source code libraries which provide simplified access to Network Setup. The first, MoreNetworkSetup, is a simple wrapper around Network Setup. The second, NetworkSetupHelpers, provides high-level functionality (for example, turning AppleTalk on/off, switching TCP/IP configurations) that works with both Network Setup and on pre-Mac OS 8.5 systems.

The MoreNetworkSetup library requires the Network Setup Extension (which is installed by Mac OS 8.5 and above). NetworkSetupHelpers works with both Mac OS 8.5 (using the Network Setup programming interface) and older systems (using a previously undocumented programming interface). NetworkSetupHelpers requires Open Transport 1.1.1 or higher.

Packing List

The sample contains the following items:

Using the Sample

To use this sample, open the "NetworkSetupTest" folder and launch the NetworkSetupTest appliation. You can then choose whether you're interested in AppleTalk or TCP/IP. Choose a protocol by entering the corresponding letter. The program then displays a list of configurations for that protocol. You can switch to a new configuration by entering the letter for that configuration.

In addition, the sample demonstrates the following protocol-specific features:

Building the Sample

The sample was built using the standard MoreIsBetter build environment (CodeWarrior Pro 2 compiler with Universal Interfaces 3.2). You should be able to build the project in Code Warrior Pro 4 without difficulty. To build the project, open the "NetworkSetupTest.mcp" project file inside the "NetworkSetupTest" folder, select the "Fat" target, and choose Make from the Project menu. This will build NetworkSetupTest-68K, NetworkSetupTest-PPC, and NetworkSetupTest.

About the Libraries

MoreNetworkSetup

MoreNetworkSetup is a simple layer on top of Network Setup. Because of its history, Network Setup is somewhat more complex that it needs to be. MoreNetworkSetup reduces that complexity.

One way MoreNetworkSetup reduces complexity is that it allocates memory for you. Network Setup never allocates memory and returns it to you. It's an entirely pointer-based programming interface. This makes sense for a system library which may be used in a variety of contexts. MoreNetworkSetup can relax this restriction because we give you the source code. If you need to change the memory allocator (currently the Mac OS Memory Manager's NewPtr and DisposePtr), just go in there and change it.

To understand MoreNetworkSetup, you'll probably need a high-level overview of Network Setup itself. The documentation for Network Setup is still in progress, although the "NetworkSetupBigPicture.html"

NetworkSetupHelpers

The philosophy behind NetworkSetupHelpers is that it should provide a high-level abstraction to commonly needed features of Network Setup. It should also provide that abstraction on both Mac OS 8.5 (where Network Setup is installed) and older systems (through a previously undocumented API).

Caveats

The Network Setup programming interface is only available to PowerPC code. If the Network Setup library is available, you should always use it in preference to whatever old mechanism you're using. Therefore, if you base code on this sample, you must ensure that it runs as PowerPC code on PowerPC computers.

One possible workaround to this is to call the Network Setup programming interface from your 68K code via Mixed Mode. While this is possible, this sample doesn't include the relevant glue. If you run a 68K build of this code on a machine with Network Setup installed, it will detect that case and return an error.

Credits and Version History

If you find any problems with this sample, mail <DTS@apple.com> with "Attn: Quinn" as the first line of your mail and I'll try to fix them up.

1.0b1 (Nov 1998) was the first released version. It's based on a number of other samples that use Network Setup, including OTTCPWillDial and SwitchTCP.

Share and Enjoy.

Quinn "The Eskimo!"
Apple Developer Technical Support
Networking, Communications, Hardware

10 Nov 1998