#ifndef _ALTQ_ALTQ_CBQ_H_
#define _ALTQ_ALTQ_CBQ_H_
#include <altq/altq.h>
#include <altq/altq_rmclass.h>
#include <altq/altq_red.h>
#include <altq/altq_rio.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NULL_CLASS_HANDLE 0
#define CBQCLF_RED 0x0001
#define CBQCLF_ECN 0x0002
#define CBQCLF_RIO 0x0004
#define CBQCLF_FLOWVALVE 0x0008
#define CBQCLF_CLEARDSCP 0x0010
#define CBQCLF_BORROW 0x0020
#define CBQCLF_WRR 0x0100
#define CBQCLF_EFFICIENT 0x0200
#define CBQCLF_ROOTCLASS 0x1000
#define CBQCLF_DEFCLASS 0x2000
#ifdef ALTQ3_COMPAT
#define CBQCLF_CTLCLASS 0x4000
#endif
#define CBQCLF_CLASSMASK 0xf000
#define CBQ_MAXQSIZE 200
#define CBQ_MAXPRI RM_MAXPRIO
typedef struct _cbq_class_stats_ {
u_int32_t handle;
u_int depth;
struct pktcntr xmit_cnt;
struct pktcntr drop_cnt;
u_int over;
u_int borrows;
u_int overactions;
u_int delays;
int priority;
int64_t maxidle;
int64_t minidle;
int64_t offtime;
int qmax;
uint64_t ps_per_byte;
int wrr_allot;
int qcnt;
int64_t avgidle;
int qtype;
struct redstats red[3];
} class_stats_t;
#ifdef ALTQ3_COMPAT
struct cbq_interface {
char cbq_ifacename[IFNAMSIZ];
};
typedef struct cbq_class_spec {
u_int priority;
uint64_t pico_sec_per_byte;
u_int maxq;
u_int maxidle;
int minidle;
u_int offtime;
u_int32_t parent_class_handle;
u_int32_t borrow_class_handle;
u_int pktsize;
int flags;
} cbq_class_spec_t;
struct cbq_add_class {
struct cbq_interface cbq_iface;
cbq_class_spec_t cbq_class;
u_int32_t cbq_class_handle;
};
struct cbq_delete_class {
struct cbq_interface cbq_iface;
u_int32_t cbq_class_handle;
};
struct cbq_modify_class {
struct cbq_interface cbq_iface;
cbq_class_spec_t cbq_class;
u_int32_t cbq_class_handle;
};
struct cbq_add_filter {
struct cbq_interface cbq_iface;
u_int32_t cbq_class_handle;
struct flow_filter cbq_filter;
u_long cbq_filter_handle;
};
struct cbq_delete_filter {
struct cbq_interface cbq_iface;
u_long cbq_filter_handle;
};
struct cbq_getstats {
struct cbq_interface iface;
int nclasses;
class_stats_t *stats;
};
#define CBQ_IF_ATTACH _IOW('Q', 1, struct cbq_interface)
#define CBQ_IF_DETACH _IOW('Q', 2, struct cbq_interface)
#define CBQ_ENABLE _IOW('Q', 3, struct cbq_interface)
#define CBQ_DISABLE _IOW('Q', 4, struct cbq_interface)
#define CBQ_CLEAR_HIERARCHY _IOW('Q', 5, struct cbq_interface)
#define CBQ_ADD_CLASS _IOWR('Q', 7, struct cbq_add_class)
#define CBQ_DEL_CLASS _IOW('Q', 8, struct cbq_delete_class)
#define CBQ_MODIFY_CLASS _IOWR('Q', 9, struct cbq_modify_class)
#define CBQ_ADD_FILTER _IOWR('Q', 10, struct cbq_add_filter)
#define CBQ_DEL_FILTER _IOW('Q', 11, struct cbq_delete_filter)
#define CBQ_GETSTATS _IOWR('Q', 12, struct cbq_getstats)
#endif
#ifdef _KERNEL
#define CBQ_WATCHDOG (hz / 20)
#define CBQ_TIMEOUT 10
#define CBQ_LS_TIMEOUT (20 * hz / 1000)
#define CBQ_MAX_CLASSES 256
#ifdef ALTQ3_COMPAT
#define CBQ_MAX_FILTERS 256
#define DISABLE 0x00
#define ENABLE 0x01
#endif
typedef struct cbqstate {
#ifdef ALTQ3_COMPAT
struct cbqstate *cbq_next;
#endif
int cbq_qlen;
struct rm_class *cbq_class_tbl[CBQ_MAX_CLASSES];
struct rm_ifdat ifnp;
struct callout cbq_callout;
#ifdef ALTQ3_CLFIER_COMPAT
struct acc_classifier cbq_classifier;
#endif
} cbq_state_t;
#endif
#ifdef __cplusplus
}
#endif
#endif