00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _if_core_bsched_h_
00027 #define _if_core_bsched_h_
00028
00029 #include "if/core/wrap.h"
00030 #include "lib/inputevt.h"
00031
00032 #define BS_BW_MAX (2*1024*1024)
00033
00034 typedef struct bsched bsched_t;
00035
00036 typedef enum {
00037 BSCHED_BWS_IN,
00038 BSCHED_BWS_OUT,
00039 BSCHED_BWS_GIN,
00040 BSCHED_BWS_GOUT,
00041 BSCHED_BWS_GLIN,
00042 BSCHED_BWS_GLOUT,
00043 BSCHED_BWS_GIN_UDP,
00044 BSCHED_BWS_GOUT_UDP,
00045
00046 NUM_BSCHED_BWS,
00047 BSCHED_BWS_INVALID = NUM_BSCHED_BWS
00048 } bsched_bws_t;
00049
00054 enum bio_source_magic { BIO_SOURCE_MAGIC = 0x80b3bf07U };
00055
00056 typedef struct bio_source {
00057 enum bio_source_magic magic;
00058 bsched_bws_t bws;
00059 wrap_io_t *wio;
00060 gint io_tag;
00061 guint io_flags;
00062 inputevt_handler_t io_callback;
00063 gpointer io_arg;
00064 guint32 flags;
00065 guint bw_actual;
00066 guint bw_last_bps;
00067 guint bw_fast_ema;
00068 guint bw_slow_ema;
00069 } bio_source_t;
00070
00071
00072
00073
00074
00075 #define BIO_F_READ 0x00000001
00076 #define BIO_F_WRITE 0x00000002
00077 #define BIO_F_ACTIVE 0x00000004
00078 #define BIO_F_USED 0x00000008
00080 #define BIO_F_RW (BIO_F_READ|BIO_F_WRITE)
00081
00082 #define BIO_EMA_SHIFT 7
00083
00084 #define bio_bps(b) ((b)->bw_last_bps)
00085 #define bio_avg_bps(b) ((b)->bw_slow_ema >> BIO_EMA_SHIFT)
00086
00087 #endif
00088
00089