/**
* Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved.
*
* @file al_network.h
*
* The interface to init, uninit and manipulate network.
*
* @brief Gives the functionalities for quering as well as manipulating
* 		the database on network related data.
*
* @note .
*/

#ifndef __AL_NETWORK_DBMERGE_H__
#define __AL_NETWORK_DBMERGE_H__

#include "al_basictypes.h"
#include "al_database.h"

#ifdef __cplusplus
	extern "C"{
#endif

/****************************************************
 * Enumeration definition
 ****************************************************//**
 * @addtogroup EnumDef Enumeration definition
 * @{
 ********************************************************/
/**
* @brief Enumeration of search field.<br>
*/
typedef enum
{
	AL_NET_SEARCHFIELD_NETID = 1 << 1,
	
} AL_Network_ESearchField_t;

/****************************************************
 * Structure definition
 ****************************************************//**
 * @}
 * @addtogroup StructDef Structure definition
 * @{
 ********************************************************/
/**
* @brief Structure for searching network.<br>
*/
typedef struct
{
	AL_DB_EDBType_t eDBType;
	AL_Network_ESearchField_t eSearchField;
	al_uint16 u16NetId;
} AL_Network_SearchKey_t;

/****************************************************
 * API definition - Internal Operation
 ****************************************************//**
 * @}
 * @addtogroup InterAPI Internal Interface
 * @{
 ********************************************************/
/**
* @brief Initialize network component.
*
* The implementation may perform appropriate network initialisation when this
* call is made, if required.
*
* @note 
*		1.This API must be called before any network-related function is called; <br>
* 		2.Must be called once successfully, and still return success when called again.
*
* @param eDBType [in]Select one or more database to initialize network component.
*
* @return 
* 	#AL_SUCCESS indicates success, 
* 	On failure, #AL_FAILURE is returned.
*/
AL_Return_t AI_Network_Init(
	AL_DB_EDBType_t eDBType);

/**
* @brief Terminate network commponent.
*
* The implementation may perform appropriate network termination when this
* call is made, if required.
*
* @note 
*		1.This API must be called after any network-related function is called; <br>
* 		2.Must be called once successfully, and still return success when called again.
*
* @param eDBType [in]Select one or more database to terminate network component.
*
* @return 
* 	#AL_SUCCESS indicates success, 
* 	On failure, #AL_FAILURE is returned.
*/
AL_Return_t AI_Network_Term(
	AL_DB_EDBType_t eDBType);


/****************************************************
 * API definition - Network Operation
 ****************************************************//**
 * @}
 * @addtogroup COMAPI  Component APIs
 * @{
 ********************************************************/
/**
* @brief Match network by specified search field.
*
* @note Refers to the prototype #AL_DB_RecordMatchFunc.
*
* @param param		[in]Search key, type: #AL_Network_SearchKey_t.
* @param pRec		[in]Network Info.
*
* @return 
* 	#AL_SUCCESS indicates success, 
* 	On failure, #AL_FAILURE is returned.
*/
al_bool AL_Network_MatchRecBySearchKey(al_void *param, al_void const*pRec);

/****************************************************//**
  * @}
  ********************************************************/
#ifdef __cplusplus
	}
#endif /* __cplusplus */

#endif /* __AL_NETWORK_H__ */
