src/Cedar/NM.c
// Show the status of the router

Show the status of the router
Show the status of the router
bool NmStatus(HWND hWnd, SM_SERVER *s, void *param)
{
	LVB *b;
	RPC_NAT_STATUS t;
	wchar_t tmp[MAX_SIZE];
	SM_HUB *h = (SM_HUB *)param;
	if (hWnd == NULL || s == NULL)
	{
		return false;
	}
	Zero(&t, sizeof(t));
	StrCpy(t.HubName, sizeof(t.HubName), h->HubName);
	if (CALL(hWnd, ScGetSecureNATStatus(s->Rpc, &t)) == false)
	{
		return false;
	}
	b = LvInsertStart();
	StrToUni(tmp, sizeof(tmp), h->HubName);
	LvInsertAdd(b, ICO_HUB, NULL, 2, _UU("SM_HUB_COLUMN_1"), tmp);
	UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumTcpSessions);
	LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_TCP"), tmp);
	UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumUdpSessions);
	LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_UDP"), tmp);
	UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumIcmpSessions);
	LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_ICMP"), tmp);
	UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumDnsSessions);
	LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_DNS"), tmp);
	UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_CLIENT"), t.NumDhcpClients);
	LvInsertAdd(b, ICO_PROTOCOL_DHCP, NULL, 2, _UU("NM_STATUS_DHCP"), tmp);
	LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_SNAT_IS_KERNEL"), t.IsKernelMode ? _UU("SEC_YES") : _UU("SEC_NO"));
	LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_SNAT_IS_RAW"), t.IsRawIpMode ? _UU("SEC_YES") : _UU("SEC_NO"));
	LvInsertEnd(b, hWnd, L_STATUS);
	FreeRpcNatStatus(&t);
	return true;
}
bool NmStatus ( HWND hWnd , SM_SERVER * s , void * param ) { LVB * b ; RPC_NAT_STATUS t ; wchar_t tmp [ MAX_SIZE ] ; SM_HUB * h = ( SM_HUB * ) param ; if ( hWnd == NULL || s == NULL ) { return false ; } Zero ( & t , sizeof ( t ) ) ; StrCpy ( t . HubName , sizeof ( t . HubName ) , h -> HubName ) ; if ( CALL ( hWnd , ScGetSecureNATStatus ( s -> Rpc , & t ) ) == false ) { return false ; } b = LvInsertStart ( ) ; StrToUni ( tmp , sizeof ( tmp ) , h -> HubName ) ; LvInsertAdd ( b , ICO_HUB , NULL , 2 , _UU ( " " ) , tmp ) ; UniFormat ( tmp , sizeof ( tmp ) , _UU ( " " ) , t . NumTcpSessions ) ; LvInsertAdd ( b , ICO_PROTOCOL , NULL , 2 , _UU ( " " ) , tmp ) ; UniFormat ( tmp , sizeof ( tmp ) , _UU ( " " ) , t . NumUdpSessions ) ; LvInsertAdd ( b , ICO_PROTOCOL , NULL , 2 , _UU ( " " ) , tmp ) ; UniFormat ( tmp , sizeof ( tmp ) , _UU ( " " ) , t . NumIcmpSessions ) ; LvInsertAdd ( b , ICO_PROTOCOL , NULL , 2 , _UU ( " " ) , tmp ) ; UniFormat ( tmp , sizeof ( tmp ) , _UU ( " " ) , t . NumDnsSessions ) ; LvInsertAdd ( b , ICO_PROTOCOL , NULL , 2 , _UU ( " " ) , tmp ) ; UniFormat ( tmp , sizeof ( tmp ) , _UU ( " " ) , t . NumDhcpClients ) ; LvInsertAdd ( b , ICO_PROTOCOL_DHCP , NULL , 2 , _UU ( " " ) , tmp ) ; LvInsertAdd ( b , ICO_MACHINE , NULL , 2 , _UU ( " " ) , t . IsKernelMode ? _UU ( " " ) : _UU ( " " ) ) ; LvInsertAdd ( b , ICO_MACHINE , NULL , 2 , _UU ( " " ) , t . IsRawIpMode ? _UU ( " " ) : _UU ( " " ) ) ; LvInsertEnd ( b , hWnd , L_STATUS ) ; FreeRpcNatStatus ( & t ) ; return true ; }
Show the status of the router
Show the status of the router
// Validate arguments
