2016-02-09 18:11 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbnetio/hbnetio.hbx
* contrib/hbnetio/netiocli.c
* contrib/hbnetio/readme.txt
+ added new client side function:
netio_SetPath( <pConnection> [, <cPath>] ) -> [<cPrevPath>]
It set/get path prefix for automatic file redirection to HBNETIO.
If automatic redirection is activated then <cPath> 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"
* allow to pass filename to netio_Decode() with "net:" prefix
* allow to pass to use "net:" prefix in function names passed
to netio_{Proc|Func}*() when <pConnection> parameter is not used
! fixed possible GPF trap when connection cannot be set
* src/vm/memvars.c
% do not create reference chain when memvars are passed by reference
and called function uses PARAMETERS statement
! do not return references from __mvDbgInfo() but destination values
* doc/xhb-diff.txt
! typo
* src/vm/itemapi.c
! typo in debug trace message
This commit is contained in:
@@ -10,6 +10,36 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
2016-02-09 18:11 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* contrib/hbnetio/hbnetio.hbx
|
||||
* contrib/hbnetio/netiocli.c
|
||||
* contrib/hbnetio/readme.txt
|
||||
+ added new client side function:
|
||||
netio_SetPath( <pConnection> [, <cPath>] ) -> [<cPrevPath>]
|
||||
It set/get path prefix for automatic file redirection to HBNETIO.
|
||||
If automatic redirection is activated then <cPath> 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"
|
||||
* allow to pass filename to netio_Decode() with "net:" prefix
|
||||
* allow to pass to use "net:" prefix in function names passed
|
||||
to netio_{Proc|Func}*() when <pConnection> parameter is not used
|
||||
! fixed possible GPF trap when connection cannot be set
|
||||
|
||||
* src/vm/memvars.c
|
||||
% do not create reference chain when memvars are passed by reference
|
||||
and called function uses PARAMETERS statement
|
||||
! do not return references from __mvDbgInfo() but destination values
|
||||
|
||||
* doc/xhb-diff.txt
|
||||
! typo
|
||||
|
||||
* src/vm/itemapi.c
|
||||
! typo in debug trace message
|
||||
|
||||
2016-02-08 22:38 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* doc/xhb-diff.txt
|
||||
* updated chapter "MACROS WITH DECLARED SYMBOLS" - better description
|
||||
|
||||
@@ -43,6 +43,7 @@ DYNAMIC netio_ServedConnection
|
||||
DYNAMIC netio_Server
|
||||
DYNAMIC netio_ServerStop
|
||||
DYNAMIC netio_ServerTimeOut
|
||||
DYNAMIC netio_SetPath
|
||||
DYNAMIC netio_SrvSendData
|
||||
DYNAMIC netio_SrvSendItem
|
||||
DYNAMIC netio_SrvStatus
|
||||
|
||||
@@ -116,6 +116,7 @@ typedef struct _HB_CONCLI
|
||||
PHB_SOCKEX sock;
|
||||
PHB_SRVDATA srvdata;
|
||||
struct _HB_CONCLI * next;
|
||||
char * path;
|
||||
int level;
|
||||
int strategy;
|
||||
int passlen;
|
||||
@@ -152,6 +153,8 @@ static HB_TSD_NEW( s_conData, sizeof( HB_CONDATA ), NULL, NULL );
|
||||
|
||||
static PHB_CONCLI s_connections = NULL;
|
||||
|
||||
static HB_COUNTER s_pathCount = 0;
|
||||
|
||||
static HB_BOOL s_defaultInit = HB_TRUE;
|
||||
static HB_CONDATA s_defaultConn = {
|
||||
NETIO_DEFAULT_TIMEOUT,
|
||||
@@ -511,7 +514,8 @@ static HB_BOOL s_fileProcessData( PHB_CONCLI conn )
|
||||
|
||||
static void s_fileConFree( PHB_CONCLI conn )
|
||||
{
|
||||
hb_sockexClose( conn->sock, HB_TRUE );
|
||||
if( conn->sock )
|
||||
hb_sockexClose( conn->sock, HB_TRUE );
|
||||
while( conn->srvdata )
|
||||
{
|
||||
PHB_SRVDATA pSrvData = conn->srvdata;
|
||||
@@ -524,6 +528,11 @@ static void s_fileConFree( PHB_CONCLI conn )
|
||||
}
|
||||
if( conn->mutex )
|
||||
hb_itemRelease( conn->mutex );
|
||||
if( conn->path )
|
||||
{
|
||||
hb_atomic_dec( &s_pathCount );
|
||||
hb_xfree( conn->path );
|
||||
}
|
||||
hb_xfree( conn );
|
||||
}
|
||||
|
||||
@@ -543,6 +552,7 @@ static PHB_CONCLI s_fileConNew( HB_SOCKET sd, const char * pszServer,
|
||||
conn->errcode = 0;
|
||||
conn->srvdata = NULL;
|
||||
conn->next = NULL;
|
||||
conn->path = NULL;
|
||||
conn->timeout = iTimeOut;
|
||||
conn->port = iPort;
|
||||
memcpy( conn->server, pszServer, iLen + 1 );
|
||||
@@ -671,6 +681,40 @@ static void s_fileConUnlock( PHB_CONCLI conn )
|
||||
hb_threadMutexUnlock( conn->mutex );
|
||||
}
|
||||
|
||||
static PHB_CONCLI s_fileNameConFind( const char ** pFileName, HB_BOOL fLock )
|
||||
{
|
||||
PHB_CONCLI conn = NULL;
|
||||
|
||||
if( s_pathCount > 0 )
|
||||
{
|
||||
HB_NETIO_LOCK();
|
||||
conn = s_connections;
|
||||
while( conn )
|
||||
{
|
||||
if( conn->path )
|
||||
{
|
||||
int iLen = ( int ) strlen( conn->path );
|
||||
#ifdef HB_OS_UNIX
|
||||
if( strncmp( *pFileName, conn->path, iLen ) == 0 )
|
||||
#else
|
||||
if( hb_strnicmp( *pFileName, conn->path, iLen ) == 0 )
|
||||
#endif
|
||||
{
|
||||
if( fLock )
|
||||
hb_atomic_inc( &conn->used );
|
||||
*pFileName += iLen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
conn = conn->next;
|
||||
}
|
||||
HB_NETIO_UNLOCK();
|
||||
}
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
||||
|
||||
static void s_fileGetConnParam( const char ** pszServer, int * piPort, int * piTimeOut,
|
||||
const char ** pszPasswd, int * piPassLen )
|
||||
{
|
||||
@@ -802,13 +846,16 @@ static const char * s_fileDecode( const char * pszFileName,
|
||||
return pszFileName;
|
||||
}
|
||||
|
||||
static PHB_CONCLI s_fileConnCheck( PHB_CONCLI conn, const char ** pFileName, HB_BOOL fDefault )
|
||||
static PHB_CONCLI s_fileConnCheck( PHB_CONCLI conn, const char ** pFileName,
|
||||
HB_BOOL fDefault, HB_BOOL * pfResult )
|
||||
{
|
||||
if( conn )
|
||||
const char * pszFileName = *pFileName;
|
||||
|
||||
*pfResult = HB_TRUE;
|
||||
if( hb_strnicmp( pszFileName, NETIO_FILE_PREFIX, NETIO_FILE_PREFIX_LEN ) == 0 )
|
||||
{
|
||||
char server[ NETIO_SERVERNAME_MAX ];
|
||||
const char * pszServer = NULL;
|
||||
char * pszIpAddres;
|
||||
int iPort = 0;
|
||||
|
||||
if( ! fDefault )
|
||||
@@ -819,18 +866,48 @@ static PHB_CONCLI s_fileConnCheck( PHB_CONCLI conn, const char ** pFileName, HB_
|
||||
else
|
||||
s_fileGetConnParam( &pszServer, &iPort, NULL, NULL, NULL );
|
||||
|
||||
*pFileName = s_fileDecode( *pFileName, server,
|
||||
&pszServer, &iPort, NULL,
|
||||
NULL, NULL, NULL, NULL );
|
||||
|
||||
pszIpAddres = hb_socketResolveAddr( pszServer, HB_SOCKET_AF_INET );
|
||||
if( pszIpAddres == NULL || s_fileConFind( pszIpAddres, iPort ) != conn )
|
||||
conn = NULL;
|
||||
if( pszIpAddres )
|
||||
hb_xfree( pszIpAddres );
|
||||
pszFileName = s_fileDecode( pszFileName + NETIO_FILE_PREFIX_LEN, server,
|
||||
&pszServer, &iPort, NULL,
|
||||
NULL, NULL, NULL, NULL );
|
||||
if( iPort != conn->port )
|
||||
*pfResult = HB_FALSE;
|
||||
else
|
||||
{
|
||||
if( pszServer != conn->server && hb_stricmp( pszServer, conn->server ) != 0 )
|
||||
{
|
||||
char * pszIpAddres = hb_socketResolveAddr( pszServer, HB_SOCKET_AF_INET );
|
||||
if( pszIpAddres == NULL || hb_stricmp( pszIpAddres, conn->server ) != 0 )
|
||||
{
|
||||
*pfResult = HB_FALSE;
|
||||
conn = NULL;
|
||||
}
|
||||
if( pszIpAddres )
|
||||
hb_xfree( pszIpAddres );
|
||||
}
|
||||
if( conn )
|
||||
*pFileName = pszFileName;
|
||||
return conn;
|
||||
}
|
||||
}
|
||||
else if( s_pathCount > 0 && conn->path )
|
||||
{
|
||||
HB_NETIO_LOCK();
|
||||
if( conn->path )
|
||||
{
|
||||
int iLen = ( int ) strlen( conn->path );
|
||||
#ifdef HB_OS_UNIX
|
||||
if( strncmp( *pFileName, conn->path, iLen ) == 0 )
|
||||
#else
|
||||
if( hb_strnicmp( *pFileName, conn->path, iLen ) == 0 )
|
||||
#endif
|
||||
*pFileName += iLen;
|
||||
}
|
||||
HB_NETIO_LOCK();
|
||||
if( pszFileName != *pFileName )
|
||||
return conn;
|
||||
}
|
||||
|
||||
return conn;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static PHB_CONCLI s_fileConnect( const char ** pFileName,
|
||||
@@ -839,68 +916,81 @@ static PHB_CONCLI s_fileConnect( const char ** pFileName,
|
||||
const char * pszPasswd, int iPassLen,
|
||||
int iLevel, int iStrategy )
|
||||
{
|
||||
PHB_CONCLI conn;
|
||||
char server[ NETIO_SERVERNAME_MAX ];
|
||||
char * pszIpAddres;
|
||||
|
||||
s_fileGetConnParam( &pszServer, &iPort, &iTimeOut, &pszPasswd, &iPassLen );
|
||||
PHB_CONCLI conn = NULL;
|
||||
|
||||
if( pFileName )
|
||||
*pFileName = s_fileDecode( *pFileName, server,
|
||||
&pszServer, &iPort, &iTimeOut,
|
||||
&pszPasswd, &iPassLen, &iLevel, &iStrategy );
|
||||
{
|
||||
if( hb_strnicmp( *pFileName, NETIO_FILE_PREFIX, NETIO_FILE_PREFIX_LEN ) == 0 )
|
||||
*pFileName += NETIO_FILE_PREFIX_LEN;
|
||||
else
|
||||
conn = s_fileNameConFind( pFileName, HB_TRUE );
|
||||
}
|
||||
|
||||
if( iLevel == HB_ZLIB_COMPRESSION_DISABLE && iPassLen )
|
||||
iLevel = HB_ZLIB_COMPRESSION_DEFAULT;
|
||||
|
||||
pszIpAddres = hb_socketResolveAddr( pszServer, HB_SOCKET_AF_INET );
|
||||
if( pszIpAddres == NULL )
|
||||
return NULL;
|
||||
|
||||
conn = s_fileConFind( pszIpAddres, iPort );
|
||||
if( conn == NULL )
|
||||
{
|
||||
HB_SOCKET sd = hb_socketOpen( HB_SOCKET_PF_INET, HB_SOCKET_PT_STREAM, 0 );
|
||||
if( sd != HB_NO_SOCKET )
|
||||
char server[ NETIO_SERVERNAME_MAX ];
|
||||
char * pszIpAddres;
|
||||
|
||||
s_fileGetConnParam( &pszServer, &iPort, &iTimeOut, &pszPasswd, &iPassLen );
|
||||
|
||||
if( pFileName )
|
||||
*pFileName = s_fileDecode( *pFileName, server,
|
||||
&pszServer, &iPort, &iTimeOut,
|
||||
&pszPasswd, &iPassLen, &iLevel, &iStrategy );
|
||||
|
||||
if( iLevel == HB_ZLIB_COMPRESSION_DISABLE && iPassLen )
|
||||
iLevel = HB_ZLIB_COMPRESSION_DEFAULT;
|
||||
|
||||
pszIpAddres = hb_socketResolveAddr( pszServer, HB_SOCKET_AF_INET );
|
||||
if( pszIpAddres == NULL )
|
||||
return NULL;
|
||||
|
||||
conn = s_fileConFind( pszIpAddres, iPort );
|
||||
if( conn == NULL )
|
||||
{
|
||||
void * pSockAddr;
|
||||
unsigned uiLen;
|
||||
|
||||
if( hb_socketInetAddr( &pSockAddr, &uiLen, pszIpAddres, iPort ) )
|
||||
{
|
||||
hb_socketSetKeepAlive( sd, HB_TRUE );
|
||||
if( hb_socketConnect( sd, pSockAddr, uiLen, iTimeOut ) == 0 )
|
||||
{
|
||||
hb_socketSetNoDelay( sd, HB_TRUE );
|
||||
conn = s_fileConNew( sd, pszIpAddres, iPort, iTimeOut,
|
||||
pszPasswd, iPassLen, iLevel, iStrategy );
|
||||
if( conn )
|
||||
{
|
||||
HB_BYTE msgbuf[ NETIO_MSGLEN ];
|
||||
HB_U16 len = ( HB_U16 ) strlen( NETIO_LOGINSTRID );
|
||||
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 0 ], NETIO_LOGIN );
|
||||
HB_PUT_LE_UINT16( &msgbuf[ 4 ], len );
|
||||
memset( msgbuf + 6, '\0', sizeof( msgbuf ) - 6 );
|
||||
|
||||
if( ! s_fileSendMsg( conn, msgbuf, NETIO_LOGINSTRID, len,
|
||||
HB_TRUE, fNoError ) ||
|
||||
HB_GET_LE_UINT32( &msgbuf[ 4 ] ) != NETIO_CONNECTED )
|
||||
{
|
||||
s_fileConFree( conn );
|
||||
conn = NULL;
|
||||
}
|
||||
else
|
||||
s_fileConRegister( conn );
|
||||
|
||||
sd = HB_NO_SOCKET;
|
||||
}
|
||||
}
|
||||
hb_xfree( pSockAddr );
|
||||
}
|
||||
HB_SOCKET sd = hb_socketOpen( HB_SOCKET_PF_INET, HB_SOCKET_PT_STREAM, 0 );
|
||||
if( sd != HB_NO_SOCKET )
|
||||
hb_socketClose( sd );
|
||||
{
|
||||
void * pSockAddr;
|
||||
unsigned uiLen;
|
||||
|
||||
if( hb_socketInetAddr( &pSockAddr, &uiLen, pszIpAddres, iPort ) )
|
||||
{
|
||||
hb_socketSetKeepAlive( sd, HB_TRUE );
|
||||
if( hb_socketConnect( sd, pSockAddr, uiLen, iTimeOut ) == 0 )
|
||||
{
|
||||
hb_socketSetNoDelay( sd, HB_TRUE );
|
||||
conn = s_fileConNew( sd, pszIpAddres, iPort, iTimeOut,
|
||||
pszPasswd, iPassLen, iLevel, iStrategy );
|
||||
if( conn )
|
||||
{
|
||||
HB_BYTE msgbuf[ NETIO_MSGLEN ];
|
||||
HB_U16 len = ( HB_U16 ) strlen( NETIO_LOGINSTRID );
|
||||
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 0 ], NETIO_LOGIN );
|
||||
HB_PUT_LE_UINT16( &msgbuf[ 4 ], len );
|
||||
memset( msgbuf + 6, '\0', sizeof( msgbuf ) - 6 );
|
||||
|
||||
if( ! s_fileSendMsg( conn, msgbuf, NETIO_LOGINSTRID, len,
|
||||
HB_TRUE, fNoError ) ||
|
||||
HB_GET_LE_UINT32( &msgbuf[ 4 ] ) != NETIO_CONNECTED )
|
||||
{
|
||||
s_fileConFree( conn );
|
||||
conn = NULL;
|
||||
}
|
||||
else
|
||||
s_fileConRegister( conn );
|
||||
|
||||
sd = HB_NO_SOCKET;
|
||||
}
|
||||
}
|
||||
hb_xfree( pSockAddr );
|
||||
}
|
||||
if( sd != HB_NO_SOCKET )
|
||||
hb_socketClose( sd );
|
||||
}
|
||||
}
|
||||
hb_xfree( pszIpAddres );
|
||||
}
|
||||
|
||||
if( conn != NULL && s_defaultInit )
|
||||
@@ -908,7 +998,7 @@ static PHB_CONCLI s_fileConnect( const char ** pFileName,
|
||||
HB_NETIO_LOCK();
|
||||
if( s_defaultInit )
|
||||
{
|
||||
hb_strncpy( s_defaultConn.server, pszIpAddres,
|
||||
hb_strncpy( s_defaultConn.server, conn->server,
|
||||
sizeof( s_defaultConn.server ) - 1 );
|
||||
s_defaultConn.port = iPort;
|
||||
s_defaultConn.timeout = iTimeOut;
|
||||
@@ -922,8 +1012,6 @@ static PHB_CONCLI s_fileConnect( const char ** pFileName,
|
||||
HB_NETIO_UNLOCK();
|
||||
}
|
||||
|
||||
hb_xfree( pszIpAddres );
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
||||
@@ -978,9 +1066,16 @@ HB_FUNC( NETIO_DECODE )
|
||||
|
||||
s_fileGetConnParam( &pszServer, &iPort, &iTimeOut, &pszPasswd, &iPassLen );
|
||||
|
||||
pszFile = s_fileDecode( pszFullName, server,
|
||||
&pszServer, &iPort, &iTimeOut,
|
||||
&pszPasswd, &iPassLen, &iLevel, &iStrategy );
|
||||
if( pszFullName )
|
||||
{
|
||||
if( hb_strnicmp( pszFullName, NETIO_FILE_PREFIX, NETIO_FILE_PREFIX_LEN ) == 0 )
|
||||
pszFullName += NETIO_FILE_PREFIX_LEN;
|
||||
pszFile = s_fileDecode( pszFullName, server,
|
||||
&pszServer, &iPort, &iTimeOut,
|
||||
&pszPasswd, &iPassLen, &iLevel, &iStrategy );
|
||||
}
|
||||
else
|
||||
pszFile = NULL;
|
||||
|
||||
if( iLevel == HB_ZLIB_COMPRESSION_DISABLE && iPassLen )
|
||||
iLevel = HB_ZLIB_COMPRESSION_DEFAULT;
|
||||
@@ -1145,6 +1240,47 @@ HB_FUNC( NETIO_TIMEOUT )
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( NETIO_SETPATH )
|
||||
{
|
||||
PHB_CONCLI conn = s_connParam( 1 );
|
||||
|
||||
if( conn )
|
||||
{
|
||||
if( s_fileConLock( conn ) )
|
||||
{
|
||||
const char * pszNewPath = hb_parc( 2 );
|
||||
char * pszSetPath = NULL, * pszOldPath = NULL;
|
||||
|
||||
if( pszNewPath && *pszNewPath )
|
||||
pszSetPath = hb_strdup( pszNewPath );
|
||||
|
||||
HB_NETIO_LOCK();
|
||||
if( pszNewPath )
|
||||
{
|
||||
if( conn->path )
|
||||
{
|
||||
hb_atomic_dec( &s_pathCount );
|
||||
pszOldPath = conn->path;
|
||||
conn->path = NULL;
|
||||
}
|
||||
if( pszSetPath )
|
||||
{
|
||||
conn->path = pszSetPath;
|
||||
hb_atomic_inc( &s_pathCount );
|
||||
}
|
||||
}
|
||||
else if( conn->path )
|
||||
pszOldPath = hb_strdup( conn->path );
|
||||
HB_NETIO_UNLOCK();
|
||||
s_fileConUnlock( conn );
|
||||
hb_retc_buffer( pszOldPath );
|
||||
}
|
||||
s_fileConClose( conn );
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
static const char * s_netio_params( int iParam, int iMsg, const char * pszName, HB_U32 * pSize, char ** pFree )
|
||||
{
|
||||
int iPCount = iMsg == NETIO_PROCIS ? 0 : hb_pcount();
|
||||
@@ -1455,7 +1591,8 @@ static HB_BOOL s_fileAccept( PHB_FILE_FUNCS pFuncs, const char * pszFileName )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
return hb_strnicmp( pszFileName, NETIO_FILE_PREFIX, NETIO_FILE_PREFIX_LEN ) == 0;
|
||||
return hb_strnicmp( pszFileName, NETIO_FILE_PREFIX, NETIO_FILE_PREFIX_LEN ) == 0 ||
|
||||
s_fileNameConFind( &pszFileName, HB_FALSE ) != NULL;
|
||||
}
|
||||
|
||||
static HB_BOOL s_fileDirExists( PHB_FILE_FUNCS pFuncs, const char * pszDirName )
|
||||
@@ -1465,8 +1602,6 @@ static HB_BOOL s_fileDirExists( PHB_FILE_FUNCS pFuncs, const char * pszDirName )
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszDirName += NETIO_FILE_PREFIX_LEN;
|
||||
|
||||
conn = s_fileConnect( &pszDirName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1495,8 +1630,6 @@ static HB_BOOL s_fileDirMake( PHB_FILE_FUNCS pFuncs, const char * pszDirName )
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszDirName += NETIO_FILE_PREFIX_LEN;
|
||||
|
||||
conn = s_fileConnect( &pszDirName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1525,8 +1658,6 @@ static HB_BOOL s_fileDirRemove( PHB_FILE_FUNCS pFuncs, const char * pszDirName )
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszDirName += NETIO_FILE_PREFIX_LEN;
|
||||
|
||||
conn = s_fileConnect( &pszDirName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1555,8 +1686,6 @@ static double s_fileDirSpace( PHB_FILE_FUNCS pFuncs, const char * pszDirName, HB
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszDirName += NETIO_FILE_PREFIX_LEN;
|
||||
|
||||
conn = s_fileConnect( &pszDirName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1590,7 +1719,6 @@ static PHB_ITEM s_fileDirectory( PHB_FILE_FUNCS pFuncs, const char * pszDirSpec,
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszDirSpec += NETIO_FILE_PREFIX_LEN;
|
||||
conn = s_fileConnect( &pszDirSpec, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1665,8 +1793,6 @@ static HB_BOOL s_fileExists( PHB_FILE_FUNCS pFuncs, const char * pszFileName, ch
|
||||
if( pRetPath )
|
||||
hb_strncpy( pRetPath, pszFileName, HB_PATH_MAX - 1 );
|
||||
|
||||
pszFileName += NETIO_FILE_PREFIX_LEN;
|
||||
|
||||
conn = s_fileConnect( &pszFileName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1695,8 +1821,6 @@ static HB_BOOL s_fileDelete( PHB_FILE_FUNCS pFuncs, const char * pszFileName )
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszFileName += NETIO_FILE_PREFIX_LEN;
|
||||
|
||||
conn = s_fileConnect( &pszFileName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1723,19 +1847,13 @@ static HB_BOOL s_fileRename( PHB_FILE_FUNCS pFuncs, const char * pszFileName, co
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
PHB_CONCLI conn;
|
||||
|
||||
pszFileName += NETIO_FILE_PREFIX_LEN;
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
conn = s_fileConnect( &pszFileName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
{
|
||||
fResult = HB_TRUE;
|
||||
|
||||
if( s_fileAccept( pFuncs, pszNewName ) )
|
||||
{
|
||||
pszNewName += NETIO_FILE_PREFIX_LEN;
|
||||
fResult = s_fileConnCheck( conn, &pszNewName, HB_FALSE ) != NULL;
|
||||
}
|
||||
|
||||
s_fileConnCheck( conn, &pszNewName, HB_FALSE, &fResult );
|
||||
if( ! fResult )
|
||||
{
|
||||
conn->errcode = 2;
|
||||
@@ -1768,8 +1886,7 @@ static HB_BOOL s_fileRename( PHB_FILE_FUNCS pFuncs, const char * pszFileName, co
|
||||
static HB_BOOL s_fileCopy( PHB_FILE_FUNCS pFuncs, const char * pszSrcFile, const char * pszDstFile )
|
||||
{
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
const char * pszSource = pszSrcFile + NETIO_FILE_PREFIX_LEN;
|
||||
const char * pszDestin = pszDstFile + NETIO_FILE_PREFIX_LEN;
|
||||
const char * pszSource = pszSrcFile;
|
||||
PHB_CONCLI conn;
|
||||
|
||||
if( ! s_fileAccept( pFuncs, pszDstFile ) )
|
||||
@@ -1779,17 +1896,17 @@ static HB_BOOL s_fileCopy( PHB_FILE_FUNCS pFuncs, const char * pszSrcFile, const
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
{
|
||||
if( s_fileConnCheck( conn, &pszDestin, HB_TRUE ) == NULL )
|
||||
if( s_fileConnCheck( conn, &pszDstFile, HB_FALSE, &fResult ) == NULL )
|
||||
fResult = hb_fsCopy( pszSrcFile, pszDstFile );
|
||||
else if( s_fileConLock( conn ) )
|
||||
{
|
||||
HB_BYTE msgbuf[ NETIO_MSGLEN ];
|
||||
HB_U16 len1 = ( HB_U16 ) strlen( pszSource );
|
||||
HB_U16 len2 = ( HB_U16 ) strlen( pszDestin );
|
||||
HB_U16 len2 = ( HB_U16 ) strlen( pszDstFile );
|
||||
HB_BYTE * pBuffer = ( HB_BYTE * ) hb_xgrab( len1 + len2 );
|
||||
|
||||
memcpy( pBuffer, pszSource, len1 );
|
||||
memcpy( pBuffer + len1, pszDestin, len2 );
|
||||
memcpy( pBuffer + len1, pszDstFile, len2 );
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 0 ], NETIO_COPY );
|
||||
HB_PUT_LE_UINT16( &msgbuf[ 4 ], len1 );
|
||||
HB_PUT_LE_UINT16( &msgbuf[ 6 ], len2 );
|
||||
@@ -1812,8 +1929,6 @@ static HB_BOOL s_fileAttrGet( PHB_FILE_FUNCS pFuncs, const char * pszFileName, H
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszFileName += NETIO_FILE_PREFIX_LEN;
|
||||
|
||||
conn = s_fileConnect( &pszFileName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1846,8 +1961,6 @@ static HB_BOOL s_fileAttrSet( PHB_FILE_FUNCS pFuncs, const char * pszFileName, H
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszFileName += NETIO_FILE_PREFIX_LEN;
|
||||
|
||||
conn = s_fileConnect( &pszFileName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1877,8 +1990,6 @@ static HB_BOOL s_fileTimeGet( PHB_FILE_FUNCS pFuncs, const char * pszFileName, l
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszFileName += NETIO_FILE_PREFIX_LEN;
|
||||
|
||||
conn = s_fileConnect( &pszFileName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1912,8 +2023,6 @@ static HB_BOOL s_fileTimeSet( PHB_FILE_FUNCS pFuncs, const char * pszFileName, l
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszFileName += NETIO_FILE_PREFIX_LEN;
|
||||
|
||||
conn = s_fileConnect( &pszFileName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -1942,19 +2051,13 @@ static HB_BOOL s_fileLink( PHB_FILE_FUNCS pFuncs, const char * pszExisting, cons
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
PHB_CONCLI conn;
|
||||
|
||||
pszExisting += NETIO_FILE_PREFIX_LEN;
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
conn = s_fileConnect( &pszExisting, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
{
|
||||
fResult = HB_TRUE;
|
||||
|
||||
if( s_fileAccept( pFuncs, pszNewName ) )
|
||||
{
|
||||
pszNewName += NETIO_FILE_PREFIX_LEN;
|
||||
fResult = s_fileConnCheck( conn, &pszNewName, HB_FALSE ) != NULL;
|
||||
}
|
||||
|
||||
s_fileConnCheck( conn, &pszNewName, HB_FALSE, &fResult );
|
||||
if( ! fResult )
|
||||
{
|
||||
conn->errcode = 2;
|
||||
@@ -1989,19 +2092,13 @@ static HB_BOOL s_fileLinkSym( PHB_FILE_FUNCS pFuncs, const char * pszTarget, con
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
PHB_CONCLI conn;
|
||||
|
||||
pszTarget += NETIO_FILE_PREFIX_LEN;
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
conn = s_fileConnect( &pszTarget, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
{
|
||||
fResult = HB_TRUE;
|
||||
|
||||
if( s_fileAccept( pFuncs, pszNewName ) )
|
||||
{
|
||||
pszNewName += NETIO_FILE_PREFIX_LEN;
|
||||
fResult = s_fileConnCheck( conn, &pszNewName, HB_FALSE ) != NULL;
|
||||
}
|
||||
|
||||
s_fileConnCheck( conn, &pszNewName, HB_FALSE, &fResult );
|
||||
if( ! fResult )
|
||||
{
|
||||
conn->errcode = 2;
|
||||
@@ -2038,7 +2135,6 @@ static char * s_fileLinkRead( PHB_FILE_FUNCS pFuncs, const char * pszFileName )
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
|
||||
pszFileName += NETIO_FILE_PREFIX_LEN;
|
||||
conn = s_fileConnect( &pszFileName, NULL, 0, 0, HB_FALSE,
|
||||
NULL, 0, HB_ZLIB_COMPRESSION_DISABLE, 0 );
|
||||
if( conn )
|
||||
@@ -2089,7 +2185,7 @@ static PHB_FILE s_fileOpen( PHB_FILE_FUNCS pFuncs, const char * pszFileName,
|
||||
{
|
||||
PHB_FILE pFile = NULL;
|
||||
PHB_CONCLI conn;
|
||||
const char * pszFile = pszFileName + NETIO_FILE_PREFIX_LEN;
|
||||
const char * pszFile = pszFileName;
|
||||
|
||||
HB_SYMBOL_UNUSED( pFuncs );
|
||||
HB_SYMBOL_UNUSED( pPaths );
|
||||
|
||||
@@ -59,7 +59,7 @@ Client side functions:
|
||||
netio_GetConnection( [<cServer>], [<nPort>], [<nTimeOut>], ;
|
||||
[<cPasswd>], [<nCompressionLevel>], [<nStrategy>] )
|
||||
-> <pConnection> | NIL
|
||||
Get pointer item with HBNTIO connection. It can be used to speedup
|
||||
Get pointer item with HBNETIO connection. It can be used to speedup
|
||||
RPC calls and stream functions when <pConnection> is passed as
|
||||
parameter to these functions.
|
||||
|
||||
@@ -73,13 +73,24 @@ Client side functions:
|
||||
-> <lDecoded>
|
||||
Decode connection parameters from <cFullName> and default settings.
|
||||
Return .T. if <cFullName> contains any connection settings.
|
||||
<cFullName> should not contain "net:" prefix.
|
||||
<cFullName> does not need to be prefixed with "net:"
|
||||
|
||||
|
||||
netio_TimeOut( <pConnection> [, <nTimeOut>] ) -> [<nTimeOut>]
|
||||
Get/Set client side timeout for messages
|
||||
|
||||
|
||||
netio_SetPath( <pConnection> [, <cPath>] ) -> [<cPrevPath>]
|
||||
Set/Get path prefix for automatic file redirection to HBNETIO.
|
||||
If automatic redirection is activated then <cPath> 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( [<pConnection>,] <cProcName> ) -> <lExists>
|
||||
Check if function or procedure exists on the server side.
|
||||
|
||||
|
||||
@@ -733,7 +733,7 @@ are preprocessed at runtime by macro compiler. It checks if characters
|
||||
after "&" are valid variable name (starts with "_" or letter and then
|
||||
mix of "_", letters and digits until first different character) and if
|
||||
yes and such private or public variable exists and it contains string
|
||||
then the original string is modified and &<varname>[.] is substitute
|
||||
then the original string is modified and &<varname>[.] is substituted
|
||||
by variable contents, i.e.
|
||||
private var := "ABC"
|
||||
? "[&var-rest][&var.rest]" // prints: [ABC-rest][ABCrest]
|
||||
|
||||
@@ -1805,7 +1805,7 @@ void hb_itemMoveToRef( PHB_ITEM pDest, PHB_ITEM pSource )
|
||||
|
||||
void hb_itemMoveFromRef( PHB_ITEM pDest, PHB_ITEM pSource )
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyFromRef(%p, %p)", pDest, pSource ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_itemMoveFromRef(%p, %p)", pDest, pSource ) );
|
||||
|
||||
if( HB_IS_BYREF( pSource ) )
|
||||
{
|
||||
|
||||
@@ -269,7 +269,14 @@ static void hb_memvarAddPrivate( PHB_DYNS pDynSym, PHB_ITEM pValue )
|
||||
pPrivateStack->stack[ pPrivateStack->count ].pDynSym = pDynSym;
|
||||
pPrivateStack->stack[ pPrivateStack->count++ ].pPrevMemvar = hb_dynsymGetMemvar( pDynSym );
|
||||
|
||||
pMemvar = hb_memvarValueNew();
|
||||
if( pValue && HB_IS_MEMVAR( pValue ) )
|
||||
{
|
||||
pMemvar = pValue->item.asMemvar.value;
|
||||
hb_xRefInc( pMemvar );
|
||||
pValue = NULL;
|
||||
}
|
||||
else
|
||||
pMemvar = hb_memvarValueNew();
|
||||
hb_dynsymSetMemvar( pDynSym, pMemvar );
|
||||
}
|
||||
|
||||
@@ -1217,7 +1224,7 @@ HB_FUNC( __MVDBGINFO )
|
||||
if( pValue ) /* the requested variable was found */
|
||||
{
|
||||
hb_storc( szName, 3 );
|
||||
hb_itemReturn( pValue );
|
||||
hb_itemCopyFromRef( hb_stackReturnItem(), pValue );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user