{ AMarquee.i for PCQ Pascal } { Translated from file AMarquee.h for v.53 } { requires amarquee.library version 53 } { by Jeremy Friesner & Håkan Parting} { Varargs functions added by Nils Sjöholm } {$I "Include:Exec/Ports.i"} {$I "Include:Exec/Semaphores.i"} {$I "Include:Utility/TagItem.i"} type {***** QSession ***************************************************} QSession = record qMsgPort : MsgPortPtr; { Wait() on this for QMessages! } {******************************************************************} { Invisible, private info is here... don't trust sizeof(QSession)! } {******************************************************************} end; QSessionPtr = ^QSession; {***** QMessage ***************************************************} QMessage = record qm_Msg : Message; { Don't directly use the contents of qm_Msg! } qm_ID : Integer; { Message ID # of transaction related to this opCode, or -1 if no ID is applicable. } qm_Status : Integer; { One of the QERROR_* codes defined in AMarquee headers. } qm_Path : String; { Pathname of a node, or NULL if not applicable. } qm_Data : Address; { Pointer to beginning of data buffer, or NULL if not applicable. } qm_DataLen : Integer; { Length of qm_Data buffer, or 0 if not applicable. } qm_ActualLen : Integer; { Length of the data buffer stored on the AMarquee server. } qm_ErrorLine : Integer; { Line # of the server source code that generated the error. Useful for debugging. } qm_Private : Address; { Private info used by FreeQMessage() } qm_Private2 : Address; { Added for v48; more private info used by FreeQMessage() } qm_Session : QSessionPtr; { Added for v50. The session this message comes from } end; QMessagePtr = ^QMessage; {***** QRunInfo ***************************************************} QRunInfo = record qr_Allowed : Integer; { The theoretical maximum number of bytes your server may allocate. } qr_Alloced : Integer; { The number of bytes currently allocated by your server. } qr_Avail : Integer; { The number of bytes that may actually be allocated by your server. } qr_CurrentPrivs : Integer; { The bit-chord of QPRIV_* privileges that your client has. } qr_PossiblePrivs : Integer; { The bit-chord of QPRIV_* privileges that your client could get if it asked for them. } end; QRunInfoPtr = ^QRunInfo; {***** QSharedMessagePort ***************************************************} QSharedMessagePort = record qs_private : SignalSemaphore; { Used internally. } qs_mp : MsgPortPtr; { the message port to listen on. } end; QSharedMessagePortPtr = ^QSharedMessagePort; {***** QProtocolStopMarkerMessage ***************************************************} QProtocolStopMarkerMessage = record buffer : String; length : Integer; userdata : Integer; id : Integer; end; QProtocolStopMarkerMessagePtr = ^QProtocolStopMarkerMessage; { Different error types that can be returned to the client in QMessages } const QERROR_NO_ERROR = 0; { Everything is okay } QERROR_UNKNOWN = -1; { Don't know what the error was. } QERROR_MALFORMED_KEY = -2; { Keystring could not be parsed or "dir" does not exist } QERROR_NO_SERVER_MEM = -3; { Server did not have enough mem available to complete request } QERROR_NO_CONNECTION = -4; { The connection to the server went south } QERROR_UNPRIVILEGED = -5; { You're not allowed to do that! } QERROR_UNIMPLEMENTED = -6; { Feature you requested does not exist yet } QERROR_NO_CLIENT_MEM = -7; { Your computer didn't have enough memory available to complete an action } QERROR_SYS_MESSAGE = -8; { This message is a text message from the sysadmin on the server } QERROR_SEND_DONE = -9; { Sent in response to a transmission completion, if QGO_NOTIFY used in the QGo() call } { These error types may be returned by QFreeSession() after a QSession } { allocation attempt fails. } QERROR_NO_TCP_STACK = -20; { TCP stack wasn't running } QERROR_HOSTNAME_LOOKUP = -21; { Hostname lookup of server failed } QERROR_ABORTED = -22; { TCP thread got a control-C } QERROR_NO_SERVER = -23; { No AMarquee server at requested host/port } QERROR_NO_INETD = -24; { The program wasn't launched by inetd } QERROR_ACCESS_DENIED = -25; { The server wouldn't accept our connection } QERROR_NO_MEMORY = -26; { The client is out of memory } QERROR_NO_TCPSERVER = -27; { No server at requested host/port } { Flags representing special privileges; used with QRequestPrivileges(), etc } QPRIV_KILLCLIENTS = $1; { Can forcible disconnect other clients } QPRIV_ADMIN = $2; { Can change ENV variables on server } QPRIV_GETSYSMESSAGES = $4; { Can receive system messages } QPRIV_SENDSYSMESSAGES = $8; { Can send system messages } QPRIV_ALL = $F; { all QPRIV_* bits or'd together } { Flags to use with QGo() } QGOF_SYNC = $1; { Send a sync packet when all has settled } QGOF_NOTIFY = $2; { Send a notify packet when transmit has finished} { Tags for use with QNewSocketSession(Async) } QRAWSESSION_MAXBUFFERSIZE = $a0000001; { (maxBufSize : Integer) The maximum buffer size to use (same as QSetMaxRawBufSize()) } QRAWSESSION_PROTOCOLSTOPHOOK = $a0000002; { (stopmarkerfunc : HookPtr) A hook with the function which sets the stop marker for a block of data } QRAWSESSION_RECEIVE_EXCEEDING_DATA = $a0000003; { (b : Boolean) default TRUE. Shall the last data before the connection is broken be sent to the client even though the PROTOCOLSTOPHOOK hook specify it shouldn't ? } QRAWSESSION_PROTOCOLSTOPHOOK_USERDATA = $a0000004; { (u : Integer) The initial value of the userdata field in struct QProtocolStopMarkerMessage } { Tags for use with QNew*Session(Async) } QSESSION_ERRORCODEPTR = $b0000001; { (errorCode : IntegerPtr) A pointer to the variable that will hold the error code } QSESSION_SHAREDMSGPORT = $b0000002; { (mp : QSharedMessagePortPtr) A pointer to the variable that will hold the error code } { Function prototypes } { Translated from file AMarquee_protos.h } { by Jeremy Friesner & Hakan Parting} Function QNewSession(hostname : String; port : Integer; progname : String; taglist : TagItemPtr) : QSessionPtr; External; Function QNewSessionAsync(hostname : String; port : Integer; progname : String; taglist : TagItemPtr) : QSessionPtr; External; Function QFreeSession(session : QSessionPtr) : Integer; External; Function QDebugOp(session : QSessionPtr; string : String) : Integer; External; Function QGetOp(session : QSessionPtr; wildpath : String; maxBytes : Integer) : Integer; External; Function QDeleteOp(session : QSessionPtr; wildpath : String) : Integer; External; Function QRenameOp(session : QSessionPtr; path : String; newname : String) : Integer; External; Function QSubscribeOp(session : QSessionPtr; wildpath : String; maxBytes : Integer) : Integer; External; Function QSetOp(session : QSessionPtr; path : String; buffer : Address; bufferLength : Integer) : Integer; External; Function QClearSubscriptionsOp(session : QSessionPtr; which : Integer) : Integer; External; Function QPingOp(session : QSessionPtr) : Integer; External; Function QInfoOp(session : QSessionPtr) : Integer; External; Function QSetAccessOp(session : QSessionPtr; newAccess : String) : Integer; External; Function QGo(session : QSessionPtr; flags : Integer) : Integer; External; Procedure FreeQMessage(session : QSessionPtr; qmsg : QMessagePtr); External; Function QNewHostSession(hostnames : String; port : ^Integer; progNames : String; taglist : TagItemPtr) : QSessionPtr; External; Function QStreamOp(session : QSessionPtr; path : String; buffer : Address; bufferLenggth : Integer) : Integer; External; Function QNewServerSession(hostNames : String; progNames : String; taglist : TagItemPtr) : QSessionPtr; External; Function QSetMessageAccessOp(session : QSessionPtr; newAccess : String; maxBytes : Integer) : Integer; External; Function QMessageOp(session : QSessionPtr; hosts : String; buffer : Address; bufferLength : Integer) : Integer; External; Function QNumQueuedPackets(session : QSessionPtr) : Integer; External; Function QNumQueuedBytes(session : QSessionPtr) : Integer; External; Function QErrorName(error : Integer) : String; External; Function QRequestPrivilegesOp(session : QSessionPtr; privBits : Integer) : Integer; External; Function QReleasePrivilegesOp(session : QSessionPtr; privBits : Integer) : Integer; External; Function QKillClientsOp(session : QSessionPtr; hosts : String) : Integer; External; Function QSetParameterOp(session : QSessionPtr; paramName : String; newValue : String) : Integer; External; Function QGetParameterOp(session : QSessionPtr; paramName : String) : Integer; External; Function QSysMessageOp(session : QSessionPtr; hosts : String; message : String) : Integer; External; Function QGetAndSubscribeOp(session : QSessionPtr; path : String; buffer : Address; bufferLength : Integer) : Integer; External; Function QDetachSession(session : QSessionPtr; flags : Integer) : Boolean; External; Function QReattachSession(session : QSessionPtr; flags : Integer) : Boolean; External; Function QNewSocketSession(hostname : String; port : Integer; taglist : TagItemPtr) : QSessionPtr; External; Function QNewSocketSessionAsync(hostname : String; port : Integer; taglist : TagItemPtr) : QSessionPtr; External; Function QNewSocketServerSession(port : ^Integer; taglist : TagItemPtr) : QSessionPtr; External; Function QSendRawOp(session : QSessionPtr; buffer : Address; bufferLength : Integer) : Integer; External; Function QSetKeyAccessOp(session : QSessionPtr; path : String; newAccess : String) : Integer; External; Function QGetHostName(session : QSessionPtr) : String; External; Function QGetProgName(session : QSessionPtr) : String; External; Procedure QSetMaxRawBufSize(session : QSessionPtr; bufSize : Integer); External; Procedure QDeleteSharedMessagePort(mp : QSharedMessagePortPtr); External; Function QQCreateSharedMessagePort() : QSharedMessagePortPtr; External; Function QGetLocalIP(session : QSessionPtr) : String; External; { This are varargs functions to use with PCQ Pascal vers. 2.0 and above Added by Nils Sjöholm } {$C+} Function QNewSessionTags(hostname : String; port : Integer; progname : String; ...) : QSessionPtr; var Arg : Address; begin VA_Start(Arg); QNewSessionTags := QNewSession(hostname,port,progname,Arg); end; Function QNewSessionAsyncTags(hostname : String; port : Integer; progname : String; ...) : QSessionPtr; var Arg : Address; begin VA_Start(Arg); QNewSessionAsyncTags := QNewSessionAsync(hostname,port,progname,Arg); end; Function QNewHostSessionTags(hostnames : String; port : ^Integer; progNames : String; ...) : QSessionPtr; var Arg : Address; begin VA_Start(Arg); QNewHostSessionTags := QNewHostSession(hostnames,port,prognames,Arg); end; Function QNewServerSessionTags(hostNames : String; progNames : String; ...) : QSessionPtr; var Arg : address; begin VA_Start(Arg); QNewServerSessionTags := QNewServerSession(hostnames,prognames,Arg); end; Function QNewSocketSessionTags(hostname : String; port : Integer; ...) : QSessionPtr; var Arg : Address; begin VA_Start(Arg); QNewSocketSessionTags := QNewSocketSession(hostname,port,Arg); end; Function QNewSocketSessionAsyncTags(hostname : String; port : Integer; ...) : QSessionPtr; var Arg : Address; begin VA_Start(Arg); QNewSocketSessionAsyncTags := QNewSocketSessionAsync(hostname,port,Arg); end; Function QNewSocketServerSessionTags(port : ^Integer; ...) : QSessionPtr; var Arg : Address; begin VA_Start(Arg); QNewSocketServerSessionTags := QNewSocketServerSession(port,Arg); end; {$C-}