/*******************************************************************************
 * (c) Copyright 2015 Microsemi Corporation.  All rights reserved.
 *
 *
 *
 * SVN $Revision: $
 * SVN $Date: $
 */

#ifndef CONTINUITY_CHECK_H_
#define CONTINUITY_CHECK_H_

#include <api_oam_sdk/common/types/inc/mr_api_types.h>
#include <api_oam_sdk/mep/inc/mep.h>

/*
 * @brief	Called at device startup to initialise MA module
 *
 * Safe to call repeatedly.
 */
void ccInit(void);

/*
 * @brief Add or Update a TLV to be sent in CCM packets
 */
void ccmAddUpdateTlv(lMepNum_t lMepNum,tlvType_t type,uint8_t length,void *value);

/*
 * @brief Remove (stop sending) a TLV of the specified type in CCM packets
 */
void ccmRemoveTlv(lMepNum_t lMepNum,tlvType_t type);

/*
 * @ brief Add a CCM (transmit) service to a local MEP
 *
 * IMPORTANT: mdIndex, maIndex and mepId must be validate before calling this function
 */
void ccmAdd(
	lMepNum_t			lMepNum,
	mepId_t				mepId,
	uint16_t 			vLan,
	prio_t				prio,
	tagType_t			tagType,
	mdLevel_t			mdLevel,
	ccmInterval_t		ccmInterval,
	iFace_t				iFace,
	ccmTlv_t			*ccmTlv);

/*
 * @brief Remove a CCM (transmit) service from a Local MEP
 */
void ccmRemove(lMepNum_t lMepNum);

/*
 * @brief Called when the primary vlan for a local MEP is updated
 *
 * This will update the Vlan in the CCM packet tags
 */
void ccmUpdatePrimaryVlan(
	lMepNum_t		lMepNum,
	uint16_t 		vLan,
	prio_t			prio,
	tagType_t		tagType,
	iFace_t			iFace,
	bool			enable);

/*
 * @brief Enable CCM transmit
 */
void cciEnable(lMepNum_t lMepNum);

/*
 * @brief Disable CCM transmit
 */
void cciDisable(lMepNum_t lMepNum);

/*
 * @brief Enable all MEP services (called when administrative state = true)
 */
void ccEnableLMep(lMepNum_t lMepNum, ccmInterval_t ccmInterval);

/*
 * @brief Disable all MEP services (called when administrative state = false)
 */
void ccDisableLMep(lMepNum_t lMepNum);

#endif /* CONTINUITY_CHECK_H_ */
