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

#ifndef LINK_TRACE_TYPES_H_
#define LINK_TRACE_TYPES_H_

#include <api_oam_sdk/link_trace/inc/link_trace.h>
#include <api_oam_sdk/link_trace/src/cfmPktProc.h>
#include "egl_log.h"
#include "link_trace.h"

#define	MR_IEEE_CFM_ETYPE		0x8902
#define LTM_TIMEOUT_PERIOD		5			// The time to wait for replies to an LTM before regarding then as lost

#define LT_TOUT_TASK_STACKSIZE		1024

typedef struct
{
	uint32_t		ltmNextSeqNumber;	// Next transaction id/sequence number to be sent in a LTM. This sequence number can be zero because it wraps around
	uint32_t		unexpectedLtrIn;	// The total number of unexpected LTRs received
	uint32_t		txLtmSeqNumber;		// The LTM Transaction Id (ltmNextSeqNumber) of the LTM sent. The value returned is undefined if txLtmResult is false.
	mepLtMefInfo_t	mepLtMefInfo;
	//bool			txLtmStatus;		// True if ready to send another LTM
	bool			txLtmResult;		// Indicates the result of the operation: -true:The Linktrace Message will be (or has been) sent. -false:The Linktrace Message will not be sent
	//uint8_t		txLtmEgressId[8];	// Identifies the MEP Linktrace Initiator that is originating, or the Linktrace Responder that is forwarding, this LTM
} _mepLtInfo_t;

typedef struct ltmParentMepAndSeqNum_s
{
	uint32_t			transitId;
	mdIndex_t 			mdIndex;
	maIndex_t 			maIndex;
	mepId_t				lMepId;
} ltmParentMepAndSeqNum_t;

typedef struct ltrReplyListEntry_s ltrReplyListEntry_t;
struct ltrReplyListEntry_s
{
	ltrReplyListEntry_t 	*ltrReplyNext;
	//uint32_t 	*ltrReplyNext;
	ltrReplyEntry_t			ltrReplyEntry;
} ;

void setLTLogLevel(log_level_t logLevel);
int processLTR(captPktInfo_t *captPktInfo, uint8_t *pktPtr);
int processLTM(captPktInfo_t *captPktInfo, uint8_t *pktPtr);
void linkTraceInit(void);
void linkTraceShutdown(void);

#endif /* LINK_TRACE_TYPES_H_ */
