AppleShare File Server 3.0 Control _____________________________________________________________________________ CHAPTER 1-SERVER CONTROL CALLS _____________________________________________________________________________ This chapter introduces the server control calls available with the AppleShare File Server 3.0 and describes how server control calls interact with the main elements of file server software.
AppleShare File Server 3.0 software components The AppleShare File Server 3.0 is composed of a number of files. The File Server Extension provides the actual functionality of the file server. The AppleShare File Server and the AppleShare Admin applications provide the user interface for the server. This section describes each of AppleShare File Server 3.0 software components. The section "Data Files," later in this chapter, describes the Users & Groups Data File and the AppleShare PDS file.
The AppleShare Installer initially installs the AppleShare File Server application in the System Folder, but the file can reside anywhere on the server volume. The AppleShare File Server application communicates with the File Server Extension primarily by means of server control calls. AppleShare Admin The AppleShare Admin application provides the user interface for defining users and groups for the server.
The File Sharing Extension contains no user interface of its own. The user interface is provided by the Network Extension, which allows users to start and to control the File Sharing Extension. The File Sharing Extension communicates with the Network Extension primarily by means of server control calls. The File Sharing Extension communicates with the Finder by means of PPC events, and with a remote AppleShare client through AFP sessions.
File Manager The Macintosh File Manager normally handles local requests for file access. When Macintosh File Sharing is turned on, however, the File Sharing Extension intercepts all file access calls from the File Manager. Server additions Applications, INITs, extensions, and other types of programs can access the File Server Extension by using server control calls. A program that uses server control calls is referred to as a server addition.
Some of the server control call descriptions are accompanied by a second segment of sample code that shows a particular use of that call.
Determining if server control calls are available Before using any of the other control calls, use the TrapAvailable call to make sure that the server dispatch trap is available. The following line of code tests directly for the existence of the server dispatch trap: gHasServerDispatch := TrapAvailable(ServerDispatch) The "Compatibility Guidelines" chapter of Inside Macintosh, Volume VI, contains the source code for the TrapAvailable call.
END; The following segment of code gets the server version information and stores it in global variables for later use. (Global variables and their data types are listed in "Using Server Control Calls," earlier in this chapter.) err := MySCServerVersion(@gServerExtensionName, gServerType, gServerVersion); SCGetSetupInfo The following function calls SCGetSetupInfo to get the file server's setup information.
MaxVolumes := scPB.setupPB.scMaxVolumes; MaxExpFolders := scPB.setupPB.scMaxExpFolders; CurMaxSessions := scPB.setupPB.scCurMaxSessions; END; END; END; The following segment of code gets the server version information and stores it in global variables for later use. (Global variables and their data types are listed in "Using Server Control Calls," earlier in this chapter.
VAR ServerError: Integer; VAR SecondsLeft: LongInt): OSErr; VAR scPB: SCParamBlockRec; BEGIN scPB.pollServerPB.scCode := SCPollServer; { Macintosh File Sharing doesn't return scSecondsLeft } { so zero it. } scPB.pollServerPB.scSecondsLeft := 0; MySCPollServer := SyncServerDispatch(@scPB); ServerState := scPB.pollServerPB.scServerState; DisconnectState := scPB.pollServerPB.scDisconnectState; ServerError := scPB.pollServerPB.scServerError; SecondsLeft := scPB.pollServerPB.
VAR VolListModDate: LongInt): OSErr; VAR scPB: SCParamBlockRec; BEGIN scPB.statusPB.scCode := SCGetServerStatus; scPB.statusPB.scNamePtr := NamePtr; MySCGetServerStatus := SyncServerDispatch(@scPB); ServerFlags := scPB.statusPB.scServerFlags; NumSessions := scPB.statusPB.scNumSessions; UserListModDate := scPB.statusPB.scUserListModDate; Activity := scPB.statusPB.scActivity; VolListModDate := scPB.statusPB.
scPB: SCParamBlockRec; BEGIN scPB.startPB.scCode := SCStartServer; scPB.startPB.scStartSelect := kCurInstalled; scPB.startPB.scEventSelect := kFinderExtn; MySCStartServer := SyncServerDispatch(@scPB); END; SCShutDown The following function calls SCShutDown to shut down the file server. !! IMPORTANT The AppleShare File Server application automatically quits if the AppleShare File Server 3.0 is shut down with the SCShutDown call.
MySCCancelShutDown := SyncServerDispatch(@scPB); END; SCSleepServer The following function calls SCSleepServer to temporarily shut down the file server ("put it to sleep"). You might want to put a file server to sleep before switching networks or temporarily turning off AppleTalk. - Note This call is not supported by Macintosh File Sharing. FUNCTION MySCSleepServer (NumMinutes: Integer; Flags: Integer; MessagePtr: StringPtr): OSErr; VAR scPB: SCParamBlockRec; BEGIN scPB.disconnectPB.
Obtaining status information about users, volumes, and shared items This section describes the server control calls that you use to obtain information about file server users, volumes, and shared volumes and folders. SCGetExpFldr The following function calls SCGetExpFldr to get information from the call's return parameters about shared volumes and folders at a specified index position.
NamePtr^ := ''; END ELSE BEGIN scPB.standardPB.scNamePtr := NamePtr; END; scPB.standardPB.scIndex := Index; MySCGetExpFldr := SyncServerDispatch(@scPB); CASE gServerType OF MFSType: BEGIN IF scPB.standardPB.scVRefNum <> 0 THEN BEGIN VRefNum := scPB.standardPB.scVRefNum; Logins := 0; DirID := scPB.standardPB.scDirID; END ELSE { there's nothing at this index position } { so force the error code to make it act } { like AppleShare } MySCGetExpFldr := fnfErr; END; OTHERWISE BEGIN VRefNum := scPB.standardPB.
END; SERVER CONTROL CALLS The following procedure creates a list of shared volumes and folders. Before using this procedure, you must initialize gMaxVolumes and gMaxExpFolders with the values returned by the SCGetGetupInfo control call.
END; END ELSE IF err <> fnfErr THEN { fnfErr only means there is nothing at this } { Index position } BEGIN { handle any unexpected errors } END; END; END; SCGetUserNameRec The following function calls SCGetUserNameRec to get information about a user connected to the file server. Note This call is not supported by Macintosh File Sharing.
UNRecID := scPB.userInfoPB.scUNRecID; UserID := scPB.userInfoPB.scUserID; LoginTime := scPB.userInfoPB.scLoginTime; LastUseTime := scPB.userInfoPB.scLastUseTime; SocketNum := scPB.userInfoPB.scSocketNum; END; The following procedure creates a list of the users logged on to a file server.
{ handle any unexpected errors } END; UNTIL err <> noErr; END; SCGetUserMountInfo The following function calls SCGetUserMountInfo to get information about the status of a particular volume or shared folder, such as the number of open files on the volume, the number of files that are open with write access, whether the volume is mounted, and whether the volume is mounted with owner privileges (that is, whether the user is a superuser). Note This call is not supported by Macintosh File Sharing.
procedure, you must initialize gMaxVolumes and gMaxExpFolders with the values returned by the SCGetGetupInfo control call.
a file server. Note Although Macintosh File Sharing implements SCDisconnect, there is no way to use this call with Macintosh File Sharing because Macintosh File Sharing does not implement the SCGetUserNameRec call. SCGetUserNameRec retrieves information -- namely user name record IDs (UNRecID) -- that is necessary for SCDisconnect to work.
ArrayCount := 1; { one user } NumMinutes := 10; Flags := UNRFSendMsgMask; { send a message } Message := 'Goodbye.'; err := MySCDisconnect(@UNRecID, ArrayCount, NumMinutes, Flags, @Message); IF err = noErr THEN { the disconnect was started } ELSE BEGIN { handle any errors } END; END; SCDisconnectVolUsers The following function calls SCDisconnectVolUers to disconnect the users of specified volumes. Note This call is not supported by Macintosh File Sharing.
scPB.disconnectPB.scFlags := Flags; scPB.disconnectPB.scMessagePtr := MessagePtr; MySCDisconnectVolUsers := SyncServerDispatch(@scPB); END; The following procedure delivers a message to and disconnects the users of the specified volume after ten minutes.
This section describes the server control call that lets you send messages to users. SCSendMessage The following function calls SCSendMessage to send a message to the users specified in the array pointed to by DiscArrayPtr. Note This call is not supported by Macintosh File Sharing. FUNCTION MySCSendMessage (DiscArrayPtr: LongIntPtr; ArrayCount: Integer; Flags: Integer; MessagePtr: StringPtr): OSErr; VAR scPB: SCParamBlockRec; BEGIN scPB.disconnectPB.scDiscArrayPtr := DiscArrayPtr; scPB.disconnectPB.
DiscArrayPtr: LongIntPtr; ArrayCount: Integer; Flags: Integer; Message: tLoginMsg; BEGIN { allocate an array large enough to get all users } DiscArrayPtr := LongIntPtr(NewPtr(sizeof(LongInt) * gCurMaxSessions)); IF DiscArrayPtr <> NIL THEN BEGIN Position := 0; ArrayCount := 0; ArrayPosPtr := DiscArrayPtr; REPEAT { build list of users with SCGetUserNameRec } scPB.userInfoPB.scCode := SCGetUserNameRec; scPB.userInfoPB.scNamePtr := NIL; scPB.userInfoPB.
Flags := UNRFSendMsgMask; { send a message } Message := 'Moof!'; err := MySCSendMessage(DiscArrayPtr, ArrayCount, Flags, @Message); IF err = noErr THEN { the message was sent } ELSE BEGIN { handle any errors from SCSendMessage } END END ELSE ; { there are no users connected } { do nothing } DisposPtr(Ptr(DiscArrayPtr)); END ELSE BEGIN { handle memory manager error } END; END; Setting or clearing the copy-protect status of files This section describes the server control calls that let you set or clear the
VAR scPB: SCParamBlockRec; BEGIN scPB.standardPB.scNamePtr := NamePtr; scPB.standardPB.scVRefNum := VRefNum; scPB.standardPB.scCode := SCSetCopyProtect; scPB.standardPB.scDirID := DirID; MySCSetCopyProtect := SyncServerDispatch(@scPB); END; SCClrCopyProtect The following function calls SCClrCoyProtect to clear the copy-protect status of a file. Note This call is not supported by Macintosh File Sharing.
Note This call is not supported by Macintosh File Sharing. FUNCTION mySCInstallServerEventProc (theSEHandler: ProcPtr): OSErr; VAR scPB: SCParamBlockRec; BEGIN scPB.serverEventPB.scSEQEntryPtr := theSEHandler; scPB.serverEventPB.scCode := SCInstallServerEventProc; mySCInstallServerEventProc := SyncServerDispatch(@scPB); END; SCRemoveServerEventProc The following function calls SCRemoveServerEventProc to remove a server event handler. Note This call is not supported by Macintosh File Sharing.
scPB: SCParamBlockRec; BEGIN scPB.serverEventPB.scCode := SCGetServerEventProc; MySCGetServerEventProc := SyncServerDispatch(@scPB); theSEQHdrPtr := QHdrPtr(scPB.serverEventPB.
to see if the handler is interested in the event that just happened. If it is, the server calls the handler, passing pointers to the tSEQEntry record and a server event record owned by the server. It is up to the event handler to copy the server event record into the application's own buffer.
been satisfied, you can use server events in conjunction with server control calls to respond to the condition. For example, you can shut the server down, disconnect a user, or send a message to any or all connected users as a response to a server event. Sample server event handler code This section contains sample code that implements the server event mechanism in a server addition. The sample includes all of the necessary parts; you need only plug in your specific code segments to make it work.
qLink: QElemPtr; qType: Integer; theSERec: ServerEventRecord; END; { Extend the tSEQEntry with a few items we need access } { to within the server event handler. } ExtendedSEQEntryPtr = ^ExtendedSEQEntry; ExtendedSEQEntry = RECORD theSEQEntry: tSEQEntry; { A server event queue entry. } freeQ, usedQ: QHdr; { Queue headers for server } { event record queues. } seRecArrayPtr: Ptr; { Pointer to allocated array } { of SERecQElem. } ourPSN: ProcessSerialNumber; { The application's PSN.
BEGIN scPB.serverEventPB.scSEQEntryPtr := theSEHandler; scPB.serverEventPB.scCode := SCInstallServerEventProc; mySCInstallServerEventProc := SyncServerDispatch(@scPB); END; { This function calls SCRemoveServerEventProc to remove a } { server event handler. } FUNCTION mySCRemoveServerEventProc (theSEHandler: ProcPtr): OSErr; VAR scPB: SCParamBlockRec; BEGIN scPB.serverEventPB.scSEQEntryPtr := theSEHandler; scPB.serverEventPB.
(theSEQPtr: ExtendedSEQEntryPtr; theSERecPtr: ServerEventRecordPtr); VAR theSERecQElemPtr: SERecQElemPtr; BEGIN WITH theSEQPtr^ DO BEGIN IF freeQ.qHead <> NIL THEN BEGIN { Get the server event record out of the freeQ. } theSERecQElemPtr := SERecQElemPtr(freeQ.qHead); IF Dequeue(QElemPtr(theSERecQElemPtr), @freeQ) <> noErr THEN ; { Do nothing with errors-- } { you'd better not be getting them! } END ELSE BEGIN { The freeQ is empty, so get the oldest server } { event record out of the usedQ.
{ and enqueue my server event record into } { the usedQ. } Enqueue(QElemPtr(theSERecQElemPtr), @usedQ); { Wake up our process so it can handle the server } { event record ASAP.
{ clear all SEwhichAFPFlags, } theSEQEntry.SEwhichAFPFlag[0] := 0; theSEQEntry.SEwhichAFPFlag[1] := 0; { and clear all SEwhichSCFlags. } theSEQEntry.SEwhichSCFlag := 0; { Allocate some memory for the server event } { records and initialize the buffer queues. } seRecArrayPtr := NewPtr(kNumberServerEvents * LongInt(sizeof(SERecQElem))); IF seRecArrayPtr <> NIL THEN BEGIN { Initialize the usedQ header. } usedQ.qFlags := 0; usedQ.qHead := NIL; usedQ.qTail := NIL; { Initialize the freeQ header. } freeQ.
InitSEQEntry := TRUE; { Everything is OK. } END ELSE InitSEQEntry := FALSE; { No memory. } IF GetCurrentProcess(ourPSN) <> noErr THEN ; { Get our process serial number. } END; END; { SetSEFlags sets the server event flags of } { gExtendedSEQEntry to tell AppleShare's server event } { mechanism which server events your application's server } { event handler are interested in. You can set the } { SE flags either before or after your server event } { handler is installed.
{ bits first. } PROCEDURE SetSEFlags; BEGIN WITH gExtendedSEQEntry.theSEQEntry DO BEGIN { If the bCSEHAFPInDoRequest or } { bCSEHAFPInSendResponse bits in SEeventFlag are } { going to be set, then indicate what AFP calls } { you're interested in. For example: } { BSET(theSEQEntry.SEwhichAFPFlag[1], afpOpenFork); } { will cause a server event for the afpOpenFork } { AFP call.
END; { ProcessServerEvents should be called every time through } { the event loop to see if there are any server event } { records to process. { immediately. If there aren't, then it exits } If there are, then it processes the server } { event records in the used queue until none are left. } PROCEDURE ProcessServerEvents; VAR theSERecQElemPtr: SERecQElemPtr; BEGIN WITH gExtendedSEQEntry DO WHILE usedQ.qHead <> NIL DO BEGIN { Get the server event record out of the usedQ.
END; { Your application calls InstallServerEventHandler to } { install the server event handler. Change the } { InitSEQEntry function where indicated to tell the server } { event handler mechanism what server events you're } { interested in to begin with. } FUNCTION InstallServerEventHandler: OSErr; VAR err: OSErr; BEGIN { initialize queues and get server event record buffer } IF InitSEQEntry THEN BEGIN { Set the server event flags in } { gExtendedSEQEntry.theSEQEntry.
{ Your application calls RemoveServerEventHandler to } { remove the server event handler and dispose of the } { memory allocated by InitSEQEntry (which is called by } { InstallServerEventHandler). } FUNCTION RemoveServerEventHandler: OSErr; BEGIN { Remove the server event handler. } RemoveServerEventHandler := mySCRemoveServerEventProc(@gExtendedSEQEntry); { Get rid of memory used for the server event records. } IF gExtendedSEQEntry.seRecArrayPtr <> NIL THEN DisposPtr(gExtendedSEQEntry.
of the parameter block, and lists the possible result codes. The calls are presented in alphabetical order. SCCancelShutDown SCCancelShutDown cancels the shutdown or disconnect in progress. If a shutdown was in progress, a shutdown-canceled attention message is sent to all affected users. Parameter (uses standardPB variant of SCParamBlockRec) Block Fields ioResult 16 ioResult word 26 scCode word Word result value: Result code.
Result Codes noErr paramErr 0 -50 No error. The server is not running. SCClrCopyProtect may also return errors returned by the PBGetCatInfo and PBSetCatInfo routines. SCDisconnect SCDisconnect disconnects every user whose user name record ID (UNRecID) is contained in the array pointed to by scDiscArrayPtr and sends a disconnect attention message to all of these users. Note Macintosh File Sharing does not support the disconnect attention message.
Result Codes noErr 0 No error. AlreadyShuttingDown -1 The server is already shutting down. AlreadyDisconnecting -2 The server is already disconnecting. paramErr -50 The server is not running, scNumMinutes is out of range, an unknown bit is set in scFlags, or a UNRecID is invalid. SCDisconnectVolUsers SCDisconnectVolUsers disconnects any users who have any of the specified volumes mounted. In addition, this call prevents any new users from mounting the volumes.
scMessagePtr Result Codes Longword input value: A pointer to a Str199 containing the message sent to the workstations. noErr 0 No error. AlreadyShuttingDown -1 The server is already shutting down. AlreadyDisconnecting -2 The server is already disconnecting. paramErr -50 The server is not running, scArrayCount is greater than scMaxVolumes as returned by SCGetSetupInfo, a volume reference number is not valid,scNumMinutes is out of range,or an unknown bit is set in scFlags.
negative, then an empty Pascal string ('') is returned. number people Note scVRefNum Word result value: Returns the reference (vRefNum) of the shared folder. scLogins Word result value: Returns the number of who have mounted this folder. (For real volumes, this parameter returns the total number of people who have mounted either the whole volume or any of its shared folders.) This value is not returned under Macintosh File Sharing.
Fields Result Codes ioResult Word result value: Result code. scSEQEntryPtr Longword result pointer: Returns a pointer to an operating system queue header (QHdr) of the server event handler queue. The first server event handler in the handler queue, if any, is at QHdrPtr(scSEQEntryPtr)^.qhead. scCode Word input value: The server control code;always SCGetServerEventProc ($000D). noErr paramErr 0 No error. -50 The server is not running.
Result Codes bJBSEnabled Set if Apple II boot service is enabled. All other bits are reserved. scNumSessions Word result value: The number of currently opened sessions. scUserListModDate Longword result value: The last date and time (DateTime) that the user list was modified. (This value is helpful in minimizing the amount of updating needed by a monitoring application that updates some user list.) scActivity Word result value: The server activity, in percent (5%-100%).
volumes supported by the server. Note This value is not returned under Macintosh File Sharing. (The maximum number of volumes supported under Macintosh File Sharing is 10.) scMaxExpFolders Word result value: Returns the maximum number of shared folders supported by the server. Note This value is not returned under Macintosh File Sharing. (The maximum number of folders supported under Macintosh File Sharing is 10.) scCode Word input value: The server control code; always SCGetSetupInfo ($0007).
scCode Word input value: The server control code; always SCGetUserMountInfo ($0014). scFilesOpen Word result value: Returns the total number of files the user has open on the volume or shared folder. scWriteableFiles Word result value: Returns the total number of files the user has open for write access on the volume or shared folder. scUNRecID Longword input value: Specifies the user name record ID (UNRecID). scMounted Byte result value: Returns TRUE if the user has this volume mounted.
Fields ioResult Word result value: Result code. scNamePtr Longword result pointer: Points to a Str31 where the user name will be copied, or must contain NIL. scCode Word input value: The server control code; always SCGetUserNameRec ($0013). scPosition Longword input/result value: Specifies the position in the list of users. Set scPosition to zero to retrieve the first user. Use the value returned in scPosition to retrieve the next user.
scSEQEntryPtr Longword input pointer: Points to the tSEQEntry server event object to be installed in the server event handler queue. scCode Word input value: The server control code; always SCInstallServerEventProc ($000B). Result Codes noErr 0 No error. paramErr -50 The server is not running. afpMiscErr -5014 There are already 15 server event handlers (the maximum) in the server event handler queue. SCPollServer SCPollServer provides information about the current status of the file server.
Note SCPSJustDisabled Server was just disabled and there was no startup error. SCPSDisabledwErr Server is disabled and there is an "SE" error in scServerError. SCPSSleeping Server is temporarily disabled. This result is not returned by Macintosh File Sharing. scDisconnectState Word result value: The state of the server disconnect, as follows: $0000 0-29 seconds before disconnect; Network Setup message says "Less than a minute.
SESysTooOldErr The System file is too old for AppleShare File Server 3.0. SEInsuffAppMemErr There was not enough memory for the file server to startup. SEBadConfigErr The file server encountered a problem with the current configuration. SENoDTOnStartupErr The desktop database on the startup volume could not be opened. Note SEDupNameErr Duplicate-name error occurred when server was registering. Please choose another name. 21-29 Reserved by Apple.
SCSendMessage SCSendMessage sends a server message to every user whose user name record ID (UNRecID) is contained in the array pointed to by scDiscArrayPtr. Note This call is not supported by Macintosh File Sharing. Parameter (uses disconnectPB variant of SCParamBlockRec) Block Fields ioResult Result Codes 16 ioResult word 18 scDiscArrayPtr long 22 scArrayCount word 26 scCode word 30 scFlags word 32 scMessagePtr long Word result value: Result code.
!! WARNING Macintosh File Sharing does not return a valid value for scServerVersion if the server is not running. !! Parameter (uses versionPB variant of SCParamBlockRec) Block Fields 16 ioResult word 18 scExtNamePtr long 26 scCode word 28 scServerType word 30 scServerVersion word ioResult Word result value: Result code. scExtNamePtr Longword result pointer: Points to a Str31 where the server application name (the name of the activeINIT) will be returned, or must contain NIL.
Fields ioResult Word result value: Result code. scNamePtr Longword input pointer: Points to the filename. scVRefNum Word input value: The volume specification. scCode Word input value: The server control code; always SCSetCopyProtect ($0010). scDirID Longword input value: The parent directory ID. Result Codes noErr paramErr 0 No error. -50 The server is not running. SCSetCopyProtect may also return errors returned by the PBGetCatInfo and PBSetCatInfo routines.
scSetupPtr is NIL, or SetupInfoRec contains a value that is out of range. SCShutDown SCShutDown shuts down the file server and sends a shutdown attention message to all connected users. Note Macintosh File Sharing does not support the shutdown attention message. !! IMPORTANT The AppleShare File Server application automatically quits if the AppleShare File Server 3.0 is shut down by the SCShutDown call.
range, or an unknown bit is set in scFlags. SCSleepServer SCSleepServer shuts down the file server temporarily. This call has the same parameters as SCShutDown except that once the server has shut down, the AppleShare File Server application does not quit, and the server can be restarted by means of the SCWakeServer call (assuming that no SCShutdown call is made while the server is asleep). SCSleepServer fails if the server is starting up. Note This call is not supported by Macintosh File Sharing.
SCStartServer SCStartServer starts the file server. !! IMPORTANT The AppleShare File Server 3.0 is normally started by the AppleShare File Server application. When the AppleShare File Server application is launched, it checks to see if the file server is running. If it is, the AppleShare File Server application assumes its role as the file server's user interface.
Note This call is not supported by Macintosh File Sharing. Parameter (uses standardPB variant of SCParamBlockRec) Block Fields ioResult 16 ioResult word 26 scCode word Word result value: Result code. scCode Result Codes Word input value: The server control code; always SCWakeServer ($0015). noErr paramErr 0 -50 No error. The server is not sleeping. Other errors from the launching of the server -- such as fnfErr and memFullErr -- may also be returned.
The SCDisconnect call does not send disconnect attention messages under Macintosh File Sharing. SCGetExpFldr With Macintosh File Sharing, your program should call SCGetExpFldr as shown in the sample function in the section "SCGetExpFldr" in Chapter 1. SCNamePtr must be NIL when scIndex is negative. Otherwise, Macintosh File Sharing writes garbage into memory. See the comments in the sample function code listed in the section "SCGetExpFldr" in Chapter 1.
Macintosh File Sharing does not return a valid value for SCServerVersion if the server is not running. SCSetSetupInfo The SCSetSetupInfo call does not use the following fields of the setup information record (SetupInfoRec): - SIVolInfoVisible - SIUserInfoLocation - SIUserInfoVisible - SIShutDownMins - SISpare - SILoginMsg SCShutdown The SCShutdown call does not send shutdown attention messages under Macintosh File Sharing.
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; {scFlags bits and masks for disconnectPB} bUNRFSendMsg = 13; {send a message} UNRFSendMsgMask = $2000; {se
{ and 7.0.1} { $0031 = File Server Extension, version 3.0} { $0032 = File Sharing Extension, version 7.0.
{ SCPollServer in scServerError} SENoUGFileOpenErr = 1; {The Users & Groups Data } { File could not be opened} SENoRealVolsErr = 2; {There are no volumes for } { the file server to use} SEInsuffMFMemErr = 4; {There was not enough } { memory available to start } { the file server} 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 } { n
{ File Server Extension or } { File Sharing Extension } { could not be found} SESysTooOldErr = 13; {The System File is too old } { for AppleShare (v3.
{ and AppleShare 3.0} SIMaxLogins: Integer; {1..11 for File } { Sharing; 1..121 } { for AppleShare 3.0} SISrvrUsageLimit: Integer; {10 to 100 (percent)} {All remaining fields in record are only used by the } { AppleShare 3.
scStartSelect: Integer; scEventSelect: Integer; reserved4: ARRAY[1..
scLogins: Integer; scCode: Integer; scIndex: Integer; scDirID: LongInt; END; setupParam = RECORD scSetupPtr: SetupInfoRecPtr; scMaxVolumes: Integer; scMaxExpFolders: Integer; scCode: Integer; scCurMaxSessions: Integer; END; statusParam = RECORD scNamePtr: StringPtr; reserved2: Integer; reserved3: Integer; scCode: Integer; scServerFlags: Integer; scNumSessions: Integer; scUserListModDate: LongInt; scActivity: Integer; scVolListModDate: LongInt; END; serverEventParam = RECORD s
reserved3: Integer; scCode: Integer; END; versionParam = RECORD scExtNamePtr: StringPtr; reserved2: Integer; reserved3: Integer; scCode: Integer; scServerType: Integer; scServerVersion: Integer; END; userInfoParam = RECORD scNamePtr: StringPtr; reserved2: Integer; reserved3: Integer; scCode: Integer; scPosition: LongInt; scUNRecID: LongInt; scUserID: LongInt; scLoginTime: LongInt; scLastUseTime: LongInt; scSocketNum: AddrBlock; END; volMountedParam = RECORD reserved: Ptr; s
reserved3: Integer; scCode: Integer; scFilesOpen: Integer; scWriteableFiles: Integer; scUNRecID: LongInt; scMounted: Boolean; scMountedAsOwner: Boolean; END; SCParamBlockPtr = ^SCParamBlockRec; SCParamBlockRec = RECORD qLink: QElemPtr; qType: INTEGER; ioTrap: INTEGER; ioCmdAddr: Ptr; ioCompletion: ProcPtr; ioResult: OSErr; CASE Integer OF 1: (startPB: startParam); 2: (disconnectPB: disconnectParam); 3: (pollServerPB: pollServerParam); 4: (standardPB: standardParam); 5: (setu
Server control routine FUNCTION SyncServerDispatch (pb: SCParamBlockPtr): OSErr; Server event interface file The ServerEventINTF file contains all of the definitions for the server event mechanism.
{ to detect server starts and wakeups} bCSEHShare = 5; {An HFS Share trap has just been completed} bCSEHUnShare = 6; {An HFS UnShare trap has just been completed} bCSEHSetDirAccess = 7; {An HFS SetDirAccess trap has just been completed} bCSEHServerNameChange = 8; {An attempt was made to change the server name } { (the attempt may or may not have been successful)} bCSEHVolumePrep = 9; {A new volume was just prepared for use with } { AppleShare} bCSEHVolumeUnmount = 10; {A volume unmount was attem
bCSEHSessionTimedOut = 15; {A workstation's session timed out} bCSEHSrvrClosedSession = 16; {The server has closed a workstation's session} {When SEeventFlag bits bCSEHAFPInDoRequest or } { bCSEHAFPInSendResponse are set, the bits in } { SEwhichAFPFlag determine which AFP calls will cause } { the server event handler to be called.
TYPE ServerEventRecordPtr = ^ServerEventRecord; ServerEventRecord = RECORD theEventNumber: LongInt; {the server event that's occuring; see the } { SEeventFlag definitions above} theServerTime: LongInt; { the server time (in Macintosh DateTime form)} theResult: Integer; {the result of the operation } { if theEventNumber = bCSEHAFPInSendResponse: } { the AFP Error code to be returned } { if theEventNumber = bCSEHServerControlCall: } { the result of the server control call } { if theEventNumber = bCS
{ bCSEHAFPInSendResponse: the first } { BufferMax bytes of the AFP packet } { if theEventNumber = bCSEHServerControlCall: } { the first BufferMax bytes of the } { SCParamBlockRec } { if theEventNumber = bCSEHShare, } { bCSEHUnShare, bCSEHSetDirAccess, } { bCSEHVolumePrep, or bCSEHVolumeUnmount: } { the first BufferMax bytes of the } { HParamBlockRec } { if theEventNumber = bCSEHServerNameChange: } { the new server name (in a Pascal string) } { all other values of theEventNumber return a }
theUNSUserID: LongInt; {the UserID of the user that made the call} theUserName: Str31; {the name of the user that made the call} {Note: If theEventNumber is bCSEHAFPInDoRequest } { or bCSEHAFPInSendResponse, then theVRefNum and } { theDirID will be returned if applicable to the } { AFP call} theVRefNum: Integer; {the VRefNum of the volume upon which this } { operation was performed (not always applicable)} theDirID: LongInt; {the DirID of the directory upon/within which this} { operation was perform
SEwhichSCFlag: LongInt; {specifies which Server Control calls will cause } { the Server Event Handler to be called} END; Application-defined routine PROCEDURE MyServerEventHandler (theSEQEntryPtr: tSEQEntryPtr; theSERecPtr: ServerEventRecordPtr);