4 // Need a time interval.
6 #define TBF_MAX_QUEUE 2 // Maximum of 2 queued packet per
7 #define TBF_MAX_SIZE 3000 // Maxiumum queued packet size is 2048.
9 #define TBF_MAX_CREDIT 6000 // Maximum 6000 bytes of credit.
10 #define TBF_RATE 360 // 360 bytes per 1/10th of a second.
16 int oldest
; // Position of packet in the ring buffer.
17 sessionidt sid
; // associated session ID.
18 int max_credit
; // Maximum amount of credit available (burst size).
19 int rate
; // How many bytes of credit per second we get? (sustained rate)
20 void (*send
)(sessionidt s
, u8
*, int); // Routine to actually send out the data.
21 int prev
; // Timer chain position.
22 int next
; // Timer chain position.
24 u32 b_queued
; // Total bytes sent through this TBF
25 u32 b_sent
; // Total bytes sucessfully made it to the network.
26 u32 p_queued
; // ditto packets.
27 u32 p_sent
; // ditto packets.
28 u32 b_dropped
; // Total bytes dropped.
29 u32 p_dropped
; // Total packets dropped.
30 u32 p_delayed
; // Total packets not sent immediately.
32 int sizes
[TBF_MAX_QUEUE
];
33 char packets
[TBF_MAX_QUEUE
][TBF_MAX_SIZE
];
37 int tbf_run_timer(void);
38 int tbf_queue_packet(int tbf_id
, char * data
, int size
);
39 int new_tbf(int sid
, int max_credit
, int rate
, void (*f
)(sessionidt
, u8
*, int));
40 int free_tbf(int tid
);
43 int cmd_show_tbf(struct cli_def
*cli
, char *command
, char **argv
, int argc
);
45 #endif /* __TBF_H__ */