NetworkSetup.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:66k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       NetworkSetup.h
  3.  
  4.      Contains:   Network Setup Interfaces
  5.  
  6.      Version:    Technology: 1.1.0
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1998-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __NETWORKSETUP__
  18. #define __NETWORKSETUP__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __FILES__
  23. #include "Files.h"
  24. #endif
  25. #ifndef __OPENTRANSPORT__
  26. #include "OpenTransport.h"
  27. #endif
  28. #ifndef __OPENTRANSPORTPROVIDERS__
  29. #include "OpenTransportProviders.h"
  30. #endif
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40. #if PRAGMA_STRUCT_ALIGN
  41.     #pragma options align=mac68k
  42. #elif PRAGMA_STRUCT_PACKPUSH
  43.     #pragma pack(push, 2)
  44. #elif PRAGMA_STRUCT_PACK
  45.     #pragma pack(2)
  46. #endif
  47. #if CALL_NOT_IN_CARBON
  48. #ifndef __NETWORKSETUPTYPES__
  49. #define __NETWORKSETUPTYPES__
  50. typedef struct OpaqueCfgDatabaseRef*    CfgDatabaseRef;
  51. typedef UInt32                          CfgAreaID;
  52. typedef OSType                          CfgEntityClass;
  53. typedef OSType                          CfgEntityType;
  54. struct CfgEntityRef {
  55.     CfgAreaID                       fLoc;
  56.     UInt32                          fReserved;
  57.     Str255                          fID;
  58. };
  59. typedef struct CfgEntityRef             CfgEntityRef;
  60. struct CfgResourceLocator {
  61.     FSSpec                          fFile;
  62.     UInt16                          fResID;
  63. };
  64. typedef struct CfgResourceLocator       CfgResourceLocator;
  65. struct CfgEntityInfo {
  66.     CfgEntityClass                  fClass;
  67.     CfgEntityType                   fType;
  68.     Str255                          fName;
  69.     CfgResourceLocator              fIcon;
  70. };
  71. typedef struct CfgEntityInfo            CfgEntityInfo;
  72. typedef void *                          CfgEntityAccessID;
  73. struct CfgPrefsHeader {
  74.     UInt16                          fSize;                      /* size includes this header*/
  75.     UInt16                          fVersion;
  76.     OSType                          fType;
  77. };
  78. typedef struct CfgPrefsHeader           CfgPrefsHeader;
  79. /*    -------------------------------------------------------------------------
  80.     Error codes
  81.     ------------------------------------------------------------------------- */
  82. enum {
  83.     kCfgErrDatabaseChanged      = -3290,                        /* database has changed since last call - close and reopen DB*/
  84.     kCfgErrAreaNotFound         = -3291,                        /* Area doesn't exist*/
  85.     kCfgErrAreaAlreadyExists    = -3292,                        /* Area already exists*/
  86.     kCfgErrAreaNotOpen          = -3293,                        /* Area needs to open first*/
  87.     kCfgErrConfigLocked         = -3294,                        /* Access conflict - retry later*/
  88.     kCfgErrEntityNotFound       = -3295,                        /* An entity with this name doesn't exist*/
  89.     kCfgErrEntityAlreadyExists  = -3296,                        /* An entity with this name already exists*/
  90.     kCfgErrPrefsTypeNotFound    = -3297,                        /* An record with this PrefsType doesn't exist*/
  91.     kCfgErrDataTruncated        = -3298,                        /* Data truncated when read buffer too small*/
  92.     kCfgErrFileCorrupted        = -3299                         /* The database format appears to be corrupted.*/
  93. };
  94. /*  reserve a 'free' tag for free blocks*/
  95. enum {
  96.     kCfgTypefree                = FOUR_CHAR_CODE('free')
  97. };
  98. /*    -------------------------------------------------------------------------
  99.     CfgEntityClass / CfgEntityType
  100.     The database can distinguish between several classes of objects and 
  101.     several types withing each class
  102.     Use of different classes allow to store type of information in the same database
  103.     Other entity classes and types can be defined by developers.
  104.     they should be unique and registered with Developer Tech Support (DTS)
  105.     ------------------------------------------------------------------------- */
  106. enum {
  107.     kCfgClassAnyEntity          = FOUR_CHAR_CODE('****'),
  108.     kCfgClassUnknownEntity      = FOUR_CHAR_CODE('????'),
  109.     kCfgTypeAnyEntity           = FOUR_CHAR_CODE('****'),
  110.     kCfgTypeUnknownEntity       = FOUR_CHAR_CODE('????')
  111. };
  112. /*    -------------------------------------------------------------------------
  113.     For CfgIsSameEntityRef
  114.     ------------------------------------------------------------------------- */
  115. enum {
  116.     kCfgIgnoreArea              = true,
  117.     kCfgDontIgnoreArea          = false
  118. };
  119. #endif  /* __NETWORKSETUPTYPES__ */
  120. /*******************************************************************************
  121. **  Configuration Information Access API 
  122. ********************************************************************************/
  123. /*    -------------------------------------------------------------------------
  124.     Database access
  125.     ------------------------------------------------------------------------- */
  126. #if CALL_NOT_IN_CARBON
  127. EXTERN_API( OSStatus )
  128. OTCfgOpenDatabase               (CfgDatabaseRef *       dbRef);
  129. /*
  130.     OTCfgOpenDatabase()
  131.     Inputs:     none
  132.     Outputs:    CfgDatabaseRef* dbRef           Reference to opened database
  133.     Returns:    OSStatus                        *** list errors ***
  134.     Opens the Configuration API for a given client. This call should be made prior to any other call.
  135. */
  136. EXTERN_API( OSStatus )
  137. OTCfgCloseDatabase              (CfgDatabaseRef *       dbRef);
  138. /*
  139.     OTCfgCloseDatabase()
  140.     Inputs:     CfgDatabaseRef* dbRef           Reference to opened database
  141.     Outputs:    CfgDatabaseRef* dbRef           Reference to opened database is cleared
  142.     Returns:    OSStatus                        *** list errors ***
  143.     Closes the Configuration API for a given client. This call should be made when the client no 
  144.     longer wants to use the Configuration API.  
  145. */
  146. /*    -------------------------------------------------------------------------
  147.     Area management
  148.     ------------------------------------------------------------------------- */
  149. EXTERN_API( OSStatus )
  150. OTCfgGetAreasCount              (CfgDatabaseRef         dbRef,
  151.                                  ItemCount *            itemCount);
  152. /*
  153.     OTCfgGetAreasCount()
  154.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  155.     Outputs:    ItemCount* itemCount            Number of entities defined
  156.     Returns:    OSStatus                        *** list errors ***
  157.     Returns the number of areas currently defined.
  158. */
  159. EXTERN_API( OSStatus )
  160. OTCfgGetAreasList               (CfgDatabaseRef         dbRef,
  161.                                  ItemCount *            itemCount,
  162.                                  CfgAreaID              areaID[],
  163.                                  Str255                 areaName[]);
  164. /*
  165.     OTCfgGetAreasList()
  166.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  167.                 ItemCount* itemCount            Number of entities requested
  168.     Outputs:    ItemCount* itemCount            Number of entities defined
  169.     Returns:    OSStatus                        *** list errors ***
  170.     Returns a list of area IDs and names. On entry, count should be set to whatever OTCfgGetAreasCount 
  171.     returned.  On exit, count contains the actual number of areas found. This can be less than the 
  172.     initial count value if areas were deleted in the meantime.  The id and name parameters are stored 
  173.     in arrays that should each be able to contain count values.
  174. */
  175. EXTERN_API( OSStatus )
  176. OTCfgGetCurrentArea             (CfgDatabaseRef         dbRef,
  177.                                  CfgAreaID *            areaID);
  178. /*
  179.     OTCfgGetCurrentArea()
  180.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  181.     Outputs:    CfgAreaID* areaID               ID of current area
  182.     Returns:    OSStatus                        *** list errors ***
  183.     Returns the id of the current area.
  184. */
  185. EXTERN_API( OSStatus )
  186. OTCfgSetCurrentArea             (CfgDatabaseRef         dbRef,
  187.                                  CfgAreaID              areaID);
  188. /*
  189.     OTCfgSetCurrentArea()
  190.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  191.                 CfgAreaID areaID                ID of area to make active
  192.     Outputs:    none
  193.     Returns:    OSStatus                        *** list errors ***
  194.     Sets the current area. If the area doesn't exist kCfgErrAreaNotFound is returned.
  195. */
  196. EXTERN_API( OSStatus )
  197. OTCfgCreateArea                 (CfgDatabaseRef         dbRef,
  198.                                  ConstStr255Param       areaName,
  199.                                  CfgAreaID *            areaID);
  200. /*
  201.     OTCfgCreateArea()
  202.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  203.                 ConstStr255Param areaName       Name of area to create
  204.     Outputs:    CfgAreaID* areaID               ID of newly created area
  205.     Returns:    OSStatus                        *** list errors ***
  206.     Creates a new area with the specified name. Then name must be unique or kCfgErrAreaAlreadyExists 
  207.     will be returned.
  208. */
  209. EXTERN_API( OSStatus )
  210. OTCfgDeleteArea                 (CfgDatabaseRef         dbRef,
  211.                                  CfgAreaID              areaID);
  212. /*
  213.     OTCfgDeleteArea()
  214.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  215.                 CfgAreaID areaID                ID of area to delete
  216.     Outputs:    none
  217.     Returns:    OSStatus                        *** list errors ***
  218.     Deletes the specified area. If the area doesn't exist kCfgErrAreaNotFound is returned.
  219. */
  220. EXTERN_API( OSStatus )
  221. OTCfgDuplicateArea              (CfgDatabaseRef         dbRef,
  222.                                  CfgAreaID              sourceAreaID,
  223.                                  CfgAreaID              destAreaID);
  224. /*
  225.     OTCfgDuplicateArea()
  226.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  227.                 CfgAreaID sourceAreaID          Area to duplicate
  228.                 CfgAreaID destAreaID            Area to contain duplicate
  229.     Outputs:    none
  230.     Returns:    OSStatus                        *** list errors ***
  231.     Duplicates the source area content into the destination area. Both areas should exist prior to 
  232.     making this call. If either area doesn't exist kCfgErrAreaNotFound is returned.
  233. */
  234. EXTERN_API( OSStatus )
  235. OTCfgSetAreaName                (CfgDatabaseRef         dbRef,
  236.                                  CfgAreaID              areaID,
  237.                                  ConstStr255Param       areaName,
  238.                                  CfgAreaID *            newAreaID);
  239. /*
  240.     OTCfgSetAreaName()
  241.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  242.                 CfgAreaID areaID                ID of area being named
  243.                 ConstStr255Param areaName       New name for area
  244.     Outputs:    CfgAreaID* newAreaID            ID of renamed area
  245.     Returns:    OSStatus                        *** list errors ***
  246.     Renames the specified area. A new id is returned: it should be used from now on. If the area 
  247.     doesn't exist kCfgErrAreaNotFound is returned.
  248. */
  249. EXTERN_API( OSStatus )
  250. OTCfgGetAreaName                (CfgDatabaseRef         dbRef,
  251.                                  CfgAreaID              areaID,
  252.                                  Str255                 areaName);
  253. /*
  254.     OTCfgGetAreaName()
  255.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  256.                 CfgAreaID areaID                ID of area being queried
  257.     Outputs:    Str255 areaName                 Name of area
  258.     Returns:    OSStatus                        *** list errors ***
  259.     Gets the name of the specified area. If the area doesn't exist kCfgErrAreaNotFound is returned.
  260. */
  261. /*    -------------------------------------------------------------------------
  262.     Configuration Database API
  263.     
  264.     Single Writer ONLY!!!
  265.     ------------------------------------------------------------------------- */
  266. /*    -------------------------------------------------------------------------
  267.     Opening an area for reading
  268.     ------------------------------------------------------------------------- */
  269. EXTERN_API( OSStatus )
  270. OTCfgOpenArea                   (CfgDatabaseRef         dbRef,
  271.                                  CfgAreaID              areaID);
  272. /*
  273.     OTCfgOpenArea()
  274.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  275.                 CfgAreaID areaID                ID of area to open
  276.     Outputs:    none
  277.     Returns:    OSStatus                        *** list errors ***
  278.     Opens the specified area for reading. If the area doesn't exist kCfgErrAreaNotFound is returned.
  279. */
  280. EXTERN_API( OSStatus )
  281. OTCfgCloseArea                  (CfgDatabaseRef         dbRef,
  282.                                  CfgAreaID              areaID);
  283. /*
  284.     OTCfgCloseArea()
  285.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  286.                 CfgAreaID areaID                ID of area to close
  287.     Outputs:    none
  288.     Returns:    OSStatus                        *** list errors ***
  289.     Closes an area opened for reading. If the area doesn't exist kCfgErrAreaNotFound is returned.  
  290.     Opening an area for writing All modifications to an area should be performed as part of a 
  291.     transaction.
  292. */
  293. /*
  294.     For write access
  295. */
  296. EXTERN_API( OSStatus )
  297. OTCfgBeginAreaModifications     (CfgDatabaseRef         dbRef,
  298.                                  CfgAreaID              readAreaID,
  299.                                  CfgAreaID *            writeAreaID);
  300. /*
  301.     OTCfgBeginAreaModifications()
  302.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  303.                 CfgAreaID readAreaID            ID of area opened for reading
  304.     Outputs:    CfgAreaID* writeAreaID          ID of area opened for modification
  305.     Returns:    OSStatus                        *** list errors ***
  306.     Opens the specified area for writing. A new area id is provided.  This area id should be used to 
  307.     enumerate, add, delete, read and write to the modified data. The original id can still be used to 
  308.     access the original unmodified data. If the area doesn't exist kCfgErrAreaNotFound is returned.
  309. */
  310. EXTERN_API( OSStatus )
  311. OTCfgCommitAreaModifications    (CfgDatabaseRef         dbRef,
  312.                                  CfgAreaID              readAreaID,
  313.                                  CfgAreaID              writeAreaID);
  314. /*
  315.     OTCfgCommitAreaModifications()
  316.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  317.                 CfgAreaID readAreaID            ID of area opened for reading
  318.                 CfgAreaID writeAreaID           ID of area opened for modification
  319.     Outputs:    none
  320.     Returns:    OSStatus                        *** list errors ***
  321.     Closes an area opened for writing.  All modifications are committed and readers are informed that 
  322.     the database changed state ( kCfgStateChangedErr ). The areaID should be the id of the original 
  323.     area.  If the area doesn't exist or the wrong id is passed, kCfgErrAreaNotFound is returned.
  324. */
  325. EXTERN_API( OSStatus )
  326. OTCfgAbortAreaModifications     (CfgDatabaseRef         dbRef,
  327.                                  CfgAreaID              readAreaID);
  328. /*
  329.     OTCfgAbortAreaModifications()
  330.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  331.                 CfgAreaID readAreaID            ID of area opened for reading
  332.     Outputs:    none
  333.     Returns:    OSStatus                        *** list errors ***
  334.     Closes an area opened for writing, discarding any modification. The areaID should be the id of 
  335.     the original area. If the area doesn't exist or the wrong id is passed kCfgErrAreaNotFound is 
  336.     returned.
  337. */
  338. /*
  339.     Working with entities
  340.     Entities can be manipulated as soon as an area has been opened.  The same calls work both for 
  341.     areas opened for reading or for modification. In the latter case, the calls can be used on the 
  342.     original or new area id to access the original data or the modified data.
  343. */
  344. /*
  345.     For everybody
  346.     Count receives the actual number of entities
  347. */
  348. EXTERN_API( OSStatus )
  349. OTCfgGetEntitiesCount           (CfgDatabaseRef         dbRef,
  350.                                  CfgAreaID              areaID,
  351.                                  CfgEntityClass         entityClass,
  352.                                  CfgEntityType          entityType,
  353.                                  ItemCount *            itemCount);
  354. /*
  355.     OTCfgGetEntitiesCount()
  356.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  357.                 CfgAreaID areaID                ID of area to count
  358.                 CfgEntityClass entityClass      Class of entities to count
  359.                 CfgEntityType entityType        Type of entities to count
  360.     Outputs:    ItemCount* itemCount            Count of matching entities
  361.     Returns:    OSStatus                        *** list errors ***
  362.     Returns the number of entities of the specified class and type in the specified area. To obtain 
  363.     all entities regardless of their class or type pass kCfgClassAnyEntity or kCfgTypeAnyEntity. If 
  364.     the area doesn't exist or the wrong id is passed kCfgErrAreaNotFound is returned.
  365. */
  366. /*
  367.     Count as input, is the number of entities to read;
  368.     count as output, receives the actual number of entities or the number you specified. 
  369. */
  370. EXTERN_API( OSStatus )
  371. OTCfgGetEntitiesList            (CfgDatabaseRef         dbRef,
  372.                                  CfgAreaID              areaID,
  373.                                  CfgEntityClass         entityClass,
  374.                                  CfgEntityType          entityType,
  375.                                  ItemCount *            itemCount,
  376.                                  CfgEntityRef           entityRef[],
  377.                                  CfgEntityInfo          entityInfo[]);
  378. /*
  379.     OTCfgGetEntitiesList()
  380.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  381.                 CfgAreaID areaID                ID of area to list
  382.                 CfgEntityClass entityClass      Class of entities to list
  383.                 CfgEntityType entityType        Type of entities to list
  384.                 ItemCount* itemCount            Count of entities requested
  385.     Outputs:    ItemCount* itemCount            Count of entities listed
  386.     Returns:    OSStatus                        *** list errors ***
  387.     Returns the list of entities of the specified class and type in the specified area. To obtain all 
  388.     entities regardless of their class or type pass kCfgClassAnyEntity or kCfgTypeAnyEntity. The 
  389.     count parameter should have the value obtained by CfgGetEntitiesCount.  On exit count may be less 
  390.     if some entities were deleted in the meantime. The id and info parameters should be arrays large 
  391.     enough to hold count entries. If the area doesn't exist or the wrong id is passed 
  392.     kCfgErrAreaNotFound is returned.  The info array contains information about each entity, 
  393.     including its class, type, name and the area of its icon:
  394.     struct CfgEntityInfo
  395.     {
  396.         CfgEntityClass      fClass;
  397.         CfgEntityType       fType;
  398.         ConstStr255Param    fName;
  399.         CfgResourceLocator  fIcon;
  400.     };
  401. */
  402. EXTERN_API( OSStatus )
  403. OTCfgCreateEntity               (CfgDatabaseRef         dbRef,
  404.                                  CfgAreaID              areaID,
  405.                                  const CfgEntityInfo *  entityInfo,
  406.                                  CfgEntityRef *         entityRef);
  407. /*
  408.     OTCfgCreateEntity()
  409.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  410.                 CfgAreaID areaID                ID of area to contain entity
  411.                 CfgEntityInfo* entityInfo       Information that defines the entity
  412.     Outputs:    CfgEntityRef* entityRef         Reference to entity created
  413.     Returns:    OSStatus                        *** list errors ***
  414.     Creates a new entity with the specified class, type and name and returns an id for it. If the 
  415.     area doesn't exist or the wrong id is passed kCfgErrAreaNotFound is returned. If there is already 
  416.     an entity with the same name kCfgErrEntityAlreadyExists is returned.
  417. */
  418. EXTERN_API( OSStatus )
  419. OTCfgDeleteEntity               (CfgDatabaseRef         dbRef,
  420.                                  const CfgEntityRef *   entityRef);
  421. /*
  422.     OTCfgDeleteEntity()
  423.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  424.                 CfgEntityRef* entityRef         Reference to entity to delete
  425.     Outputs:    none
  426.     Returns:    OSStatus                        *** list errors ***
  427.     Deletes the specified entity. If there is no entity with this id kCfgEntityNotfoundErr is returned
  428. */
  429. EXTERN_API( OSStatus )
  430. OTCfgDuplicateEntity            (CfgDatabaseRef         dbRef,
  431.                                  const CfgEntityRef *   entityRef,
  432.                                  const CfgEntityRef *   newEntityRef);
  433. /*
  434.     OTCfgDuplicateEntity()
  435.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  436.                 CfgEntityRef* entityRef         Reference to entity to duplicate
  437.     Outputs:    CfgEntityRef* newEntityRef      Reference to duplicate entity
  438.     Returns:    OSStatus                        *** list errors ***
  439.     Duplicates the specified entity. Both entities should exit. If any entity doesn't exist 
  440.     kCfgErrEntityNotFound is returned.
  441. */
  442. EXTERN_API( OSStatus )
  443. OTCfgSetEntityName              (CfgDatabaseRef         dbRef,
  444.                                  const CfgEntityRef *   entityRef,
  445.                                  ConstStr255Param       entityName,
  446.                                  CfgEntityRef *         newEntityRef);
  447. /*
  448.     OTCfgSetEntityName()
  449.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  450.                 CfgEntityRef* entityRef         Reference to entity to duplicate
  451.                 ConstStr255Param entityName     New name for entity
  452.     Outputs:    CfgEntityRef* newEntityRef      Reference to renamed entity
  453.     Returns:    OSStatus                        *** list errors ***
  454.     Renames the specified entity. If the entity doesn't exist kCfgEntityNotfoundErr is returned. If 
  455.     there is already an entity with that name kCfgErrEntityAlreadyExists is returned.
  456. */
  457. EXTERN_API( void )
  458. OTCfgGetEntityArea              (const CfgEntityRef *   entityRef,
  459.                                  CfgAreaID *            areaID);
  460. /*
  461.     OTCfgGetEntityArea()
  462.     Inputs:     CfgEntityRef *entityRef         Reference to an entity
  463.     Outputs:    CfgAreaID *areaID               ID of area that contains the entity
  464.     Returns:    none
  465.     Returns the area ID associated with the specified entity reference.
  466. */
  467. EXTERN_API( void )
  468. OTCfgGetEntityName              (const CfgEntityRef *   entityRef,
  469.                                  Str255                 entityName);
  470. /*
  471.     OTCfgGetEntityName()
  472.     Inputs:     CfgEntityRef *entityRef         Reference to an entity
  473.     Outputs:    Str255 entityName               Name of the entity
  474.     Returns:    none
  475.     Returns the entity name associated with the specified entity reference.
  476. */
  477. EXTERN_API( void )
  478. OTCfgChangeEntityArea           (CfgEntityRef *         entityRef,
  479.                                  CfgAreaID              newAreaID);
  480. /*
  481.     OTCfgChangeEntityArea()
  482.     Inputs:     CfgEntityRef *entityRef         Reference to an entity
  483.                 CfgAreaID newAreaID             ID of area to contain moved entity
  484.     Outputs:    none
  485.     Returns:    none
  486.     Changes the area ID associated with the specified entity reference. This effectively moves the 
  487.     entity to a different area.
  488. */
  489. /*    -------------------------------------------------------------------------
  490.     These API calls are for the protocol developers to compare the IDs.
  491.     ------------------------------------------------------------------------- */
  492. /*    -------------------------------------------------------------------------
  493.     For OTCfgIsSameEntityRef
  494.     ------------------------------------------------------------------------- */
  495. #endif  /* CALL_NOT_IN_CARBON */
  496. enum {
  497.     kOTCfgIgnoreArea            = kCfgIgnoreArea,
  498.     kOTCfgDontIgnoreArea        = kCfgDontIgnoreArea
  499. };
  500. #if CALL_NOT_IN_CARBON
  501. EXTERN_API( Boolean )
  502. OTCfgIsSameEntityRef            (const CfgEntityRef *   entityRef1,
  503.                                  const CfgEntityRef *   entityRef2,
  504.                                  Boolean                ignoreArea);
  505. /*
  506.     OTCfgIsSameEntityRef()
  507.     Inputs:     CfgEntityRef* entityRef1        Reference to an entity
  508.                 CfgEntityRef* entityRef2        Reference to another entity
  509.                 Boolean ignoreArea              If true, ignore the area ID
  510.     Outputs:    none
  511.     Returns:    Boolean                         If true, entity references match
  512.     Compare two entity references. If ignoreArea is true, and the two entity names are the same, then return 
  513.     true. If ignoreArea is false, then the area IDs must be the same, as well as the entity names 
  514.     must be the same, then can return true.
  515. */
  516. EXTERN_API( Boolean )
  517. OTCfgIsSameAreaID               (CfgAreaID              areaID1,
  518.                                  CfgAreaID              areaID2);
  519. /*
  520.     OTCfgIsSameAreaID()
  521.     Inputs:     CfgAreaID areaID1               ID of an area
  522.                 CfgAreaID areaID2               ID of another area
  523.     Outputs:    none
  524.     Returns:    Boolean                         If true, area IDs match
  525.     Compare two area IDs. Return true for matching area IDs, and return false for the different area IDs.
  526. */
  527. /*    -------------------------------------------------------------------------
  528.     Dealing with individual preferences
  529.     ------------------------------------------------------------------------- */
  530. /*    -------------------------------------------------------------------------
  531.     Open Preferences
  532.     if writer = true, GetPrefs and SetPrefs are allowed, else only GetPrefs is allowed.
  533.     ------------------------------------------------------------------------- */
  534. EXTERN_API( OSStatus )
  535. OTCfgOpenPrefs                  (CfgDatabaseRef         dbRef,
  536.                                  const CfgEntityRef *   entityRef,
  537.                                  Boolean                writer,
  538.                                  CfgEntityAccessID *    accessID);
  539. /*
  540.     OTCfgOpenPrefs()
  541.     Inputs:     CfgDatabaseRef dbRef            Reference to opened database
  542.                 CfgEntityRef* entityRef         Reference to an entity
  543.                 Boolean writer              If true, open for write
  544.     Outputs:    CfgEntityAccessID* accessID     ID for entity access
  545.     Returns:    OSStatus                        *** list errors ***
  546.     Open the specified entity and return the CfgEntityAccessID for the following access of the 
  547.     content of the entity. If writer is true, CfgGetPrefs and CfgSetPrefs are allowed, otherwise only 
  548.     CfgGetPrefs is allowed.
  549. */
  550. EXTERN_API( OSStatus )
  551. OTCfgClosePrefs                 (CfgEntityAccessID      accessID);
  552. /*
  553.     OTCfgClosePrefs()
  554.     Inputs:     CfgEntityAccessID* accessID     ID for entity to close
  555.     Outputs:    none
  556.     Returns:    OSStatus                        *** list errors ***
  557.     Close the entity with the specified CfgEntityAccessID.
  558. */
  559. /*    -------------------------------------------------------------------------
  560.     Get/Set Preferences
  561.     Accessing the content of an entity
  562.     These API calls are for the protocol developers. It supports multiple records per entity. Each 
  563.     record is identified by the prefsType and the size of the record. The protocol stack will provide 
  564.     the STRUCT to view the content of each record.
  565.     ------------------------------------------------------------------------- */
  566. EXTERN_API( OSStatus )
  567. OTCfgSetPrefs                   (CfgEntityAccessID      accessID,
  568.                                  OSType                 prefsType,
  569.                                  const void *           data,
  570.                                  ByteCount              length);
  571. /*
  572.     OTCfgSetPrefs()
  573.     Inputs:     CfgEntityAccessID* accessID     ID of entity to access
  574.                 OSType prefsType                Record type to set
  575.                 void* data                      Address of data
  576.                 ByteCount length                Number of bytes of data
  577.     Outputs:    none
  578.     Returns:    OSStatus                        *** list errors ***
  579.     Write the data to the specified record. The record is identified by the prefsType. If the entity 
  580.     is not opened for the writer, an error code is returned.
  581. */
  582. EXTERN_API( OSStatus )
  583. OTCfgGetPrefs                   (CfgEntityAccessID      accessID,
  584.                                  OSType                 prefsType,
  585.                                  void *                 data,
  586.                                  ByteCount              length);
  587. /*
  588.     OTCfgGetPrefs()
  589.     Inputs:     CfgEntityAccessID* accessID     ID of entity to access
  590.                 OSType prefsType                Record type to get
  591.                 void* data                      Address for data
  592.                 ByteCount length                Number of bytes of data requested
  593.     Outputs:    none
  594.     Returns:    OSStatus                        *** list errors ***
  595.     Read the data from the specified record to the passed buffer. The record is identified by the 
  596.     prefsType. If the passed buffer is too small, kCfgErrDataTruncated is returned, but will copy as 
  597.     many data as possible to the buffer.
  598. */
  599. EXTERN_API( OSStatus )
  600. OTCfgGetPrefsSize               (CfgEntityAccessID      accessID,
  601.                                  OSType                 prefsType,
  602.                                  ByteCount *            length);
  603. /*
  604.     OTCfgGetPrefsSize()
  605.     Inputs:     CfgEntityAccessID* accessID     ID of entity to access
  606.                 OSType prefsType                Record type to get
  607.                 ByteCount length                Number of bytes of data available
  608.     Outputs:    none
  609.     Returns:    OSStatus                        *** list errors ***
  610.     Returns the length, in bytes, of the specified record. The record is identified by the prefsType.
  611. */
  612. /*    -------------------------------------------------------------------------
  613.     Get table of contents for prefs
  614.     ------------------------------------------------------------------------- */
  615. EXTERN_API( OSStatus )
  616. OTCfgGetPrefsTOCCount           (CfgEntityAccessID      accessID,
  617.                                  ItemCount *            itemCount);
  618. /*
  619.     OTCfgGetPrefsTOCCount()
  620.     Inputs:     CfgEntityAccessID* accessID     ID of entity to access
  621.     Outputs:    ItemCount* itemCount            Number of entries available
  622.     Returns:    OSStatus                        *** list errors ***
  623.     Get the count of all the record headers in the entity. Return the number of records in the count. 
  624. */
  625. EXTERN_API( OSStatus )
  626. OTCfgGetPrefsTOC                (CfgEntityAccessID      accessID,
  627.                                  ItemCount *            itemCount,
  628.                                  CfgPrefsHeader         PrefsTOC[]);
  629. /*
  630.     OTCfgGetPrefsTOC()
  631.     Inputs:     CfgEntityAccessID* accessID     ID of entity to access
  632.                 ItemCount* itemCount            Number of entries requested
  633.     Outputs:    ItemCount* itemCount            Number of entries available
  634.                 CfgPrefsHeader PrefsTOC[]       Table of entries
  635.     Returns:    OSStatus                        *** list errors ***
  636.     Get the list of all the record headers in the entity. Return the number of records in the count. 
  637.     If the PrefsTOC is specified, it has to be big enough to hold all the record headers. If the 
  638.     PrefsTOC is null, only the count is returned.
  639. */
  640. EXTERN_API( SInt16 )
  641. OTCfgEncrypt                    (UInt8 *                key,
  642.                                  UInt8 *                data,
  643.                                  SInt16                 dataLen);
  644. /*
  645.     OTCfgEncrypt()
  646.     Inputs:     UInt8 *key                      encryption key ( user name )
  647.                 UInt8 *data                     data to encrypt ( password )
  648.                 SInt16 dataLen                  length of data to encrypt
  649.     Outputs:    UInt8 *data                     encrypted data
  650.     Returns:    SInt16                          length of encrypted data
  651.     Encrypt the password, using the user name as the encryption key.  Return the encrypted password and its length.  
  652. */
  653. EXTERN_API( SInt16 )
  654. OTCfgDecrypt                    (UInt8 *                key,
  655.                                  UInt8 *                data,
  656.                                  SInt16                 dataLen);
  657. /*
  658.     OTCfgDecrypt()
  659.     Inputs:     UInt8 *key                      encryption key ( user name )
  660.                 UInt8 *data                     data to decrypt ( password )
  661.                 SInt16 dataLen                  length of data to decrypt
  662.     Outputs:    UInt8 *data                     decrypted data
  663.     Returns:    SInt16                          length of decrypted data
  664.     Decrypt the password, using the user name as the encryption key.  Return the decrypted password and its length.  
  665. */
  666. EXTERN_API( Handle )
  667. OTCfgGetDefault                 (ResType                entityType,
  668.                                  ResType                entityClass,
  669.                                  ResType                recordType);
  670. #endif  /* CALL_NOT_IN_CARBON */
  671. #if CALL_NOT_IN_CARBON
  672. EXTERN_API( OSStatus )
  673. OTCfgInstallNotifier            (CfgDatabaseRef         dbRef,
  674.                                  CfgEntityClass         theClass,
  675.                                  CfgEntityType          theType,
  676.                                  OTNotifyProcPtr        notifier,
  677.                                  void *                 contextPtr);
  678. EXTERN_API( OSStatus )
  679. OTCfgRemoveNotifier             (CfgDatabaseRef         dbRef,
  680.                                  CfgEntityClass         theClass,
  681.                                  CfgEntityType          theType);
  682. #endif  /* CALL_NOT_IN_CARBON */
  683. typedef UInt16                          OTCfgIRPortSetting;
  684. enum {
  685.     kOTCfgTypeStruct            = FOUR_CHAR_CODE('stru'),
  686.     kOTCfgTypeElement           = FOUR_CHAR_CODE('elem'),
  687.     kOTCfgTypeVector            = FOUR_CHAR_CODE('vect')
  688. };
  689. /*    -------------------------------------------------------------------------
  690.     CfgEntityClass / CfgEntityType
  691.     The database can distinguish between several classes of objects and 
  692.     several types withing each class
  693.     Use of different classes allow to store type of information in the same database
  694.     Other entity classes and types can be defined by developers.
  695.     they should be unique and registered with Developer Tech Support (DTS)
  696.     ------------------------------------------------------------------------- */
  697. enum {
  698.     kOTCfgClassNetworkConnection = FOUR_CHAR_CODE('otnc'),
  699.     kOTCfgClassGlobalSettings   = FOUR_CHAR_CODE('otgl'),
  700.     kOTCfgClassServer           = FOUR_CHAR_CODE('otsv'),
  701.     kOTCfgTypeGeneric           = FOUR_CHAR_CODE('otan'),
  702.     kOTCfgTypeAppleTalk         = FOUR_CHAR_CODE('atlk'),
  703.     kOTCfgTypeTCPv4             = FOUR_CHAR_CODE('tcp4'),
  704.     kOTCfgTypeTCPv6             = FOUR_CHAR_CODE('tcp6'),
  705.     kOTCfgTypeRemote            = FOUR_CHAR_CODE('ara '),
  706.     kOTCfgTypeDial              = FOUR_CHAR_CODE('dial'),
  707.     kOTCfgTypeModem             = FOUR_CHAR_CODE('modm'),
  708.     kOTCfgTypeInfrared          = FOUR_CHAR_CODE('infr'),
  709.     kOTCfgClassSetOfSettings    = FOUR_CHAR_CODE('otsc'),
  710.     kOTCfgTypeSetOfSettings     = FOUR_CHAR_CODE('otst'),
  711.     kOTCfgTypeDNS               = FOUR_CHAR_CODE('dns ')
  712. };
  713. /*******************************************************************************
  714. ** Preferences Structures
  715. ********************************************************************************/
  716. enum {
  717.     kOTCfgIndexSetsActive       = 0,
  718.     kOTCfgIndexSetsEdit         = 1,
  719.     kOTCfgIndexSetsLimit        = 2                             /*    last value, no comma*/
  720. };
  721. struct CfgSetsStruct {
  722.     UInt32                          fFlags;
  723.     UInt32                          fTimes[2];
  724. };
  725. typedef struct CfgSetsStruct            CfgSetsStruct;
  726. struct CfgSetsElement {
  727.     CfgEntityRef                    fEntityRef;
  728.     CfgEntityInfo                   fEntityInfo;
  729. };
  730. typedef struct CfgSetsElement           CfgSetsElement;
  731. struct CfgSetsVector {
  732.     UInt32                          fCount;
  733.     CfgSetsElement                  fElements[1];
  734. };
  735. typedef struct CfgSetsVector            CfgSetsVector;
  736. /*  Common  */
  737. enum {
  738.                                                                 /*    connection */
  739.     kOTCfgTypeConfigName        = FOUR_CHAR_CODE('cnam'),
  740.     kOTCfgTypeConfigSelected    = FOUR_CHAR_CODE('ccfg'),       /*    transport options  */
  741.     kOTCfgTypeUserLevel         = FOUR_CHAR_CODE('ulvl'),
  742.     kOTCfgTypeWindowPosition    = FOUR_CHAR_CODE('wpos')
  743. };
  744. /*  AppleTalk   */
  745. enum {
  746.                                                                 /*    connection */
  747.     kOTCfgTypeAppleTalkPrefs    = FOUR_CHAR_CODE('atpf'),
  748.     kOTCfgTypeAppleTalkVersion  = FOUR_CHAR_CODE('cvrs'),
  749.     kOTCfgTypeAppleTalkLocks    = FOUR_CHAR_CODE('lcks'),
  750.     kOTCfgTypeAppleTalkPort     = FOUR_CHAR_CODE('port'),
  751.     kOTCfgTypeAppleTalkProtocol = FOUR_CHAR_CODE('prot'),
  752.     kOTCfgTypeAppleTalkPassword = FOUR_CHAR_CODE('pwrd'),
  753.     kOTCfgTypeAppleTalkPortFamily = FOUR_CHAR_CODE('ptfm')      /*    transport options  */
  754. };
  755. enum {
  756.     kOTCfgIndexAppleTalkAARP    = 0,
  757.     kOTCfgIndexAppleTalkDDP     = 1,
  758.     kOTCfgIndexAppleTalkNBP     = 2,
  759.     kOTCfgIndexAppleTalkZIP     = 3,
  760.     kOTCfgIndexAppleTalkATP     = 4,
  761.     kOTCfgIndexAppleTalkADSP    = 5,
  762.     kOTCfgIndexAppleTalkPAP     = 6,
  763.     kOTCfgIndexAppleTalkASP     = 7,
  764.     kOTCfgIndexAppleTalkLast    = 7
  765. };
  766. struct OTCfgAppleTalkPrefs {
  767.     UInt16                          fVersion;
  768.     UInt16                          fNumPrefs;
  769.     OTPortRef                       fPort;
  770.     void *                          fLink;
  771.     void *                          fPrefs[8];
  772. };
  773. typedef struct OTCfgAppleTalkPrefs      OTCfgAppleTalkPrefs;
  774. struct OTCfgAARPPrefs {
  775.     UInt16                          fVersion;
  776.     UInt16                          fSize;
  777.     UInt32                          fAgingCount;
  778.     UInt32                          fAgingInterval;
  779.     OTByteCount                     fProtAddrLen;
  780.     OTByteCount                     fHWAddrLen;
  781.     UInt32                          fMaxEntries;
  782.     OTByteCount                     fProbeInterval;
  783.     OTByteCount                     fProbeRetryCount;
  784.     OTByteCount                     fRequestInterval;
  785.     OTByteCount                     fRequestRetryCount;
  786. };
  787. typedef struct OTCfgAARPPrefs           OTCfgAARPPrefs;
  788. struct OTCfgDDPPrefs {
  789.     UInt16                          fVersion;
  790.     UInt16                          fSize;
  791.     UInt32                          fTSDUSize;
  792.     UInt8                           fLoadType;
  793.     UInt8                           fNode;
  794.     UInt16                          fNetwork;
  795.     UInt16                          fRTMPRequestLimit;
  796.     UInt16                          fRTMPRequestInterval;
  797.     UInt32                          fAddressGenLimit;
  798.     UInt32                          fBRCAgingInterval;
  799.     UInt32                          fRTMPAgingInterval;
  800.     UInt32                          fMaxAddrTries;
  801.     Boolean                         fDefaultChecksum;
  802.     Boolean                         fIsFixedNode;
  803.     UInt8                           fMyZone[33];
  804. };
  805. typedef struct OTCfgDDPPrefs            OTCfgDDPPrefs;
  806. struct OTCfgATPFPrefs {
  807.     OTCfgAppleTalkPrefs             fAT;
  808.     OTCfgAARPPrefs                  fAARP;
  809.     OTCfgDDPPrefs                   fDDP;
  810.     char                            fFill[122];
  811. };
  812. typedef struct OTCfgATPFPrefs           OTCfgATPFPrefs;
  813. /*  Infrared    */
  814. enum {
  815.     kOTCfgTypeInfraredPrefs     = FOUR_CHAR_CODE('atpf'),
  816.     kOTCfgTypeInfraredGlobal    = FOUR_CHAR_CODE('irgo')
  817. };
  818. struct OTCfgIRPrefs {
  819.     CfgPrefsHeader                  fHdr;
  820.     OTPortRef                       fPort;                      /*    OT port id*/
  821.     OTCfgIRPortSetting              fPortSetting;               /*    Ir protocol,  irda or irtalk*/
  822.     Boolean                         fNotifyOnDisconnect;        /*    notify user on irda disconnect?*/
  823.     Boolean                         fDisplayIRControlStrip;     /*    show ir control strip?*/
  824.     Point                           fWindowPosition;            /*    The position of the editor window*/
  825. };
  826. typedef struct OTCfgIRPrefs             OTCfgIRPrefs;
  827. struct OTCfgIRGlobal {
  828.     CfgPrefsHeader                  fHdr;                       /* standard prefererences header*/
  829.     UInt32                          fOptions;                   /* options bitmask*/
  830.     UInt32                          fNotifyMask;                /* Notification options.*/
  831.     UInt32                          fUnloadTimeout;             /* Unload timeout (in milliseconds)*/
  832. };
  833. typedef struct OTCfgIRGlobal            OTCfgIRGlobal;
  834. /*  TCP/IP v4   */
  835. enum {
  836.                                                                 /*    connection */
  837.     kOTCfgTypeTCPalis           = FOUR_CHAR_CODE('alis'),
  838.     kOTCfgTypeTCPcvrs           = FOUR_CHAR_CODE('cvrs'),
  839.     kOTCfgTypeTCPdcid           = FOUR_CHAR_CODE('dcid'),
  840.     kOTCfgTypeTCPdclt           = FOUR_CHAR_CODE('dclt'),
  841.     kOTCfgTypeTCPdtyp           = FOUR_CHAR_CODE('dtyp'),
  842.     kOTCfgTypeTCPidns           = FOUR_CHAR_CODE('idns'),
  843.     kOTCfgTypeTCPihst           = FOUR_CHAR_CODE('ihst'),
  844.     kOTCfgTypeTCPiitf           = FOUR_CHAR_CODE('iitf'),
  845.     kOTCfgTypeTCPara            = FOUR_CHAR_CODE('ipcp'),
  846.     kOTCfgTypeTCPirte           = FOUR_CHAR_CODE('irte'),
  847.     kOTCfgTypeTCPisdm           = FOUR_CHAR_CODE('isdm'),
  848.     kOTCfgTypeTCPstng           = FOUR_CHAR_CODE('stng'),
  849.     kOTCfgTypeTCPunld           = FOUR_CHAR_CODE('unld'),
  850.     kOTCfgTypeTCPVersion        = FOUR_CHAR_CODE('cvrs'),       /*    Version */
  851.     kOTCfgTypeTCPDevType        = FOUR_CHAR_CODE('dvty'),
  852.     kOTCfgTypeTCPPrefs          = FOUR_CHAR_CODE('iitf'),
  853.     kOTCfgTypeTCPServersList    = FOUR_CHAR_CODE('idns'),
  854.     kOTCfgTypeTCPSearchList     = FOUR_CHAR_CODE('ihst'),
  855.     kOTCfgTypeTCPRoutersList    = FOUR_CHAR_CODE('irte'),
  856.     kOTCfgTypeTCPDomainsList    = FOUR_CHAR_CODE('isdm'),
  857.     kOTCfgTypeTCPPort           = FOUR_CHAR_CODE('port'),       /*    Ports */
  858.     kOTCfgTypeTCPProtocol       = FOUR_CHAR_CODE('prot'),
  859.     kOTCfgTypeTCPPassword       = FOUR_CHAR_CODE('pwrd'),       /*    Password */
  860.     kOTCfgTypeTCPLocks          = FOUR_CHAR_CODE('stng'),       /*    locks */
  861.     kOTCfgTypeTCPUnloadType     = FOUR_CHAR_CODE('unld')        /*    transport options  */
  862. };
  863. struct OTCfgIDNSPrefs {
  864.     short                           fCount;
  865.     InetHost                        fAddressesList;
  866. };
  867. typedef struct OTCfgIDNSPrefs           OTCfgIDNSPrefs;
  868. struct OTCfgHSTFPrefs {
  869.     char                            fPrimaryInterfaceIndex;     /*    always 1 in OT 1.0 / 1.1*/
  870.                                                                 /*    this structure IS packed!*/
  871.     UInt8                           fLocalDomainName[256];
  872.                                                                 /*    followed by */
  873.     UInt8                           admindomain[256];
  874. };
  875. typedef struct OTCfgHSTFPrefs           OTCfgHSTFPrefs;
  876. /*  This is your worst case, a fixed size structure, tacked on after a variable length string.*/
  877. /*  Use the macro to help access the movable beast. */
  878. #define kIITFPartP( h ) ( (OTCfgIITFPrefsPart*) &( (**( (OTCfgIITFPrefs**) h )).fAppleTalkZone[ (**( (OTCfgIITFPrefs**) h )).fAppleTalkZone[0] + 1 ] ) )
  879. /*
  880.     This structure also contains an IP address and subnet mask that are not aligned on a four byte boundary.  
  881.     In order to avoid compiler warnings, and the possibility of code that won't work, 
  882.     these fields are defined here as four character arrays.  
  883.     It is suggested that BlockMoveData be used to copy to and from a field of type InetHost.  
  884. */
  885. struct OTCfgIITFPrefsPart {
  886.     char                            path[36];
  887.     char                            module[32];
  888.     unsigned long                   framing;
  889. };
  890. typedef struct OTCfgIITFPrefsPart       OTCfgIITFPrefsPart;
  891. struct OTCfgIITFPrefs {
  892.     short                           fCount;
  893.     UInt8                           fConfigMethod;
  894.                                                                 /*    this structure IS packed!*/
  895.                                                                 /*    Followed by:*/
  896.     UInt8                           fIPAddress[4];
  897.     UInt8                           fSubnetMask[4];
  898.     UInt8                           fAppleTalkZone[256];
  899.                                                                 /*    this structure IS packed!*/
  900.     UInt8                           fFiller;
  901.     OTCfgIITFPrefsPart              part;
  902. };
  903. typedef struct OTCfgIITFPrefs           OTCfgIITFPrefs;
  904. struct OTCfgIRTEEntry {
  905.     InetHost                        fToHost;                    /*    always 0;*/
  906.     InetHost                        fViaHost;                   /*    router address;*/
  907.     short                           fLocal;                     /*    always 0*/
  908.     short                           fHost;                      /*    always 0*/
  909. };
  910. typedef struct OTCfgIRTEEntry           OTCfgIRTEEntry;
  911. struct OTCfgIRTEPrefs {
  912.     short                           fCount;
  913.     OTCfgIRTEEntry                  fList[1];
  914. };
  915. typedef struct OTCfgIRTEPrefs           OTCfgIRTEPrefs;
  916. struct OTCfgISDMPrefs {
  917.     short                           fCount;
  918.     Str255                          fDomainsList;
  919. };
  920. typedef struct OTCfgISDMPrefs           OTCfgISDMPrefs;
  921. struct OTCfgDHCPRecord {
  922.     InetHost                        ipIPAddr;
  923.     InetHost                        ipConfigServer;
  924.     UInt32                          ipLeaseGrantTime;
  925.     UInt32                          ipLeaseExpirationTime;
  926. };
  927. typedef struct OTCfgDHCPRecord          OTCfgDHCPRecord;
  928. /*  DNS */
  929. enum {
  930.                                                                 /*    connection */
  931.     kOTCfgTypeDNSidns           = FOUR_CHAR_CODE('idns'),
  932.     kOTCfgTypeDNSisdm           = FOUR_CHAR_CODE('isdm'),
  933.     kOTCfgTypeDNSihst           = FOUR_CHAR_CODE('ihst'),
  934.     kOTCfgTypeDNSstng           = FOUR_CHAR_CODE('stng'),
  935.     kOTCfgTypeDNSPassword       = FOUR_CHAR_CODE('pwrd')        /*    transport options  */
  936. };
  937. /*  Modem   */
  938. enum {
  939.                                                                 /*    connection */
  940.     kOTCfgTypeModemModem        = FOUR_CHAR_CODE('ccl '),       /*    Type for Modem configuration resource*/
  941.     kOTCfgTypeModemLocks        = FOUR_CHAR_CODE('lkmd'),       /*    Types for lock resources*/
  942.     kOTCfgTypeModemAdminPswd    = FOUR_CHAR_CODE('mdpw'),       /*    Password*/
  943.                                                                 /*    transport options  */
  944.     kOTCfgTypeModemApp          = FOUR_CHAR_CODE('mapt')
  945. };
  946. struct OTCfgRemoteConfigModem {
  947.     UInt32                          version;
  948.     Boolean                         useModemScript;
  949.     char                            pad00;                      /*    this structure is NOT packed!*/
  950.     FSSpec                          modemScript;
  951.     Boolean                         modemSpeakerOn;
  952.     Boolean                         modemPulseDial;
  953.     UInt32                          modemDialToneMode;
  954.     SInt8                           lowerLayerName[36];
  955. };
  956. typedef struct OTCfgRemoteConfigModem   OTCfgRemoteConfigModem;
  957. struct OTCfgModemLocks {
  958.     UInt32                          version;
  959.     UInt32                          port;
  960.     UInt32                          script;
  961.     UInt32                          speaker;
  962.     UInt32                          dialing;
  963. };
  964. typedef struct OTCfgModemLocks          OTCfgModemLocks;
  965. struct OTCfgModemAppPrefs {
  966.     UInt32                          version;
  967.     Point                           windowPos;
  968.     SInt32                          userMode;
  969. };
  970. typedef struct OTCfgModemAppPrefs       OTCfgModemAppPrefs;
  971. /*  Remote Access   */
  972. enum {
  973.                                                                 /*    connection */
  974.     kOTCfgTypeRemoteARAP        = FOUR_CHAR_CODE('arap'),
  975.     kOTCfgTypeRemoteAddress     = FOUR_CHAR_CODE('cadr'),
  976.     kOTCfgTypeRemoteChat        = FOUR_CHAR_CODE('ccha'),
  977.     kOTCfgTypeRemoteDialing     = FOUR_CHAR_CODE('cdia'),
  978.     kOTCfgTypeRemoteExtAddress  = FOUR_CHAR_CODE('cead'),
  979.     kOTCfgTypeRemoteClientLocks = FOUR_CHAR_CODE('clks'),
  980.     kOTCfgTypeRemoteClientMisc  = FOUR_CHAR_CODE('cmsc'),
  981.     kOTCfgTypeRemoteConnect     = FOUR_CHAR_CODE('conn'),
  982.     kOTCfgTypeRemoteUser        = FOUR_CHAR_CODE('cusr'),
  983.     kOTCfgTypeRemoteDialAssist  = FOUR_CHAR_CODE('dass'),
  984.     kOTCfgTypeRemoteIPCP        = FOUR_CHAR_CODE('ipcp'),
  985.     kOTCfgTypeRemoteLCP         = FOUR_CHAR_CODE('lcp '),       /* trailing space is important! */
  986.     kOTCfgTypeRemoteLogOptions  = FOUR_CHAR_CODE('logo'),
  987.     kOTCfgTypeRemotePassword    = FOUR_CHAR_CODE('pass'),
  988.     kOTCfgTypeRemotePort        = FOUR_CHAR_CODE('port'),
  989.     kOTCfgTypeRemoteServerLocks = FOUR_CHAR_CODE('slks'),
  990.     kOTCfgTypeRemoteServer      = FOUR_CHAR_CODE('srvr'),
  991.     kOTCfgTypeRemoteUserMode    = FOUR_CHAR_CODE('usmd'),
  992.     kOTCfgTypeRemoteX25         = FOUR_CHAR_CODE('x25 '),       /* trailing space is important! */
  993.                                                                 /*    transport options  */
  994.     kOTCfgTypeRemoteApp         = FOUR_CHAR_CODE('capt')
  995. };
  996. /*******************************************************************************
  997. *   OTCfgRemoteLogOptions
  998. *
  999. *   This structure is appended to OTCfgRemoteConnect records in the 
  1000. *   OTCfgRemoteConnect::additional list.
  1001. *
  1002. *   NOTE
  1003. *
  1004. *   All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1005. *   the "additional" field.  See OTCfgRemoteX25Info.
  1006. ********************************************************************************/
  1007. struct OTCfgRemoteLogOptions {
  1008.     UInt32                          version;
  1009.     UInt32                          fType;                      /*    kRAConnectAdditionalLogOptions*/
  1010.     void *                          additional;
  1011.     UInt32                          logLevel;                   /*    values defined above.*/
  1012.     UInt32                          reserved[4];                /*    for later use.*/
  1013. };
  1014. typedef struct OTCfgRemoteLogOptions    OTCfgRemoteLogOptions;
  1015. /*******************************************************************************
  1016. *   New structures for dialing mode, phone numbers, and configuration stats.
  1017. *   
  1018. *   
  1019. ********************************************************************************/
  1020. enum {
  1021.     kOTCfgRemoteMaxAddressSize  = (255 + 1)
  1022. };
  1023. struct OTCfgRemoteAddress {
  1024.     struct OTCfgRemoteAddress *     next;
  1025.     UInt8                           address[256];
  1026. };
  1027. typedef struct OTCfgRemoteAddress       OTCfgRemoteAddress;
  1028. /*******************************************************************************
  1029. *   OTCfgRemoteDialing
  1030. *
  1031. *   This structure is appended to OTCfgRemoteConnect records in the 
  1032. *   OTCfgRemoteConnect::additional list.
  1033. *
  1034. *   NOTE
  1035. *
  1036. *   All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1037. *   the "additional" field.  See OTCfgRemoteX25Info.
  1038. ********************************************************************************/
  1039. struct OTCfgRemoteDialing {
  1040.     UInt32                          version;
  1041.     UInt32                          fType;                      /*    kRAConnectAdditionalDialing*/
  1042.     void *                          additional;
  1043.     UInt32                          dialMode;                   /*    values defined above.*/
  1044.     SInt32                          redialTries;
  1045.     UInt32                          redialDelay;                /*    in seconds.*/
  1046.     OTCfgRemoteAddress *            addresses;
  1047. };
  1048. typedef struct OTCfgRemoteDialing       OTCfgRemoteDialing;
  1049. /*******************************************************************************
  1050. *   OTCfgRemoteScript
  1051. *
  1052. *   This is appended to OTCfgRemoteConnect records in the "additional" list.
  1053. *   It is currently only used for passing in a modem script to override
  1054. *   the default script.  Connect scripts have their own field in OTCfgRemoteConnect.
  1055. *
  1056. *   NOTE
  1057. *
  1058. *   All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1059. *   the "additional" field.  See OTCfgRemoteX25Info and OTCfgRemoteDialing.
  1060. ********************************************************************************/
  1061. struct OTCfgRemoteScript {
  1062.     UInt32                          version;
  1063.     UInt32                          fType;                      /*    kRAConnectAdditionalScript*/
  1064.     void *                          additional;
  1065.     UInt32                          scriptType;
  1066.     UInt32                          scriptLength;
  1067.     UInt8 *                         scriptData;
  1068. };
  1069. typedef struct OTCfgRemoteScript        OTCfgRemoteScript;
  1070. /*******************************************************************************
  1071. *   Miscellaneous limits
  1072. *   The size limits for strings include a 1 byte for the string length or
  1073. *   a terminating NULL character.
  1074. ********************************************************************************/
  1075. enum {
  1076.     kOTCfgRemoteMaxPasswordLength = 255,
  1077.     kOTCfgRemoteMaxPasswordSize = (255 + 1),
  1078.     kOTCfgRemoteMaxUserNameLength = 255,
  1079.     kOTCfgRemoteMaxUserNameSize = (255 + 1),
  1080.     kOTCfgRemoteMaxAddressLength = 255,                         /*    kOTCfgRemoteMaxAddressSize           = (255 + 1),*/
  1081.     kOTCfgRemoteMaxServerNameLength = 32,
  1082.     kOTCfgRemoteMaxServerNameSize = (32 + 1),
  1083.     kOTCfgRemoteMaxMessageLength = 255,
  1084.     kOTCfgRemoteMaxMessageSize  = (255 + 1),
  1085.     kOTCfgRemoteMaxX25ClosedUserGroupLength = 4,
  1086.     kOTCfgRemoteInfiniteSeconds = (long)0xFFFFFFFF,
  1087.     kOTCfgRemoteMinReminderMinutes = 1,
  1088.     kOTCfgRemoteChatScriptFileCreator = FOUR_CHAR_CODE('ttxt'),
  1089.     kOTCfgRemoteChatScriptFileType = FOUR_CHAR_CODE('TEXT'),
  1090.     kOTCfgRemoteMaxChatScriptLength = 0x8000
  1091. };
  1092. /*******************************************************************************
  1093. *   X.25 connection information, added to OTCfgRemoteConnect's additional info list.
  1094. *
  1095. *   NOTE
  1096. *
  1097. *   All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1098. *   the "additional" field.  See OTCfgRemoteScript & OTCfgRemoteDialing.
  1099. ********************************************************************************/
  1100. struct OTCfgRemoteX25Info {
  1101.     UInt32                          version;
  1102.     UInt32                          fType;                      /*    kRAConnectAdditionalX25*/
  1103.     void *                          additional;                 /*    Ptr to additional connect info*/
  1104.     FSSpec                          script;                     /*    PAD's CCL script*/
  1105.     UInt8                           address[256];               /*    address of server*/
  1106.     UInt8                           userName[256];
  1107.                                                                 /*    network user ID*/
  1108.     UInt8                           closedUserGroup[5];
  1109.                                                                 /*    closed user group*/
  1110.     Boolean                         reverseCharge;              /*    request reverse charging*/
  1111. };
  1112. typedef struct OTCfgRemoteX25Info       OTCfgRemoteX25Info;
  1113. /*******************************************************************************
  1114. *   OTCfgRemoteDisconnect
  1115. *
  1116. *   Use this structure to terminate Remote Access connections.
  1117. ********************************************************************************/
  1118. struct OTCfgRemoteDisconnect {
  1119.     UInt32                          whenSeconds;                /*    Number of seconds until disconnect*/
  1120.     UInt32                          showStatus;                 /*    Show disconnect status window*/
  1121. };
  1122. typedef struct OTCfgRemoteDisconnect    OTCfgRemoteDisconnect;
  1123. /*******************************************************************************
  1124. *   OTCfgRemoteIsRemote
  1125. *
  1126. *   Use this structure to find out if an AppleTalk address is on the 
  1127. *   remote side of the current ARA link. The "isRemote" field is set to
  1128. *   "true" if the address is remote. 
  1129. ********************************************************************************/
  1130. struct OTCfgRemoteIsRemote {
  1131.     UInt32                          net;                        /*    AppleTalk network number*/
  1132.     UInt32                          node;                       /*    AppleTalk node number*/
  1133.     UInt32                          isRemote;                   /*    returned.*/
  1134. };
  1135. typedef struct OTCfgRemoteIsRemote      OTCfgRemoteIsRemote;
  1136. /*******************************************************************************
  1137. *   OTCfgRemoteConnect
  1138. *
  1139. *   Use this structure to initiate Remote Access connections.
  1140. ********************************************************************************/
  1141. struct OTCfgRemoteConnect {
  1142.     UInt32                          version;
  1143.     UInt32                          fType;                      /*    RAConnectType defined above.*/
  1144.     UInt32                          isGuest;                    /*    (boolean) True for guest login*/
  1145.     UInt32                          canInteract;                /*    (boolean) True if dialogs can be displayed*/
  1146.     UInt32                          showStatus;                 /*    (boolean) Display (dis)connection status dialogs?*/
  1147.     UInt32                          passwordSaved;              /*    (boolean) "Save Password" checked in doc.*/
  1148.     UInt32                          flashConnectedIcon;         /*    (boolean) Flash icon in menu bar*/
  1149.     UInt32                          issueConnectedReminders;    /*    (boolean) Use Notification Manager reminders*/
  1150.     SInt32                          reminderMinutes;            /*    How long between each reminder?*/
  1151.     UInt32                          connectManually;            /*    (boolean) True if we are connecting manually*/
  1152.     UInt32                          allowModemDataCompression;  /*    (boolean) currently, only for kSerialProtoPPP*/
  1153.     UInt32                          chatMode;                   /*    Flags defined above*/
  1154.     UInt32                          serialProtocolMode;         /*    Flags defined above*/
  1155.     UInt8 *                         password;
  1156.     UInt8 *                         userName;
  1157.     UInt32                          addressLength;              /*    Length of phone number or other address*/
  1158.     UInt8 *                         address;                    /*    Phone number or address data*/
  1159.     Str63                           chatScriptName;             /*    Name of imported chat script (informational only)*/
  1160.     UInt32                          chatScriptLength;           /*    Length of Chat script*/
  1161.     UInt8 *                         chatScript;                 /*    Chat script data*/
  1162.     void *                          additional;                 /*    Ptr to additional connect info,*/
  1163.                                                                 /*    such as OTCfgRemoteX25Info*/
  1164.     UInt32                          useSecurityModule;          /*    (boolean) use line-level security module ?*/
  1165.     OSType                          securitySignature;          /*    signature of security module file*/
  1166.     UInt32                          securityDataLength;         /*    0..kSecurityMaxConfigData*/
  1167.     UInt8 *                         securityData;               /*    Ptr to data of size securityDataLength*/
  1168. };
  1169. typedef struct OTCfgRemoteConnect       OTCfgRemoteConnect;
  1170. /*******************************************************************************
  1171. *   OTCfgRemoteConnectInfo
  1172. *
  1173. *   If requestCode = kRAGetConnectInfo, "connectInfo" returns a pointer to a
  1174. *   new OTCfgRemoteConnect block that describes the current connection.
  1175. *
  1176. *   If requestCode = kRADisposeConnectInfo, the memory pointed to by
  1177. *   "connectInfo" is released for reuse.  "connectInfo" must point to a valid
  1178. *   OTCfgRemoteConnect structure previously returned by kRAGetConnectInfo.
  1179. ********************************************************************************/
  1180. struct OTCfgRemoteConnectInfo {
  1181.     OTCfgRemoteConnect *            connectInfo;                /*    Returned or disposed, depending on requestCode*/
  1182. };
  1183. typedef struct OTCfgRemoteConnectInfo   OTCfgRemoteConnectInfo;
  1184. /*******************************************************************************
  1185. *   OTCfgRemoteStatus
  1186. *
  1187. *   Use this structure to get the status of Remote Access connections.
  1188. ********************************************************************************/
  1189. enum {
  1190.     kOTCfgRemoteStatusIdle      = 1,
  1191.     kOTCfgRemoteStatusConnecting = 2,
  1192.     kOTCfgRemoteStatusConnected = 3,
  1193.     kOTCfgRemoteStatusDisconnecting = 4
  1194. };
  1195. struct OTCfgRemoteStatus {
  1196.     UInt32                          status;                     /*    values defined above*/
  1197.     Boolean                         answerEnabled;
  1198.     char                            pad00;                      /*    This structure is NOT packed*/
  1199.     UInt32                          secondsConnected;
  1200.     UInt32                          secondsRemaining;
  1201.     UInt8                           userName[256];              /*    Pascal format*/
  1202.     UInt8                           serverName[33];             /*    Pascal format*/
  1203.     char                            pad01;                      /*    This structure is NOT packed*/
  1204.     UInt32                          messageIndex;
  1205.     UInt8                           message[256];               /*    Pascal format*/
  1206.     UInt32                          serialProtocolMode;         /*    Flags defined above.*/
  1207.     UInt8                           baudMessage[256];           /*    Pascal format*/
  1208.     Boolean                         isServer;
  1209.     char                            pad02;                      /*    This structure is NOT packed*/
  1210.     UInt32                          bytesIn;
  1211.     UInt32                          bytesOut;
  1212.     UInt32                          linkSpeed;
  1213.     UInt32                          localIPAddress;
  1214.     UInt32                          remoteIPAddress;
  1215. };
  1216. typedef struct OTCfgRemoteStatus        OTCfgRemoteStatus;
  1217. /*******************************************************************************
  1218. *   OTCfgRemoteUserMessage
  1219. *
  1220. *   Use this structure when converting result codes into user messages.
  1221. ********************************************************************************/
  1222. struct OTCfgRemoteUserMessage {
  1223.     UInt32                          version;
  1224.     SInt32                          messageID;
  1225.     UInt8                           userMessage[256];
  1226.     UInt8                           userDiagnostic[256];
  1227. };
  1228. typedef struct OTCfgRemoteUserMessage   OTCfgRemoteUserMessage;
  1229. /*******************************************************************************
  1230. *   OTCfgRemoteNotifier
  1231. *
  1232. *   Use this structure to install a procedure to receive asynchronous 
  1233. *   Remote Access notifications.
  1234. ********************************************************************************/
  1235. typedef UInt32                          OTCfgRemoteEventCode;
  1236. typedef CALLBACK_API_C( void , RANotifyProcPtr )(void *contextPtr, OTCfgRemoteEventCode code, OSStatus result, void *cookie);
  1237. struct OTCfgRemoteNotifier {
  1238.     RANotifyProcPtr                 procPtr;
  1239.     void *                          contextPtr;
  1240. };
  1241. typedef struct OTCfgRemoteNotifier      OTCfgRemoteNotifier;
  1242. /*******************************************************************************
  1243. *   OTCfgRemoteRequest
  1244. *
  1245. *   All Remote Access API calls must pass a pointer to an OTCfgRemoteRequest structure.
  1246. ********************************************************************************/
  1247. struct OTCfgRemoteRequest {
  1248.     SInt8                           reserved1[16];              /*    Do not use. */
  1249.     OSErr                           result;                     /*    <--*/
  1250.     SInt8                           reserved2[8];               /*    Do not use.*/
  1251.     SInt16                          requestCode;                /*     -->*/
  1252.     SInt16                          portId;                     /*    <-->*/
  1253.     union {
  1254.         OTCfgRemoteNotifier             Notifier;
  1255.         OTCfgRemoteConnect              Connect;
  1256.         OTCfgRemoteDisconnect           Disconnect;
  1257.         OTCfgRemoteStatus               Status;
  1258.         OTCfgRemoteIsRemote             IsRemote;
  1259.         OTCfgRemoteConnectInfo          ConnectInfo;
  1260.     }                                 fType;
  1261. };
  1262. typedef struct OTCfgRemoteRequest       OTCfgRemoteRequest;
  1263. struct OTCfgRemoteConfigCAPT {
  1264.     UInt32                          fWord1;
  1265.     Point                           fWindowPosition;
  1266.     UInt32                          fWord3;
  1267.     UInt32                          fUserLevel;
  1268.     UInt32                          fSetupVisible;
  1269. };
  1270. typedef struct OTCfgRemoteConfigCAPT    OTCfgRemoteConfigCAPT;
  1271. #endif  /* CALL_NOT_IN_CARBON */
  1272. #if PRAGMA_STRUCT_ALIGN
  1273.     #pragma options align=reset
  1274. #elif PRAGMA_STRUCT_PACKPUSH
  1275.     #pragma pack(pop)
  1276. #elif PRAGMA_STRUCT_PACK
  1277.     #pragma pack()
  1278. #endif
  1279. #ifdef PRAGMA_IMPORT_OFF
  1280. #pragma import off
  1281. #elif PRAGMA_IMPORT
  1282. #pragma import reset
  1283. #endif
  1284. #ifdef __cplusplus
  1285. }
  1286. #endif
  1287. #endif /* __NETWORKSETUP__ */