Apple AppleShare 3.0 File Server Controls Manuel d'utilisateur

Naviguer en ligne ou télécharger Manuel d'utilisateur pour Logiciel Apple AppleShare 3.0 File Server Controls. Apple AppleShare 3.0 File Server Controls User Manual Manuel d'utilisatio

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 79
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 0
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. The chapter presents each
server control call individually and includes a sample code segment for each
call that demonstrates how you might use the call in your own programs.
Server control calls enable applications to monitor and control the major
functions of the AppleShare File Server 3.0. These control calls let your
programs
- get and modify server configuration information
- check a server's status
- start and stop file service
- get information on users, volumes, and shared items
- disconnect users (including the users of a specific volume)
- send messages to users
- set or clear the copy-protect status of files
- use server event handlers
Server control calls, together with server event handling (described in
Chapter 2), make it possible to create any number of services and utilities
for the AppleShare File Server 3.0. Because you can monitor file usage -- who
uses files, which files are saved to or deleted from a server, where files
are copied to, and so on -- you can create file-usage audit trails, generate
server-usage statistics, and perform other types of accounting services. You
can also control file servers remotely. By monitoring the number of active
users, logging off idle users, and controlling log-on access, you can perform
load-balancing services for a group of related servers. Many other services
are possible. AppleShare File Server 3.0 server control calls and event
handling form a complete interface through which your applications and
programs can control and extend the capabilities of the file server software.
This guide refers to such programs and applications as server additions.
Note Macintosh File Sharing supports a subset of the AppleShare File Server
3.0 server control calls. See Appendix A for a list of these calls.
Main elements of file servers and server control calls
This section describes the software components and data files that make up
the AppleShare File Server 3.0 and Macintosh File Sharing. Because the
AppleShare File Server 3.0 and Macintosh File Sharing perform similar
functions, the components for each are similar and both use the same types of
data files.
Vue de la page 0
1 2 3 4 5 6 ... 78 79

Résumé du contenu

Page 1

AppleShare File Server 3.0 Control_____________________________________________________________________________CHAPTER 1-SERVER CONTROL CALLS_________

Page 2

VAR ServerError: Integer;VAR SecondsLeft: LongInt): OSErr;VARscPB: SCParamBlockRec;BEGINscPB.pollServerPB.scCode := SCPollServer;{ Macintosh File Shar

Page 3

VAR VolListModDate: LongInt):OSErr;VARscPB: SCParamBlockRec;BEGINscPB.statusPB.scCode := SCGetServerStatus;scPB.statusPB.scNamePtr := NamePtr;MySCGetS

Page 4

scPB: SCParamBlockRec;BEGINscPB.startPB.scCode := SCStartServer;scPB.startPB.scStartSelect := kCurInstalled;scPB.startPB.scEventSelect := kFinderExtn;

Page 5

MySCCancelShutDown := SyncServerDispatch(@scPB);END;SCSleepServerThe following function calls SCSleepServer to temporarily shut down the fileserver (&

Page 6

Obtaining status information about users, volumes, and shared itemsThis section describes the server control calls that you use to obtaininformation a

Page 7

NamePtr^ := '';ENDELSEBEGINscPB.standardPB.scNamePtr := NamePtr;END;scPB.standardPB.scIndex := Index;MySCGetExpFldr := SyncServerDispatch(@s

Page 8

END;SERVER CONTROL CALLSThe following procedure creates a list of shared volumes and folders. Beforeusing this procedure, you must initialize gMaxVolu

Page 9

END;ENDELSE IF err <> fnfErr THEN{ fnfErr only means there is nothing at this }{ Index position }BEGIN{ handle any unexpected errors }END;END;EN

Page 10

UNRecID := scPB.userInfoPB.scUNRecID;UserID := scPB.userInfoPB.scUserID;LoginTime := scPB.userInfoPB.scLoginTime;LastUseTime := scPB.userInfoPB.scLast

Page 11

{ handle any unexpected errors }END;UNTIL err <> noErr;END;SCGetUserMountInfoThe following function calls SCGetUserMountInfo to get information

Page 12

AppleShare File Server 3.0 software componentsThe AppleShare File Server 3.0 is composed of a number of files. The FileServer Extension provides the a

Page 13

procedure, you mustinitialize gMaxVolumes and gMaxExpFolders with the values returned bythe SCGetGetupInfo control call.PROCEDURE GetAllUserMountInfo

Page 14

a file server.Note Although Macintosh File Sharing implements SCDisconnect, there is noway to use this call with Macintosh File Sharing because Macin

Page 15

ArrayCount := 1; { one user }NumMinutes := 10;Flags := UNRFSendMsgMask; { send a message }Message := 'Goodbye.';err := MySCDisconnect(@UNRe

Page 16

scPB.disconnectPB.scFlags := Flags;scPB.disconnectPB.scMessagePtr := MessagePtr;MySCDisconnectVolUsers := SyncServerDispatch(@scPB);END;The following

Page 17

This section describes the server control call that lets you send messages tousers.SCSendMessageThe following function calls SCSendMessage to send a m

Page 18

DiscArrayPtr: LongIntPtr;ArrayCount: Integer;Flags: Integer;Message: tLoginMsg;BEGIN{ allocate an array large enough to get all users }DiscArrayPtr :=

Page 19

Flags := UNRFSendMsgMask; { send a message }Message := 'Moof!';err := MySCSendMessage(DiscArrayPtr, ArrayCount,Flags, @Message);IF err = noE

Page 20

VARscPB: SCParamBlockRec;BEGINscPB.standardPB.scNamePtr := NamePtr;scPB.standardPB.scVRefNum := VRefNum;scPB.standardPB.scCode := SCSetCopyProtect;scP

Page 21

Note This call is not supported by Macintosh File Sharing.FUNCTION mySCInstallServerEventProc(theSEHandler: ProcPtr): OSErr;VARscPB: SCParamBlockRec;

Page 22

scPB: SCParamBlockRec;BEGINscPB.serverEventPB.scCode := SCGetServerEventProc;MySCGetServerEventProc := SyncServerDispatch(@scPB);theSEQHdrPtr := QHdrP

Page 23

The AppleShare Installer initially installs the AppleShare File Serverapplication in the System Folder, but the file can reside anywhere on theserver

Page 24

to see if the handler is interested in the event that just happened. If itis, the server calls the handler, passing pointers to the tSEQEntry recordan

Page 25

been satisfied, you can use server events in conjunction with server controlcalls to respond to the condition. For example, you can shut the server do

Page 26

qLink: QElemPtr;qType: Integer;theSERec: ServerEventRecord;END;{ Extend the tSEQEntry with a few items we need access }{ to within the server event ha

Page 27

BEGINscPB.serverEventPB.scSEQEntryPtr := theSEHandler;scPB.serverEventPB.scCode := SCInstallServerEventProc;mySCInstallServerEventProc := SyncServerDi

Page 28

(theSEQPtr: ExtendedSEQEntryPtr;theSERecPtr: ServerEventRecordPtr);VARtheSERecQElemPtr: SERecQElemPtr;BEGINWITH theSEQPtr^ DOBEGINIF freeQ.qHead <&

Page 29

{ and enqueue my server event record into }{ the usedQ. }Enqueue(QElemPtr(theSERecQElemPtr), @usedQ);{ Wake up our process so it can handle the server

Page 30

{ clear all SEwhichAFPFlags, }theSEQEntry.SEwhichAFPFlag[0] := 0;theSEQEntry.SEwhichAFPFlag[1] := 0;{ and clear all SEwhichSCFlags. }theSEQEntry.SEwhi

Page 31

InitSEQEntry := TRUE; { Everything is OK. }ENDELSEInitSEQEntry := FALSE; { No memory. }IF GetCurrentProcess(ourPSN) <> noErr THEN; { Get our pro

Page 32

{ bits first. }PROCEDURE SetSEFlags;BEGINWITH gExtendedSEQEntry.theSEQEntry DOBEGIN{ If the bCSEHAFPInDoRequest or }{ bCSEHAFPInSendResponse bits in

Page 33

END;{ ProcessServerEvents should be called every time through }{ the event loop to see if there are any server event }{ records to process. If there

Page 34

The File Sharing Extension contains no user interface of its own. The userinterface is provided by the Network Extension, which allows users to starta

Page 35

END;{ Your application calls InstallServerEventHandler to }{ install the server event handler. Change the }{ InitSEQEntry function where indicated to

Page 36

{ Your application calls RemoveServerEventHandler to }{ remove the server event handler and dispose of the }{ memory allocated by InitSEQEntry (which

Page 37

of the parameter block, and lists the possible result codes. The calls arepresented in alphabetical order.SCCancelShutDownSCCancelShutDown cancels the

Page 38

Result Codes noErr 0 No error.paramErr -50 The server is not running.SCClrCopyProtect may also return errors returned by t

Page 39

Result Codes noErr 0 No error.AlreadyShuttingDown -1 The server is alreadyshutting down.AlreadyDisconnecting

Page 40

scMessagePtr Longword input value: A pointer to a Str199containing the message sent to theworkstations.Result Codes noErr 0

Page 41

negative, then an empty Pascal string ('') isreturned.scVRefNum Word result value: Returns the referencenumber

Page 42

Fields ioResult Word result value: Result code.scSEQEntryPtr Longword result pointer: Returns a pointer to an operating sys

Page 43

bJBSEnabled Set if Apple II boot service is enabled.All other bits are reserved.scNumSessions Word result value: The number of currently o

Page 44

volumes supported by the server.Note This value is not returned under Macintosh File Sharing. (The maximumnumber of volumes supported under Macintosh

Page 45

File Manager The Macintosh File Manager normally handles local requests forfile access. When Macintosh File Sharing is turned on, however, the FileSh

Page 46

scCode Word input value: The server control code; always SCGetUserMountInfo ($0014).scFilesOpen Word result value: Returns the total nu

Page 47

Fields ioResult Word result value: Result code.scNamePtr Longword result pointer: Points to a Str31where the user name will

Page 48

scSEQEntryPtr Longword input pointer: Points to the tSEQEntryserver event object to be installed in the serverevent handler queue.scCode

Page 49

SCPSJustDisabled Server was just disabled and there was no startuperror.SCPSDisabledwErr Server is disabled and there is an "SE" error ins

Page 50

SESysTooOldErr The System file is too old for AppleShare FileServer 3.0.SEInsuffAppMemErr There was not enough memory for the file server tostart

Page 51

SCSendMessageSCSendMessage sends a server message to every user whose user name record ID(UNRecID) is contained in the array pointed to by scDiscArray

Page 52

!! WARNING Macintosh File Sharing does not return a valid value forscServerVersion if the server is not running. !!Parameter (uses versionPB vari

Page 53

Fields ioResult Word result value: Result code.scNamePtr Longword input pointer: Points to the filename.scVRefNum Word input value: The

Page 54

scSetupPtr is NIL, or SetupInfoRec contains a value that is outof range.SCShutDownSCShutDown shuts down the file

Page 55

range, or an unknown bit isset in scFlags.SCSleepServerSCSleepServer shuts down the file server temporarily. This call has the sameparameters as SCShu

Page 56

Some of the server control call descriptions are accompanied by a secondsegment of sample code that shows a particular use of that call. Each ofthese

Page 57

SCStartServerSCStartServer starts the file server.!! IMPORTANT The AppleShare File Server 3.0 is normally started by theAppleShare File Server appli

Page 58

Note This call is not supported by Macintosh File Sharing.Parameter (uses standardPB variant of SCParamBlockRec)Block 16

Page 59

The SCDisconnect call does not send disconnect attention messages underMacintosh File Sharing.SCGetExpFldrWith Macintosh File Sharing, your program sh

Page 60

Macintosh File Sharing does not return a valid value for SCServerVersion ifthe server is not running.SCSetSetupInfoThe SCSetSetupInfo call does not us

Page 61

SCGetExpFldr = 6;SCGetSetupInfo = 7;SCSetSetupInfo = 8;SCSendMessage = 9;SCGetServerStatus = 10;SCIn

Page 62

{ and 7.0.1}{ $0031 = File Server Extension, version 3.0}{ $0032 = File Sharing Extension, version 7.0.2}{some random constants for SCStart

Page 63

{ SCPollServer in scServerError}SENoUGFileOpenErr = 1; {The Users & Groups Data }{ File could not be opened}SENoRealVolsErr = 2; {Ther

Page 64

{ File Server Extension or }{ File Sharing Extension }{ could not be found}SESysTooOldErr = 13; {The System File is too old }{ for AppleShare (

Page 65

{ and AppleShare 3.0}SIMaxLogins: Integer; {1..11 for File }{ Sharing; 1..121 }{ for AppleShare 3.0}SISrvrUsageLimit: Integer; {10 to 1

Page 66

scStartSelect: Integer;scEventSelect: Integer;reserved4: ARRAY[1..4] OF LongInt;END;disconnectParam =RECORDscDiscArrayPtr: LongIntPtr;scArrayCount

Page 67

Determining if server control calls are availableBefore using any of the other control calls, use the TrapAvailable call tomake sure that the server d

Page 68

scLogins: Integer;scCode: Integer;scIndex: Integer;scDirID: LongInt;END;setupParam =RECORDscSetupPtr: SetupInfoRecPtr;scMaxVolumes:

Page 69

reserved3: Integer;scCode: Integer;END;versionParam =RECORDscExtNamePtr: StringPtr;reserved2: Integer;reserved3: Integer;scC

Page 70

reserved3: Integer;scCode: Integer;scFilesOpen: Integer;scWriteableFiles: Integer;scUNRecID: LongInt;scMounted: Bo

Page 71

Server control routineFUNCTION SyncServerDispatch (pb: SCParamBlockPtr): OSErr;Server event interface fileThe ServerEventINTF file contains all of the

Page 72

{ to detect server starts and wakeups}bCSEHShare = 5;{An HFS Share trap has just been completed}bCSEHUnShare = 6;{An HFS UnShare

Page 73

bCSEHSessionTimedOut = 15;{A workstation's session timed out}bCSEHSrvrClosedSession = 16;{The server has closed a workstation's session}{W

Page 74

TYPEServerEventRecordPtr = ^ServerEventRecord;ServerEventRecord =RECORDtheEventNumber: LongInt;{the server event that's occuring; see the }{ SE

Page 75

{ bCSEHAFPInSendResponse: the first }{ BufferMax bytes of the AFP packet }{ if theEventNumber = bCSEHServerControlCall: }{ the first BufferMax b

Page 76

theUNSUserID: LongInt;{the UserID of the user that made the call}theUserName: Str31;{the name of the user that made the call}{Note: If theEve

Page 77

SEwhichSCFlag: LongInt;{specifies which Server Control calls will cause }{ the Server Event Handler to be called}END;Application-defined routinePROCE

Page 78

END;The following segment of code gets the server version information and storesit in global variables for later use. (Global variables and their data

Page 79

MaxVolumes := scPB.setupPB.scMaxVolumes;MaxExpFolders := scPB.setupPB.scMaxExpFolders;CurMaxSessions := scPB.setupPB.scCurMaxSessions;END;END;END;The

Commentaires sur ces manuels

Pas de commentaire