• R/O
  • HTTP
  • SSH
  • HTTPS

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Virtual machine Management Terminal User Interface


File Info

修訂. 50b2e09d722b08e7afe48c362605b0d1e89d6780
大小 4,498 bytes
時間 2023-05-06 22:05:00
作者 Koine Yuusuke(koinec)
Log Message

Fix build error on FreeBSD 13.2-RELEASE.

Content

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
          VMTUI (Virtual machine Management Terminal User Interface)

         Copyright(C) 2022- Koine Yuusuke(koinec). All Rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.

 THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY EXPRESS
 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE LIABLE FOR ANY
 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#define	VMTUI_SRC_MAIN
#include "vmtui.h"


/* ===========================================================================*/
int
	VmTui_Init(
		void )
{
	int		i_err;

	i_err	= ErrInfo_Init( 0x00, ERRINFO_FLAG_TUIWIN | ERRINFO_FLAG_SYSLOG );
	if( 0x00 != i_err )	{
		return -0x01;
	}

	i_err	= LocalExec_Init();
	if( 0x00 != i_err )	{
		return -0x01;
	}

	i_err	= HVisor_Init();
	if( 0x00 != i_err )	{
		return -0x01;
	}

	i_err	= Guest_Init();
	if( 0x00 != i_err )	{
		return -0x02;
	}

	i_err	= Request_Init();
	if( 0x00 != i_err )	{
		return -0x03;
	}

	i_err	= LocalCmd_Init();
	if( 0x00 != i_err )	{
		return -0x04;
	}

	i_err	= SSHCmd_Init();
	if( 0x00 != i_err )	{
		return -0x04;
	}

	i_err	= LocalShell_Init();
	if( 0x00 != i_err )	{
		return -0x05;
	}

	i_err	= TuiSys_Init();
	if( 0x00 != i_err )	{
		return -0x05;
	}

	return 0x00;
}

/* ===========================================================================*/
int
	VmTui_Term(
		void )
{
	TuiSys_Term();
	SSHCmd_Term();
	LocalCmd_Term();
	Request_Term();
	Guest_Term();
	HVisor_Term();
	LocalExec_Term();
	ErrInfo_Term();

	return 0x00;
}

/* ===========================================================================*/
int main( int argc, char *argv[] )	{
	
	int		i_err;
	int		i_hvisor;
	int		i_hnext;
	HVisor	*p_hvisor;
	DWord	dw_status;
	DWord	dw_option;

	VmTui_Init();

	SettingFile_SetSettingFilePath( NULL, NULL );
	i_err	= SettingFile_ReadSetting();
	if( 0x00 != i_err )	{
		goto	goto_main_post;
	}

	// Initial Auto-Connect HVisor ---
	i_hvisor	= HVisor_GetTopID();
	while( HVISOR_ID_NONE != i_hvisor )	{

		HvCtl_StartThread( i_hvisor );

		p_hvisor	= HVisor_Ref( i_hvisor );
		dw_option	= p_hvisor->dw_option;
		HVisor_Release( p_hvisor );

		if( HVISOR_OPTION_AUTOCONNECT & dw_option )
			{ HvCmd_Connect( i_hvisor, HVCMD_CONNECT_PHASE_CONNECTSTART, NULL ); }

		i_hvisor	= HVisor_GetNextID( i_hvisor );
	}

	usleep( 100 );

	// Initial Obtain Guest Info ---
	i_hvisor	= HVisor_GetTopID();
	while( HVISOR_ID_NONE != i_hvisor )	{

		p_hvisor	= HVisor_Ref( i_hvisor );
		dw_status	= p_hvisor->dw_status;
		HVisor_Release( p_hvisor );
		if( HVISOR_STATUS_CONNECTED & dw_status )
			{ ReqCtl_CreateRequest( REQUEST_CMD_VMLIST, i_hvisor, GUEST_ID_NONE, NULL ); }

		i_hvisor	= HVisor_GetNextID( i_hvisor );
	}

	TuiSys_Draw();

	TuiKey_Dispatch();

	i_hvisor	= HVisor_GetTopID();
	while( HVISOR_ID_NONE != i_hvisor )	{
		p_hvisor	= HVisor_Ref( i_hvisor );
		dw_status	= p_hvisor->dw_status;
		HVisor_Release( p_hvisor );
		if( HVISOR_STATUS_CONNECTED & dw_status )
			{ ReqCtl_CreateRequest( REQUEST_CMD_HV_DISCONNECT, i_hvisor, GUEST_ID_NONE, NULL ); }

		ReqCtl_CreateRequest( REQUEST_CMD_HV_EXIT, i_hvisor, GUEST_ID_NONE, NULL );

		i_hnext	= HVisor_GetNextID( i_hvisor );

		HVisor_Free( i_hvisor );

		i_hvisor	= i_hnext;
	}

goto_main_post:
	VmTui_Term();

	return 0x00;
}


/* EOF of @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/