2011-01-26 20:37 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbnetio/utils/netiosrv/netiosrv.prg
+ Added 'netio_ping' RPC function.
(utilitzed to detect broken connection. Is there a better way?)
* contrib/hbnetio/utils/netiosrv/netiosrv.hbp
- contrib/hbnetio/utils/netiosrv/netiocmd.prg
+ contrib/hbnetio/utils/netiosrv/netiocui.prg
* Renamed console UI source.
+ Added 'exit' command to console UI, to
simply exit the console.
+ Added detection of lost connection in console UI.
% Deleted NETIO_DISCONNECT() call. Not needed ti
NETIO_GETCONNCETION().
+ Added support for standalone console UI
build mode. Added required entry/cmdline help functions.
+ Added error msg when connection to server management
failed.
+ contrib/hbnetio/utils/netiosrv/netiocui.hbp
+ Added .hbp file for standalone console UI.
This commit is contained in:
@@ -16,6 +16,28 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2011-01-26 20:37 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbnetio/utils/netiosrv/netiosrv.prg
|
||||
+ Added 'netio_ping' RPC function.
|
||||
(utilitzed to detect broken connection. Is there a better way?)
|
||||
|
||||
* contrib/hbnetio/utils/netiosrv/netiosrv.hbp
|
||||
- contrib/hbnetio/utils/netiosrv/netiocmd.prg
|
||||
+ contrib/hbnetio/utils/netiosrv/netiocui.prg
|
||||
* Renamed console UI source.
|
||||
+ Added 'exit' command to console UI, to
|
||||
simply exit the console.
|
||||
+ Added detection of lost connection in console UI.
|
||||
% Deleted NETIO_DISCONNECT() call. Not needed ti
|
||||
NETIO_GETCONNCETION().
|
||||
+ Added support for standalone console UI
|
||||
build mode. Added required entry/cmdline help functions.
|
||||
+ Added error msg when connection to server management
|
||||
failed.
|
||||
|
||||
+ contrib/hbnetio/utils/netiosrv/netiocui.hbp
|
||||
+ Added .hbp file for standalone console UI.
|
||||
|
||||
2011-01-26 19:08 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/src/pp/hbpp.c
|
||||
* modified syntax info to keep output well formatted for 80 columns
|
||||
@@ -70,7 +92,7 @@
|
||||
This means the console UI can be easily removed or moved
|
||||
to separate executable.
|
||||
+ Added -noui cmdline option which disables interactive console.
|
||||
; Little rough around the edges, but it show the capabilities.
|
||||
; Little rough around the edges, but it shows the capabilities.
|
||||
|
||||
2011-01-25 14:41 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbnetio/utils/netiosrq/netiosrq.hbp
|
||||
|
||||
11
harbour/contrib/hbnetio/utils/netiosrv/netiocui.hbp
Normal file
11
harbour/contrib/hbnetio/utils/netiosrv/netiocui.hbp
Normal file
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
../../hbnetio.hbc
|
||||
|
||||
-w3 -es2 -l
|
||||
|
||||
-o${hb_name}
|
||||
|
||||
netiocui.prg
|
||||
@@ -18,9 +18,77 @@
|
||||
|
||||
#include "hbgtinfo.ch"
|
||||
|
||||
STATIC FUNCTION hbnetiosrv_LoadCmds( pConnection )
|
||||
#if ! defined( _CONSOLEUI_EMBEDDED )
|
||||
|
||||
PROCEDURE Main( ... )
|
||||
LOCAL cParam
|
||||
|
||||
LOCAL cIP := "127.0.0.1"
|
||||
LOCAL nPort := 2940
|
||||
LOCAL cPassword := ""
|
||||
|
||||
SET DATE ANSI
|
||||
SET CENTURY ON
|
||||
|
||||
HB_Logo()
|
||||
|
||||
FOR EACH cParam IN { ... }
|
||||
DO CASE
|
||||
CASE Lower( Left( cParam, 11 ) ) == "-adminport="
|
||||
nPort := Val( SubStr( cParam, 12 ) )
|
||||
CASE Lower( Left( cParam, 12 ) ) == "-adminaddr="
|
||||
cIP := SubStr( cParam, 13 )
|
||||
CASE Lower( Left( cParam, 11 ) ) == "-adminpass="
|
||||
cPassword := SubStr( cParam, 12 )
|
||||
hb_StrClear( @cParam )
|
||||
CASE Lower( cParam ) == "--version"
|
||||
RETURN
|
||||
CASE Lower( cParam ) == "-help" .OR. ;
|
||||
Lower( cParam ) == "--help"
|
||||
HB_Usage()
|
||||
RETURN
|
||||
OTHERWISE
|
||||
OutStd( "Warning: Unkown parameter ignored: " + cParam + hb_eol() )
|
||||
ENDCASE
|
||||
NEXT
|
||||
|
||||
netiosrv_cmdUI( cIP, nPort, cPassword )
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE HB_Logo()
|
||||
|
||||
OutStd( "Harbour NETIO Server Management Console " + StrTran( Version(), "Harbour " ) + hb_eol() +;
|
||||
"Copyright (c) 2009-2011, Viktor Szakats" + hb_eol() + ;
|
||||
"http://harbour-project.org/" + hb_eol() +;
|
||||
hb_eol() )
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE HB_Usage()
|
||||
|
||||
OutStd( "Syntax:" , hb_eol() )
|
||||
OutStd( hb_eol() )
|
||||
OutStd( " netiocmd [options]" , hb_eol() )
|
||||
OutStd( hb_eol() )
|
||||
OutStd( "Options:" , hb_eol() )
|
||||
OutStd( hb_eol() )
|
||||
OutStd( " -adminport=<port> connect to netio server on IP port <port>. Default: 2940" , hb_eol() )
|
||||
OutStd( " -adminaddr=<ipaddr> connect to netio server on IPv4 address <ipaddress>" , hb_eol() )
|
||||
OutStd( " Default: 127.0.0.1" , hb_eol() )
|
||||
OutStd( " -adminpass=<passwd> connect to netio server with password" , hb_eol() )
|
||||
OutStd( hb_eol() )
|
||||
OutStd( " --version display version header only" , hb_eol() )
|
||||
OutStd( " -help|--help this help" , hb_eol() )
|
||||
|
||||
RETURN
|
||||
|
||||
#endif
|
||||
|
||||
STATIC FUNCTION hbnetiosrv_LoadCmds( pConnection, /* @ */ lQuit )
|
||||
LOCAL hCmds := { ;
|
||||
"?" => { "" , "Synonym for 'help'." , {|| cmdHelp( hCmds ) } },;
|
||||
"exit" => { "" , "Exit console." , {|| lQuit := .T. } },;
|
||||
"clear" => { "" , "Clear screen." , {|| Scroll(), SetPos( 0, 0 ) } },;
|
||||
"sysinfo" => { "" , "Show system/build information." , {|| cmdSysInfo( pConnection ) } },;
|
||||
"show" => { "" , "Show list of connections." , {|| cmdConnInfo( pConnection ) } },;
|
||||
@@ -29,7 +97,7 @@ STATIC FUNCTION hbnetiosrv_LoadCmds( pConnection )
|
||||
"nologconn" => { "" , "Disable logging incoming connections." , {|| cmdConnLogEnable( pConnection, .F. ) } },;
|
||||
"logconn" => { "" , "Enable logging incoming connections." , {|| cmdConnLogEnable( pConnection, .T. ) } },;
|
||||
"stop" => { "[<ip:port>|all]", "Stop specified connection(s)." , {| cCommand | cmdConnStop( pConnection, cCommand ) } },;
|
||||
"quit" => { "" , "Stop server and exit." , {|| netio_funcexec( pConnection, "netio_shutdown" ) } },;
|
||||
"quit" => { "" , "Stop server and exit console." , {|| netio_funcexec( pConnection, "netio_shutdown" ) } },;
|
||||
"help" => { "" , "Display this help." , {|| cmdHelp( hCmds ) } } }
|
||||
|
||||
RETURN hCmds
|
||||
@@ -104,6 +172,8 @@ PROCEDURE netiosrv_cmdUI( cIP, nPort, cPassword )
|
||||
|
||||
LOCAL aHistory, nHistIndex
|
||||
|
||||
LOCAL lQuit
|
||||
|
||||
LOCAL pConnection
|
||||
|
||||
/* connect to the server */
|
||||
@@ -122,10 +192,19 @@ PROCEDURE netiosrv_cmdUI( cIP, nPort, cPassword )
|
||||
|
||||
aHistory := { "quit" }
|
||||
nHistIndex := Len( aHistory ) + 1
|
||||
hCommands := hbnetiosrv_LoadCmds( pConnection )
|
||||
hCommands := hbnetiosrv_LoadCmds( pConnection, @lQuit )
|
||||
|
||||
/* Command prompt */
|
||||
DO WHILE .T.
|
||||
lQuit := .F.
|
||||
|
||||
DO WHILE ! lQuit
|
||||
|
||||
/* Is connection alive? */
|
||||
BEGIN SEQUENCE WITH {| oError | Break( oError ) }
|
||||
netio_funcexec( pConnection, "netio_ping" )
|
||||
RECOVER
|
||||
QQOut( "Connection lost.", hb_eol() )
|
||||
EXIT
|
||||
END SEQUENCE
|
||||
|
||||
cCommand := Space( 128 )
|
||||
|
||||
@@ -190,7 +269,9 @@ PROCEDURE netiosrv_cmdUI( cIP, nPort, cPassword )
|
||||
ENDDO
|
||||
|
||||
/* Never reached */
|
||||
netio_disconnect( cIP, nPort )
|
||||
pConnection := NIL
|
||||
ELSE
|
||||
QQOut( "Error connecting server.", hb_eol() )
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
@@ -9,8 +9,10 @@
|
||||
|
||||
-o${hb_name}
|
||||
|
||||
-D_CONSOLEUI_EMBEDDED
|
||||
|
||||
netiosrv.prg
|
||||
netiocmd.prg
|
||||
netiocui.prg
|
||||
|
||||
-ldflag={allmsvc}-nxcompat
|
||||
-ldflag={allmsvc}-dynamicbase
|
||||
|
||||
@@ -188,7 +188,8 @@ PROCEDURE Main( ... )
|
||||
netio_mtserver( netiomgm[ _NETIOSRV_nPort ],;
|
||||
netiomgm[ _NETIOSRV_cIFAddr ],;
|
||||
NIL,;
|
||||
{ "netio_sendclientinfo" => {| ... | netio_mgmt_rpc_clientinfo( netiomgm, ... ) } ,;
|
||||
{ "netio_ping" => {| ... | .T. } ,;
|
||||
"netio_sendclientinfo" => {| ... | netio_mgmt_rpc_clientinfo( netiomgm, ... ) } ,;
|
||||
"netio_sysinfo" => {| ... | netio_mgmt_rpc_sysinfo() } ,;
|
||||
"netio_shutdown" => {| ... | netio_mgmt_rpc_shutdown( netiosrv ) } ,;
|
||||
"netio_conninfo" => {| ... | netio_mgmt_rpc_conninfo( netiosrv ) } ,;
|
||||
|
||||
Reference in New Issue
Block a user