OpenTptPPP.h

/*
    File:       OpenTptPPP.h
 
    Contains:   XTI-based PPP application programmer's interface. 
 
    Written by:     
 
    Copyright:  Copyright © 1996-1999 by Apple Computer, Inc., All Rights Reserved.
 
                You may incorporate this Apple sample source code into your program(s) without
                restriction. This Apple sample source code has been provided "AS IS" and the
                responsibility for its operation is yours. You are not permitted to redistribute
                this Apple sample source code as "Apple sample source code" after having made
                changes. If you're going to re-distribute the source, we require that you make
                it clear in the source that the code was descended from Apple sample source
                code, but that you've made changes.
 
    Change History (most recent first):
                7/22/1999   Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
                
 
*/
#ifndef __OPENTPTPPP__
#define __OPENTPTPPP__
 
#ifndef REZ
 
    #ifndef __OPENTPTINTERNET__
    #include <OpenTptInternet.h>
    #endif
    
#endif
 
 
/*******************************************************************************
*   Constants
********************************************************************************/
 
//
// OTCreateConfiguration name for PPP control endpoint
//
 
#define kPPPControlName     "ppp"   
    
 
//
// XTI Level
//
 
#define COM_PPP             'PPPC'
 
 
//
// Options limits
//
 
#define kPPPMaxIDLength                     255
#define kPPPMaxPasswordLength               255
#define kPPPMaxDTEAddressLength             127
#define kPPPMaxCallInfoLength               255
 
 
//
// Various XTI option value constants
//
 
#define kPPPStateInitial                    1
#define kPPPStateClosed                     2
#define kPPPStateClosing                    3
#define kPPPStateOpening                    4
#define kPPPStateOpened                     5
 
#define kPPPConnectionStatusIdle            1
#define kPPPConnectionStatusConnecting      2
#define kPPPConnectionStatusConnected       3
#define kPPPConnectionStatusDisconnecting   4
 
#define kPPPMinMRU                          0
#define kPPPMaxMRU                          4500
 
#define kIPCPTCPHdrCompressionDisabled      0
#define kIPCPTCPHdrCompressionEnabled       1
 
#define kPPPCompressionDisabled             0x00000000
#define kPPPProtoCompression                0x00000001
#define kPPPAddrCompression                 0x00000002
 
#define kPPPNoOutAuthentication             0
#define kPPPCHAPOrPAPOutAuthentication      1 
 
#define kCCReminderTimerDisabled            0
#define kCCIPIdleTimerDisabled              0
 
#define kPPPScriptTypeModem                 1
#define kPPPScriptTypeConnect               2
#define kPPPMaxScriptSize                   32000
 
#define kE164Address                        1
#define kPhoneAddress                       1
#define kCompoundPhoneAddress               2
#define kX121Address                        3
 
#define kPPPConnectionStatusDialogsFlag     0x00000001
#define kPPPConnectionRemindersFlag         0x00000002
#define kPPPConnectionFlashingIconFlag      0x00000004
#define kPPPOutPasswordDialogsFlag          0x00000008
#define kPPPAllAlertsDisabledFlag           0x00000000
#define kPPPAllAlertsEnabledFlag            0x0f
 
#define kPPPAsyncMapCharsNone               0
#define kPPPAsyncMapCharsXOnXOff            0x000a0000
#define kPPPAsyncMapCharsAll                0xffffffff
 
 
#ifndef REZ
 
    //
    // Option names
    //
    
    enum 
    {
        IPCP_OPT_GETREMOTEPROTOADDR     = (OTXTIName)0x7000,
        IPCP_OPT_GETLOCALPROTOADDR      = (OTXTIName)0x7001,
        IPCP_OPT_TCPHDRCOMPRESSION      = (OTXTIName)0x7002,
        LCP_OPT_PPPCOMPRESSION          = (OTXTIName)0x7003,
        LCP_OPT_MRU                     = (OTXTIName)0x7004,
        LCP_OPT_RCACCMAP                = (OTXTIName)0x7005,
        LCP_OPT_TXACCMAP                = (OTXTIName)0x7006,
        SEC_OPT_OUTAUTHENTICATION       = (OTXTIName)0x7007,
        SEC_OPT_ID                      = (OTXTIName)0x7008,
        SEC_OPT_PASSWORD                = (OTXTIName)0x7009,
        CC_OPT_REMINDERTIMER            = (OTXTIName)0x7010,
        CC_OPT_IPIDLETIMER              = (OTXTIName)0x7011,
        CC_OPT_DTEADDRESSTYPE           = (OTXTIName)0x7012,
        CC_OPT_DTEADDRESS               = (OTXTIName)0x7013,
        CC_OPT_CALLINFO                 = (OTXTIName)0x7014,
        CC_OPT_GETMISCINFO              = (OTXTIName)0x7015,
        PPP_OPT_GETCURRENTSTATE         = (OTXTIName)0x7016
    };
    
    
    //
    // Endpoint events
    //
    
    enum
    {
        kPPPEvent                       = (OTEventCode) kPROTOCOLEVENT | 0xf0000,
        kPPPConnectCompleteEvent        = (OTEventCode) kPPPEvent+1,
        kPPPSetScriptCompleteEvent      = (OTEventCode) kPPPEvent+2,
        kPPPDisconnectCompleteEvent     = (OTEventCode) kPPPEvent+3,
        kPPPDisconnectEvent             = (OTEventCode) kPPPEvent+4,
        kPPPIPCPUpEvent                 = (OTEventCode) kPPPEvent+5,
        kPPPIPCPDownEvent               = (OTEventCode) kPPPEvent+6,
        kPPPLCPUpEvent                  = (OTEventCode) kPPPEvent+7,
        kPPPLCPDownEvent                = (OTEventCode) kPPPEvent+8,
        kPPPLowerLayerUpEvent           = (OTEventCode) kPPPEvent+9,
        kPPPLowerLayerDownEvent         = (OTEventCode) kPPPEvent+10,
        kPPPAuthenticationStartedEvent  = (OTEventCode) kPPPEvent+11,
        kPPPAuthenticationFinishedEvent = (OTEventCode) kPPPEvent+12,
        kPPPDCEInitStartedEvent         = (OTEventCode) kPPPEvent+13,
        kPPPDCEInitFinishedEvent        = (OTEventCode) kPPPEvent+14,
        kPPPDCECallStartedEvent         = (OTEventCode) kPPPEvent+15,
        kPPPDCECallFinishedEvent        = (OTEventCode) kPPPEvent+16
    };
    
    
    /*******************************************************************************
    *   IOCTL constants for I_OTConnect, I_OTDisconnect and I_OTScript
    *   are defined in OpenTransport.h
    ********************************************************************************/
    
 
    /*******************************************************************************
    *   PPPMRULimits
    ********************************************************************************/
    
    typedef struct
    {
        UInt32  mruSize;            // proposed or actual
        UInt32  upperMRULimit;
        UInt32  lowerMRULimit;
    }
    PPPMRULimits;
    
    
    /*******************************************************************************
    *   CCMiscInfo
    ********************************************************************************/
    
    typedef struct
    {
        UInt32  connectionStatus;
        UInt32  connectionTimeElapsed;
        UInt32  connectionTimeRemaining;
        UInt32  bytesTransmitted;
        UInt32  bytesReceived;
        UInt32  reserved;
    }
    CCMiscInfo;
 
 
#endif  /* #ifndef REZ */
 
 
/*******************************************************************************
*   Gestalt Selectors for Open Transport-based Remote Access/PPP
*
*   Note: possible values for the version "stage" byte are:
*   development = 0x20, alpha = 0x40, beta = 0x60, final & release = 0x80
********************************************************************************/
 
//
// Response bit positions for gestaltOpenTptRemoteAccess.
//
 
#define kRAProductClientOnly                    2
#define kRAProductOnePortServer                 3
#define kRAProductManyPortServer                4
 
#define gestaltOpenTptRemoteAccessPresent       0
#define gestaltOpenTptRemoteAccessLoaded        1
#define gestaltOpenTptRemoteAccessClientOnly    kRAProductClientOnly
#define gestaltOpenTptRemoteAccessPServer       kRAProductOnePortServer
#define gestaltOpenTptRemoteAccessMPServer      kRAProductManyPortServer
#define gestaltOpenTptPPPPresent                5
#define gestaltOpenTptARAPPresent               6
 
#define gestaltOpenTptRemoteAccess              'otra'
#define gestaltOpenTptRemoteAccessVersion       'otrv'
 
 
#endif  /* __OPENTPTPPP__ */