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

#ifndef SVC_COS_TYPES_H_
#define SVC_COS_TYPES_H_

#include <api_oam_sdk/common/types/inc/linked_list.h>
#include <api_oam_sdk/service_bwp/src/svc_bwp_types.h>
#include <api_oam_sdk/service_cos/inc/svc_cos.h>
#include <api_oam_sdk/service_evc/src/svc_evc_types.h>
#include "egl_types.h"
#include "egl_log.h"
#include "../src/svc_bwp_types.h"

typedef int8_t cosNum_t;

typedef struct
{
	cosIndex_t	cosIndex;								// The COS index for this COS
	cosNum_t	cosNum;									// Hardware index associated with this MD
	bool		inUse;									// Used to indicate that an entry is in use
} cosCtxt_t;

struct svcCosEntry_s
{
	TAILQ_ENTRY(struct svcCosEntry_s,) 	ll;
	svcCosCfg_t							cfg;
	svcCosEglCfg_t 						cfgEgl;
	cosCtxt_t							cosCtxt;
};

typedef struct svcCosEntry_s svcCosEntry_t;

#define MAX_NUM_COS		(MAX_NUM_EVCS)							// The Maximum number of MDs supported by the system
#define INVALID_COS_NUM	(-1)

void setCosLogLevel(log_level_t logLevel);

/*
 * @brief Should be called at system startup to initialise the COS Module.
 */
void cosInit(void);

bool svcCosIsCosIndexValid(cosIndex_t cosIndex);

int	svcCosAddToEvc(cosIndex_t cosIndex, bwpNum_t bwpNum, evcNum_t evcNum, iFace_t iFace);

void _getCosListFromProfile(cosIndex_t cosIndex, bool dscp_list, uint16_t *cosIdList, uint16_t *idListLen);

#endif /* SVC_COS_TYPES_H_ */
