⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 voip_adapter_compare.c

📁 telcobridges voip develop
💻 C
📖 第 1 页 / 共 5 页
字号:
			else if( *out_pfMustSetParams )
			{
				VoipCliAdapterStatePrint( in_pAdapterContext, TRACE_LEVEL_0, "  -> Need to set config\n" );
			}
		}
	}

	RETURN_VOID;
}

 /*-------------------------------------------------------------------------------------------------------------------------------
 |
 |  VoipAdapterMblPortConfigureCompare	:	Compares the MBL port config on the adapter with the target config
 |											and determines if must be reallocated, reconfigured, or
 |											if configuration is already correct.
 |
 |	in_pAdapterContext					:	Adapter configuration we are configuring
 |	in_pCurrentMblPortConfig			:	Current MBL port configuration on the adapter
 |	in_pTargetMblPortConfig				:	Target MBL port configuration
 |	out_pfMustReallocate				:	Tell if must clear this trunk on the adapter
 |	out_pfMustSetParams					:	Tell if must "config set" this trunk on the adapter
 |
 |  Note								:	~
 |
 |  Return								:	TBX_RESULT_OK if the function succeeded
 |											Other error code if the function could not complete properly.
 |
 *------------------------------------------------------------------------------------------------------------------------------*/
TBX_VOID	VoipAdapterMblPortConfigureCompare(
	IN		PVOIP_ADAPTER_CONTEXT	in_pAdapterContext,
	IN		PVOIP_MBL_PORT_CONFIG	in_pCurrentMblPortConfig,
	IN		PVOIP_MBL_PORT_CONFIG	in_pTargetMblPortConfig,
	OUT		PTBX_BOOL				out_pfMustReallocate,
	OUT		PTBX_BOOL				out_pfMustSetParams)
{
	/*---------------------------------------------------------------------------------------------------------------------------
	 |  Code section
	 *--------------------------------------------------------------------------------------------------------------------------*/
	CODE
	{
		*out_pfMustReallocate	= TBX_FALSE;
		*out_pfMustSetParams	= TBX_FALSE;

		if( !in_pCurrentMblPortConfig->fAllocated )
		{
			/* Not allocated. Ignore. */
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		VoipCliAdapterStatePrint
		(
			in_pAdapterContext,
			TRACE_LEVEL_0,
			"Comparing MBL port 0x%08X config\n",
			(int)in_pCurrentMblPortConfig->hPort
		);

		if
		(
			in_pCurrentMblPortConfig->fAllocated !=
			in_pTargetMblPortConfig->fAllocated
		)
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		if( in_pCurrentMblPortConfig->fAutoLinkSwitchover != in_pTargetMblPortConfig->fAutoLinkSwitchover )
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		if( in_pCurrentMblPortConfig->fPropagateLinkSwitchover != in_pTargetMblPortConfig->fPropagateLinkSwitchover )
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		/* End of the code (skip to cleanup) */
		TBX_EXIT_SUCCESS (TBX_RESULT_OK);
	}

	/*---------------------------------------------------------------------------------------------------------------------------
	 |  Error handling section
	 *--------------------------------------------------------------------------------------------------------------------------*/
	ERROR_HANDLING
	{
	}

	/*---------------------------------------------------------------------------------------------------------------------------
	 |  Cleanup section
	 *--------------------------------------------------------------------------------------------------------------------------*/
	CLEANUP
	{
		if( in_pCurrentMblPortConfig->fAllocated )
		{
			if( *out_pfMustReallocate )
			{
				VoipCliAdapterStatePrint( in_pAdapterContext, TRACE_LEVEL_0, "  -> Need to clear\n" );
			}
			else if( *out_pfMustSetParams )
			{
				VoipCliAdapterStatePrint( in_pAdapterContext, TRACE_LEVEL_0, "  -> Need to set config\n" );
			}
		}
	}

	RETURN_VOID;
}

 /*-------------------------------------------------------------------------------------------------------------------------------
 |
 |  VoipAdapterStreamResConfigureCompare	:	Compares the stream resource config on the adapter with the target config
 |												and determines if must be reallocated, reconfigured, or
 |												if configuration is already correct.
 |
 |	in_pAdapterContext					:	Adapter configuration we are configuring
 |	in_pCurrentStreamRes				:	Current stream resource configuration on the adapter
 |	in_pTargetBertRes					:	Target stream resources configuration
 |	out_pfMustReallocate				:	Tell if must clear this BERT resource on the adapter
 |	out_pfMustSetParams					:	Tell if must "config set" this BERT resource on the adapter
 |
 |  Note								:	~
 |
 |  Return								:	TBX_RESULT_OK if the function succeeded
 |											Other error code if the function could not complete properly.
 |
 *------------------------------------------------------------------------------------------------------------------------------*/
TBX_VOID	VoipAdapterStreamResConfigureCompare(
	IN		PVOIP_ADAPTER_CONTEXT	in_pAdapterContext,
	IN		PVOIP_STREAM_RES		in_pCurrentStreamRes,
	IN		PVOIP_STREAM_RES		in_pTargetStreamRes,
	OUT		PTBX_BOOL				out_pfMustReallocate,
	OUT		PTBX_BOOL				out_pfMustSetParams)
{
	/*---------------------------------------------------------------------------------------------------------------------------
	 |  Code section
	 *--------------------------------------------------------------------------------------------------------------------------*/
	CODE
	{
		*out_pfMustReallocate	= TBX_FALSE;
		*out_pfMustSetParams	= TBX_FALSE;

		if( !in_pCurrentStreamRes->Common.fAllocated )
		{
			/* Not allocated. Ignore. */
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		VoipCliAdapterStatePrint
		(
			in_pAdapterContext,
			TRACE_LEVEL_0,
			"Comparing stream resource 0x%08X config\n",
			in_pCurrentStreamRes->Common.hRes
		);

		if
		(
			in_pCurrentStreamRes->Common.fAllocated !=
			in_pTargetStreamRes->Common.fAllocated
		)
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		if( in_pCurrentStreamRes->Params.ResType != in_pTargetStreamRes->Params.ResType )
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		if( in_pCurrentStreamRes->Params.PacketType != in_pTargetStreamRes->Params.PacketType )
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		if( in_pCurrentStreamRes->Params.PacketDurationMs != in_pTargetStreamRes->Params.PacketDurationMs )
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		if( in_pCurrentStreamRes->Params.Interface != in_pTargetStreamRes->Params.Interface )
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		if( in_pCurrentStreamRes->Params.ResType != TB640_RESOURCE_TYPE_HD_DST )
		{
			if( in_pCurrentStreamRes->Params.un16FromNetworkIPPort != in_pTargetStreamRes->Params.un16FromNetworkIPPort )
			{
				*out_pfMustReallocate = TBX_TRUE;
				TBX_EXIT_SUCCESS (TBX_RESULT_OK);
			}
		}

		if( in_pCurrentStreamRes->Params.ResType != TB640_RESOURCE_TYPE_HD_SRC )
		{
			if( in_pCurrentStreamRes->Params.un16ToNetworkIPPort != in_pTargetStreamRes->Params.un16ToNetworkIPPort )
			{
				*out_pfMustReallocate = TBX_TRUE;
				TBX_EXIT_SUCCESS (TBX_RESULT_OK);
			}
		}

		if( in_pCurrentStreamRes->Params.fUseRtpOverRawIp != in_pTargetStreamRes->Params.fUseRtpOverRawIp )
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		if( in_pCurrentStreamRes->Params.fUseRtcp != in_pTargetStreamRes->Params.fUseRtcp )
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		if( in_pCurrentStreamRes->Params.ResType != TB640_RESOURCE_TYPE_HD_SRC )
		{
			if( strcmp( in_pCurrentStreamRes->Params.szIPAddr0, in_pTargetStreamRes->Params.szIPAddr0 ) != 0 )
			{
				*out_pfMustReallocate = TBX_TRUE;
				TBX_EXIT_SUCCESS (TBX_RESULT_OK);
			}

			if( strcmp( in_pTargetStreamRes->Params.szIPAddr1, "127.0.0.1" ) != 0 )
			{
				if( strcmp( in_pCurrentStreamRes->Params.szIPAddr1, in_pTargetStreamRes->Params.szIPAddr1 ) != 0 )
				{
					*out_pfMustReallocate = TBX_TRUE;
					TBX_EXIT_SUCCESS (TBX_RESULT_OK);
				}
			}
			else
			{
				if( in_pCurrentStreamRes->Params.szIPAddr1[0] != '\0' )
				{
					*out_pfMustReallocate = TBX_TRUE;
					TBX_EXIT_SUCCESS (TBX_RESULT_OK);
				}
			}
		}

		if( in_pCurrentStreamRes->Params.RedundancyMode != in_pTargetStreamRes->Params.RedundancyMode )
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		if( in_pCurrentStreamRes->Params.un8TosByte != in_pTargetStreamRes->Params.un8TosByte )
		{
			*out_pfMustReallocate = TBX_TRUE;
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		/* End of the code (skip to cleanup) */
		TBX_EXIT_SUCCESS (TBX_RESULT_OK);
	}

	/*---------------------------------------------------------------------------------------------------------------------------
	 |  Error handling section
	 *--------------------------------------------------------------------------------------------------------------------------*/
	ERROR_HANDLING
	{
	}

	/*---------------------------------------------------------------------------------------------------------------------------
	 |  Cleanup section
	 *--------------------------------------------------------------------------------------------------------------------------*/
	CLEANUP
	{
		if( in_pCurrentStreamRes->Common.fAllocated )
		{
			if( *out_pfMustReallocate )
			{
				VoipCliAdapterStatePrint( in_pAdapterContext, TRACE_LEVEL_0, "  -> Need to clear\n" );
			}
			else if( *out_pfMustSetParams )
			{
				VoipCliAdapterStatePrint( in_pAdapterContext, TRACE_LEVEL_0, "  -> Need to set config\n" );
			}
		}
	}

	RETURN_VOID;
}

 /*-------------------------------------------------------------------------------------------------------------------------------
 |
 |  VoipAdapterVpGroupConfigureCompare	:	Compares the voice processing group config on the adapter with the target config
 |											and determines if must be reallocated, reconfigured, or
 |											if configuration is already correct.
 |
 |	in_pAdapterContext					:	Adapter configuration we are configuring
 |	in_pCurrentVpGroup					:	Current voice processing group configuration on the adapter
 |	in_pTargetVpGroup					:	Target voice processing group configuration
 |	out_pfMustReallocate				:	Tell if must clear this BERT resource on the adapter
 |	out_pfMustSetParams					:	Tell if must "config set" this BERT resource on the adapter
 |
 |  Note								:	~
 |
 |  Return								:	TBX_RESULT_OK if the function succeeded
 |											Other error code if the function could not complete properly.
 |
 *------------------------------------------------------------------------------------------------------------------------------*/
TBX_VOID	VoipAdapterVpGroupConfigureCompare(
	IN		PVOIP_ADAPTER_CONTEXT	in_pAdapterContext,
	IN		PVOIP_VP_GROUP			in_pCurrentVpGroup,
	IN		PVOIP_VP_GROUP			in_pTargetVpGroup,
	OUT		PTBX_BOOL				out_pfMustReallocate,
	OUT		PTBX_BOOL				out_pfMustSetParams)
{
	TBX_UINT32	un32Index;
	TBX_UINT32	un32Index2;

	/*---------------------------------------------------------------------------------------------------------------------------
	 |  Code section
	 *--------------------------------------------------------------------------------------------------------------------------*/
	CODE
	{
		*out_pfMustReallocate	= TBX_FALSE;
		*out_pfMustSetParams	= TBX_FALSE;

		if( !in_pCurrentVpGroup->Common.fAllocated )
		{
			/* Not allocated. Ignore. */
			TBX_EXIT_SUCCESS (TBX_RESULT_OK);
		}

		VoipCliAdapterStatePrint
		(
			in_pAdapterContext,
			TRACE_LEVEL_0,
			"Comparing voice processing group 0x%08X config\n",
			in_pCurrentVpGroup->Common.hRes
		);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -