#ifndef _QOS_TYPE_H_
#define _QOS_TYPE_H_

#define	 MAX_BUF_LEN				64
#define  MAX_RULE_NUM				16

#define  EBT_CHK_TYPE				1
#define  DEV_XMIT_CHK_TYPE			2


#define QOSTYPE_IOC_MAGIC 			'g'
#define QOSTYPE_MAJOR 				111               
#define QOSTYPE_IOC_SET_TYPE _IOR(QOSTYPE_IOC_MAGIC,10,unsigned long)
#define QOSTYPE_PBIT_MARK_OFFSET	8
#define QOSTYPE_DSCP_SW_MARK_OFFSET	6
#define QOSTYPE_QUEUE_INDEX_OFFSET	12
#define QOSTYPE_8021P_MARK			0x0F00 	/* 8~11 bits used for 802.1p */
#define QOSTYPE_DSCP_MARK			0x003F 	/* 0~5 bits used for DSCP */
#define QOSTYPE_DSCP_SW_MARK		0x0040 	/* 6~6 bits used for DSCP switch flag */
#define QOSTYPE_QUEUE_INDEX_MARK	0xF000 	/* 12~15 bits used for queue index */


/* type_name: wan_if, rtp_proto */
struct qos_match
{
	char type_name[MAX_BUF_LEN];
	char type_value[MAX_BUF_LEN];
	/* 
	0~5 bits used for DSCP
	6~6 bits used for DSCP switch flag
	8~11 bits used for 802.1p
	12~15 bits used for queue index
	*/
	int type_mask;
};

/* qm[0]: wan_if, qm[1]: rtp_proto */
struct qos_action
{
	struct qos_match qm[2];
	/* if match, set dscp here */
	int dscp_flag;
	unsigned int dscp;
};

struct qos_type
{
	int rule_no;
	struct qos_match qm[2];
};

int qostype_chk(int chkType, int rule_no, char *wan_if, int rtp_match);
int set_tos(int rule_no, unsigned int tos);
int get_tos(int rule_no, unsigned int *tos);
int unset_tos(int rule_no);
#endif

