home *** CD-ROM | disk | FTP | other *** search
- /*
- Created: Monday, April 27, 1992 at 2:50 PM
- ServerControlIntf.h
- Pascal Interface to the Macintosh Libraries
-
- Copyright Apple Computer, Inc. 1990-1992
- All rights reserved
-
- 4/10/95 JML Added alignment pragmas
-
- */
-
- #ifndef __APPLETALK__
- #include <AppleTalk.h>
- #endif
-
- #if GENERATINGPOWERPC
- #pragma options align=mac68k
- #endif
-
- #define ServerDispatch 0xA094 /* The server control dispatch trap. */
-
- /* scCode values */
- enum {
- SCStartServer = 0,
- SCShutDown = 2,
- SCCancelShutDown = 3,
- SCDisconnect = 4,
- SCPollServer = 5,
- SCGetExpFldr = 6,
- SCGetSetupInfo = 7,
- SCSetSetupInfo = 8,
- SCSendMessage = 9,
- SCGetServerStatus = 10,
- SCInstallServerEventProc = 11,
- SCRemoveServerEventProc = 12,
- SCGetServerEventProc = 13,
- SCServerVersion = 14,
- SCSetCopyProtect = 16,
- SCClrCopyProtect = 17,
- SCDisconnectVolUsers = 18,
- SCGetUserNameRec = 19,
- SCGetUserMountInfo = 20,
- SCWakeServer = 21,
- SCSleepServer = 22
- }; /* all other values of scCode are reserved */
-
- /* scFlags bits and masks for disconnectPB */
- #define bUNRFSendMsg 13 /* send a message */
- #define UNRFSendMsgMask 0x2000 /* send a message */
-
- /* These are error codes that are returned from an SCDisconnect trap */
- #define AlreadyShuttingDown -1 /* the server is already shutting down */
- #define AlreadyDisconnecting -2 /* the server is already disconnecting */
-
- /* scServerType contains the server type, which is interpreted as follows: */
- enum {
- MFSType = 0x0000, /* Macintosh File Sharing */
- AFSType = 0x0001 /* AppleShare File Server */
- };
-
- /* scServerVersion is the server version, which is currently interpreted as follows: */
- /* $0030 : File Sharing Extension, versions 7.0 and 7.0.1 */
- /* $0031 : File Server Extension, version 3.0 */
- /* $0032 : File Sharing Extension, version 7.0.2 */
-
- /* These are some random constants for SCStartServer */
- #define kCurInstalled 0 /* the currently installed server */
- #define kFinderExtn 0 /* send high level events to the finder extension */
-
- /* scServerFlags bits returned by SCGetServerStatus */
- #define bJBSEnabled 12 /* Set if Apple II boot service is enabled */
-
- /* These "SCPS" integers are passed back from a SCPollServer call in scServerState: */
- /* 0 means: 0 <= seconds left < 30 and Network Setup says : "Less than a minute" */
- /* 1 means: 30 <= seconds left < 90 and Network Setup says : "About a minute" */
- /* 2 thru 4094: x*60-30 <= seconds left < x*60+30 and NS says: "About X minutes" */
- enum {
- SCPSRunning = -1, /* Server running normally */
- SCPSStartingUp = -2, /* Server is in the process of starting up */
- SCPSJustDisabled = -3, /* Server is just disabled and there was no startup error */
- SCPSDisabledwErr = -4, /* Server is disabled and there is an "SE" error in scServerError */
- SCPSSleeping = -5 /* Server is temporarily disabled */
- };
-
- /* These "SCPD" integers are passed back from a SCPollServer call in scDisconnectState: */
- /* 0 means: 0 <= seconds left < 30 and FileShare Monitor says : "Less than a minute" */
- /* 1 means: 30 <= seconds left < 90 and FileShare Monitor says : "About a minute" */
- /* 2 thru 4094: x*60-30 <= seconds left < x*60+30 and FM says: "About X minutes" */
- enum {
- SCPDNotDisconnecting = -1 /* Server not disconnecting some one or some group of users */
- };
-
- /* These are Server Errors ("SE") error codes returned in scServerError by a SCPollServer call */
- enum {
- SENoUGFileOpenErr = 1, /* "The Users & Groups file could not be opened." */
- SENoRealVolsErr = 2, /* "There are no volumes for AppleShare to use." */
- SEInsuffMFMemErr = 4, /* "There was not enough memory available to start AppleShare File Service." */
- SECantRegNameErr = 5, /* "The File Server's name could not be registered on the AppleTalk Network." */
- SECantFindExtnFolder = 6, /* "The File Server could not be started because the Extensions folder could not be found" */
- SEUnExATalkErr = 7, /* "An unexpected AppleTalk error occurred." */
- SENoMachineName = 8, /* "You must have a machine name." */
- SECantFindFSExtn = 9, /* "The File Server could not be started because the File Sharing Extension could not be found" */
- SEATalkOffErr = 10, /* "Appletalk is turned off." */
- SEAppleTalkErr = 11, /* "AppleTalk could not be activated." */
- SENoInitRunErr = 12, /* "AppleShare Setup file is not installed in the Server Folder." */
- SESysTooOldErr = 13, /* "The System File is too old for AppleShare (v3.0)." */
- SEInsuffAppMemErr = 14, /* "There was not enough memory for FileShare to startup." */
- SEBadConfigErr = 15, /* "AppleShare encountered a problem with the current configuration." */
- SENoDTOnStartupErr = 16, /* "The Desktop database on volume the startup volume could not be opened." */
- SEDupNameErr = 17 /* "Duplicate name error when registering. Please choose another name." */
- };
-
- typedef unsigned char tLoginMsg[199];
-
- struct SetupInfoRec {
- short SIVersion; /* SetupInfoRec version: 1 for File Sharing and AppleShare 3.0 */
- short SIFlags; /* 0 for File Sharing and AppleShare 3.0 */
- short SIMaxLogins; /* 1..11 for File Sharing; 1..121 for AppleShare 3.0 */
- short SISrvrUsageLimit; /* 10 to 100 (percent) */
- /* All remaining fields in record are only used by the AppleShare file server */
- Point SIVolInfoLocation; /* location of Volume Info window (default is -1,-1) */
- Boolean SIVolInfoVisible; /* is Volume Info window visible (default is TRUE) */
- Point SIUserInfoLocation; /* location of Connected Users window (default is -1,-1) */
- Boolean SIUserInfoVisible; /* is Connected Users window visible (default is TRUE) */
- short SIShutDownMins; /* default minutes until shutdown */
- short SISpare[17]; /* reserved */
- tLoginMsg SILoginMsg; /* the current Login message */
- };
-
- typedef struct SetupInfoRec SetupInfoRec;
- typedef SetupInfoRec *SetupInfoRecPtr;
-
-
- typedef long *LongIntPtr; /* because C doesn't have such a thing?? */
-
- #define SCParamBlockHeader \
- QElemPtr qLink;\
- short qType;\
- short ioTrap;\
- Ptr ioCmdAddr;\
- ProcPtr ioCompletion;\
- OSErr ioResult;
-
-
- struct StartParam {
- SCParamBlockHeader
- long reserved;
- short reserved2;
- short reserved3;
- short scCode;
- short scStartSelect;
- short scEventSelect;
- long reserved4[4];
- };
-
- typedef struct StartParam StartParam;
-
- struct DisconnectParam {
- SCParamBlockHeader
- LongIntPtr scDiscArrayPtr;
- short scArrayCount;
- short reserved;
- short scCode;
- short scNumMinutes;
- short scFlags;
- StringPtr scMessagePtr;
- };
-
- typedef struct DisconnectParam DisconnectParam;
-
- struct PollServerParam {
- SCParamBlockHeader
- long reserved;
- short reserved2;
- short reserved3;
- short scCode;
- short scServerState;
- short scDisconnectState;
- short scServerError;
- long scSecondsLeft;
- };
-
- typedef struct PollServerParam PollServerParam;
-
- struct StandardParam {
- SCParamBlockHeader
- StringPtr scNamePtr;
- short scVRefNum;
- short scLogins;
- short scCode;
- short scIndex;
- long scDirID;
- };
-
- typedef struct StandardParam StandardParam;
-
- struct SetupParam {
- SCParamBlockHeader
- SetupInfoRecPtr scSetupPtr;
- short scMaxVolumes;
- short scMaxExpFolders;
- short scCode;
- short scCurMaxSessions;
- };
-
- typedef struct SetupParam SetupParam;
-
- struct StatusParam {
- SCParamBlockHeader
- StringPtr scNamePtr;
- short reserved2;
- short reserved3;
- short scCode;
- short scServerFlags;
- short scNumSessions;
- long scUserListModDate;
- short scActivity;
- long scVolListModDate;
- };
-
- typedef struct StatusParam StatusParam;
-
- struct ServerEventParam {
- SCParamBlockHeader
- Ptr scSEQEntryPtr;
- short reserved2;
- short reserved3;
- short scCode;
- };
-
- typedef struct ServerEventParam ServerEventParam;
-
- struct VersionParam {
- SCParamBlockHeader
- StringPtr scExtNamePtr;
- short reserved2;
- short reserved3;
- short scCode;
- short scServerType;
- short scServerVersion;
- };
-
- typedef struct VersionParam VersionParam;
-
- struct UserInfoParam {
- SCParamBlockHeader
- StringPtr scNamePtr;
- short reserved2;
- short reserved3;
- short scCode;
- long scPosition;
- long scUNRecID;
- long scUserID;
- long scLoginTime;
- long scLastUseTime;
- AddrBlock scSocketNum;
- };
-
- typedef struct UserInfoParam UserInfoParam;
-
- struct VolMountedParam {
- SCParamBlockHeader
- Ptr reserved;
- short scVRefNum;
- short reserved3;
- short scCode;
- short scFilesOpen;
- short scWriteableFiles;
- long scUNRecID;
- Boolean scMounted;
- Boolean scMountedAsOwner;
- };
-
- typedef struct VolMountedParam VolMountedParam;
-
- union SCParamBlockRec {
- StartParam startPB;
- DisconnectParam disconnectPB;
- PollServerParam pollServerPB;
- StandardParam standardPB;
- SetupParam setupPB;
- StatusParam statusPB;
- ServerEventParam serverEventPB;
- VersionParam versionPB;
- UserInfoParam userInfoPB;
- VolMountedParam volMountedPB;
- };
-
- #ifndef __cplusplus
- typedef union SCParamBlockRec SCParamBlockRec;
- #endif // __cplusplus
-
- typedef SCParamBlockRec *SCParamBlockPtr;
-
- /* ServerDispatch can be called synchronously only. */
- /* Asynchronous server control calls are not supported. */
- /* Inputs: A0 points to the SCParamBlockRec. */
- /* D0 must be zero. */
- /* SCParamBlockRec.scCode indicates the server control call. */
- /* Outputs: D0.w and SCParamBlockRec.ioResult contain the result code. */
- /* Note: Macintosh File Sharing does not return the result in D0.w */
- /* so the glue code below moves it there for you. */
-
- /* The glue to call the ServerDispatch trap */
- #if !GENERATINGCFM
- #pragma parameter __D0 SyncServerDispatch(__A0)
- #endif
- extern pascal OSErr SyncServerDispatch(SCParamBlockPtr PBPtr)
- FOURWORDINLINE( 0x7000, /* MOVEQ #$00,D0 */
- 0xA094, /* _ServerDispatch */
- 0x3028,0x0010); /* MOVE.W ioResult(A0),D0 */
-
- #if GENERATINGPOWERPC
- #pragma options align=reset
- #endif
-