예제 #1
0
파일: Nat.c 프로젝트: benapetr/SoftEtherVPN
// Release the NAT
void NiFreeNat(NAT *n)
{
	// Validate arguments
	if (n == NULL)
	{
		return;
	}

	// Complete management command
	//NiFreeAdminAccept(n);

	// Stop if the virtual host is running
	Lock(n->lock);
	{
		if (n->Virtual != NULL)
		{
			StopVirtualHost(n->Virtual);
			ReleaseVirtual(n->Virtual);
			n->Virtual = NULL;
		}
	}
	Unlock(n->lock);

	// Release the settings
	NiFreeConfig(n);

	// Delete the object
	ReleaseCedar(n->Cedar);
	ReleaseEvent(n->HaltEvent);
	DeleteLock(n->lock);

	Free(n);
}
예제 #2
0
파일: Nat.c 프로젝트: falcon8823/utvpn
// NAT の解放
void NiFreeNat(NAT *n)
{
	// 引数チェック
	if (n == NULL)
	{
		return;
	}

	// 管理コマンド終了
	//NiFreeAdminAccept(n);

	// 仮想ホストが動作中の場合は停止
	Lock(n->lock);
	{
		if (n->Virtual != NULL)
		{
			StopVirtualHost(n->Virtual);
			ReleaseVirtual(n->Virtual);
			n->Virtual = NULL;
		}
	}
	Unlock(n->lock);

	// 設定の解放
	NiFreeConfig(n);

	// オブジェクトの削除
	ReleaseCedar(n->Cedar);
	ReleaseEvent(n->HaltEvent);
	DeleteLock(n->lock);

	Free(n);
}