/* Copyright 2010 Przemyslaw Czerpak */ HBNETIO is implementation of alternative RDD IO API for Harbour with additional RPC support. It contains either client and server code. It supports connection stream compression using ZLIB compression and encryption using blowfish algorithm. After registering on the client side all files used by Harbour native RDDs with name starting with "net:" are redirected to the hbnetio server. Client side functions: ====================== netio_Connect( [], [], [], ; [], [], [] ) --> Register HBNETIO as alternative RDD IO API redirecting all files with name starting with "net:" to HBNETIO server, set default server address, port and connection parameters and tries to set the connection to this server. When executed 1st time it sets default connection parameters for all threads. Each thread can overwrite these default settings with its own local ones calling netio_Connect() function. Each successful call to netio_Connect() increase the reference counter for given connection. netio_Disconnect() decrease the reference. Connection is closed when the counter reach 0. It means that each netio_Connect() call needs corresponding call to netio_Disconnect(). The connections are recognized by IP server address and port number and they are shared between threads. So when more then one thread call netio_Connect() then only one connection is created. It also means that netio_Disconnect() does not have to be called by the same thread which called netio_Connect(). On application exit all connections are automatically closed. It possible to open many different connections and keep them open. In RDD IO operations and RPC calls it's possible to specify server address as part of file or procedure/function name, i.e. USE net:example.org:2942:path/to/file netio_ProcExec( "example.org:2942:procname" ) or using UNC paths: USE net://example.org:2942/path/to/file netio_ProcExec( "//example.org:2942/procname" ) It's also possible to specify the password. The connection string is in format: [:[:]]: or: //::: or: //[:]/ Backslashes '\' are also supported and can be used instead of '/'. Password is always terminated by ":" and whole connection string is terminated by Chr(0) so it's not possible to use these two characters as part of password. Anyhow when passwords are required then it's recommended to open the connection by netio_Connect() and then specify only server and port if server is not unique enough to chose from existing connections. If server is not given then default connection is chosen. netio_GetConnection( [], [], [], ; [], [], [] ) --> | NIL Get pointer item with HBNETIO connection. It can be used to speedup RPC calls and stream functions when is passed as parameter to these functions. netio_Disconnect( [], [] ) --> Close the connection created by netio_Connect() netio_Decode( [@], [@], [@], [@], ; [@], [@], [@] ) --> Decode connection parameters from and default settings. Return .T. if contains any connection settings. does not need to be prefixed with "net:" netio_TimeOut( [, ] ) --> [] Get/Set client side timeout for messages netio_SetPath( [, ] ) --> [] Set/Get path prefix for automatic file redirection to HBNETIO. If automatic redirection is activated then is removed from file name passed to HBNETIO server, i.e.: netio_SetPath( netio_GetConnection(), "//myserver/myshare" ) [...] /* open "/data/table" on HBNETIO server */ use "//myserver/myshare/data/table" netio_ProcExists( [,] ) --> Check if function or procedure exists on the server side. netio_ProcExec( [,] [, ] ) --> Execute function or procedure on server the side do not wait for confirmation from the server. netio_ProcExecW( [,] [, ] ) --> Execute function or procedure on the server side and wait for confirmation from the server. netio_FuncExec( [,] [, ] ) --> Execute function on the server side and wait for function return value sent by the server. netio_OpenDataStream( [,] [, ] ) --> netio_OpenItemStream( [,] [, ] ) --> open communication stream/channel which allow to send data asynchronously from server to client. It executes on the server side: ( , [, ] ) and then checks value returned by above function. If it's equal to then the communication stream is opened and is returned to the client. The function returns new stream ID or -1 if the communication stream cannot be set. may contain information about connection parameters just like in NETIO_PROC*() functions. netio_CloseStream( , [] | [[], []] ) --> close communication stream/channel netio_GetData( , [] | [[], []] ) --> | | NIL retrieve data sent from the server by communication stream. If stream was open by netio_OpenDataStream() then data is returned as string. If stream was open by netio_OpenItemStream() then data is returned as array of items received from the server. Server side functions: ====================== netio_Listen( [], [], [], [] ) --> | NIL netio_Accept( , [], [], [], [] ) --> | NIL netio_Compress( , [], [], [] ) --> NIL netio_VerifyClient( ) --> netio_Server( ) --> NIL netio_ServedConnection() --> netio_RPC( | [, ] ) --> netio_RPCFilter( , | | NIL ) --> NIL netio_ServerStop( | [, ] ) --> NIL netio_ServerTimeOut( [, ] ) --> [] netio_MTServer( [], [], [], [ | | ], [], [], [], [] ) --> netio_SrvStatus( [, | , @] ) --> netio_SrvSendItem( , , ) --> netio_SrvSendData( , , ) -->