QISAPlatform.h

/*
    File:       QISAPlatform.h
 
    Contains:   Interface to the platform-specific code.
 
    Written by: DTS
 
    Copyright:  Copyright © 2002 by Apple Computer, Inc., All Rights Reserved.
 
    Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
                ("Apple") in consideration of your agreement to the following terms, and your
                use, installation, modification or redistribution of this Apple software
                constitutes acceptance of these terms.  If you do not agree with these terms,
                please do not use, install, modify or redistribute this Apple software.
 
                In consideration of your agreement to abide by the following terms, and subject
                to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs
                copyrights in this original Apple software (the "Apple Software"), to use,
                reproduce, modify and redistribute the Apple Software, with or without
                modifications, in source and/or binary forms; provided that if you redistribute
                the Apple Software in its entirety and without modifications, you must retain
                this notice and the following text and disclaimers in all such redistributions of
                the Apple Software.  Neither the name, trademarks, service marks or logos of
                Apple Computer, Inc. may be used to endorse or promote products derived from the
                Apple Software without specific prior written permission from Apple.  Except as
                expressly stated in this notice, no other rights or licenses, express or implied,
                are granted by Apple herein, including but not limited to any patent rights that
                may be infringed by your derivative works or by other works in which the Apple
                Software may be incorporated.
 
                The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
                WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
                WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
                COMBINATION WITH YOUR PRODUCTS.
 
                IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
                CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
                GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
                OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
                (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
                ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
    Change History (most recent first):
 
$Log$
 
*/
 
#pragma once
 
/////////////////////////////////////////////////////////////////
 
// System interfaces
 
#if defined(__MACH__)
    #include <Carbon/Carbon.h>
#else
    #include <CFArray.h>
    #include <CFBundle.h>
    #include <CFDictionary.h>
    #include <CFString.h>
    #include <CFPropertyList.h>
#endif
 
/////////////////////////////////////////////////////////////////
 
// These are the only keys in port dictionary returned by QISACreatePortArray 
// that the common code cares about.  We either define them ourselves or get them 
// from System Configuration framework.
 
#if TARGET_RT_MAC_CFM
    #define kSCPropUserDefinedName                   CFSTR("UserDefinedName")                 /* CFString */
    #define kSCPropNetInterfaceHardware              CFSTR("Hardware")                        /* CFString */
        // Values of interest for kSCPropNetInterfaceHardware
        #define kSCEntNetModem                           CFSTR("Modem")                           /* CFDictionary */
        #define kSCEntNetEthernet                        CFSTR("Ethernet")                        /* CFDictionary */
#else
    #include <SystemConfiguration/SystemConfiguration.h>
#endif
 
/////////////////////////////////////////////////////////////////
 
#ifdef __cplusplus
extern "C" {
#endif
 
// Most of these routines are basically simple wrappers 
// that just calls through to the corresponding routine within the platform 
// plug-in.  QISAPlatformInit contains the smart code that actually connects to 
// correct plug-in.
 
extern pascal OSStatus QISACreateCCLArray(CFArrayRef *result, CFIndex *indexOfDefaultCCL);
    // Creates a CFArray containing all of the CCLs (Modem Scripts) on the 
    // system.  This is basically a call through to MoreSCCreateCCLArray 
    // (in MoreSCFCCLScanner).  See that routine for a detailed description 
    // of the parameters.
 
extern pascal OSStatus QISACreatePortArray(CFArrayRef *portArray);
    // Creates a CFArray containing all of the modem ports on the system. 
    // On Mac OS X, this is basically a call through to MoreSCCreatePortArray 
    // (in MoreSCFPortScanner). See that routine for a detailed description 
    // of the parameters.  On traditional Mac OS, the platform implements 
    // similar functionality on top of OT's port registry.
 
extern pascal OSStatus QISADoesNetworkConfigExist(CFStringRef userVisibleName, Boolean *exists);
    // Determines if the specified network configuration exists.  
    //
    // On entry, userVisibleName must not be NULL, exists must not be NULL
    // On success, *exists will be set to true if the network configuration 
    // specified by userVisibleName exists, and false otherwise
    //
    // IMPORTANT: The ultimate purpose of this routine is to allow the 
    // application to warn the user if they're going to overwrite an 
    // existing network configuration.  Currently the application does 
    // not do this.
 
extern pascal OSStatus QISAMakeNetworkConfig(CFMutableDictionaryRef configDict);
    // Creates a new network configuration based on the parameters in 
    // configDict.  The keys and values for this dictionary are 
    // defined in "QISA.h".  If an existing config with this same user 
    // visible name (kQISAKeyUserVisibleName), already exists, this routine 
    // will overwrite it.  Otherwise it will create a new configuration with 
    // that name.  Either way, it will make that configuration the active 
    // configuration.
    //
    // On entry, configDict will not be NULL.
 
extern pascal OSStatus QISACopyPlatformProperties(CFDictionaryRef *platDict);
    // This routine returns the platform properties dictionary.
    // 
    // On entry,  platDict must not be NULL
    // On entry, *platDict must be NULL
    // On success, *platDict will not be NULL
    // On error, *platDict will be NULL
 
extern pascal OSStatus QISAPlatformInit(CFBundleRef platformBundle);
    // Initialises this module.  The basic function of this routine 
    // is to find the appropriate platform plug-in (on traditional Mac, 
    // a CFM plug-in that works via Network Setup, or Mac OS X, a 
    // Mach-O plug-in that works via System Configuration framework), 
    // open it up, and initialises it.
    // 
    // On entry, platformBundle is a reference to the main application's 
    // bundle.
 
#ifdef __cplusplus
}
#endif