summaryrefslogtreecommitdiff
path: root/shaping/test/stub.h
diff options
context:
space:
mode:
author刘畅 <[email protected]>2024-10-18 01:54:04 +0000
committer刘畅 <[email protected]>2024-10-18 01:54:04 +0000
commitef65ec1447d900f105c93b86ac55339d83d987f6 (patch)
tree13e5e2e2134a35a5b2b95d54b2bdbe40f991d11a /shaping/test/stub.h
parentb0de64f0deb1672f0b183f72b99d615f00a73b3b (diff)
parent6e63a4b7edce57ecd5f5186c209320efd3efe074 (diff)
Merge branch 'adapt_rule_with_uuid' into 'rel'v3.2.1v3.2.0
Adapt rule with uuid See merge request tango/shaping-engine!104
Diffstat (limited to 'shaping/test/stub.h')
-rw-r--r--shaping/test/stub.h42
1 files changed, 29 insertions, 13 deletions
diff --git a/shaping/test/stub.h b/shaping/test/stub.h
index 7581a98..e5c73b5 100644
--- a/shaping/test/stub.h
+++ b/shaping/test/stub.h
@@ -1,19 +1,36 @@
#include <sys/queue.h>
#include "shaper.h"
+#include "shaper_maat.h"
#define OUT_ARG
#define MAX_REF_PROFILE 8
#define STUB_APP_STATE_HOLD_PACKET 0x04
-#define STUB_MAAT_SHAPING_RULE_TABLE_ID 0
-#define STUB_MAAT_SHAPING_PROFILE_TABLE_ID 1
-
#define STUB_TIME_INC_FOR_PACKET 1000000
#define STUB_TIME_INC_FOR_HMGET 10000000
#define STUB_TEST_VSYS_ID 2333
+#define AVALIABLE_TOKEN_UNLIMITED -1
+
+struct stub_matched_rule {
+ UT_hash_handle hh;
+ struct shaping_rule rule;
+};
+
+struct stub_avaliable_token {
+ int in_limit_bandwidth;
+ int out_limit_bandwidth;
+ int bidirection_limit_bandwidth;
+};
+
+struct stub_shaping_profile {
+ struct shaping_profile profile;
+ struct stub_avaliable_token avaliable_token;
+ UT_hash_handle hh;
+};
+
struct stub_packet {
unsigned char direction;
unsigned char pure_control;
@@ -28,16 +45,16 @@ struct stub_packet_node {
TAILQ_HEAD(stub_pkt_queue, stub_packet_node);
-void stub_set_token_bucket_avl_per_sec(int profile_id, unsigned int tokens, unsigned char direction, enum shaping_profile_limit_direction limit_direction);
-void stub_refresh_token_bucket(int profile_id);
-void stub_set_profile_type(int profile_id, enum shaping_profile_type type);
-void stub_set_profile_limit_direction(int profile_id, enum shaping_profile_limit_direction limit_direction);
-void stub_set_async_token_get_times(int profile_id, int times);
+void stub_set_token_bucket_avl_per_sec(const char *profile_uuid_str, unsigned int tokens, unsigned char direction, enum shaping_profile_limit_direction limit_direction);
+void stub_refresh_token_bucket(const char *profile_uuid_str);
+void stub_set_profile_type(const char *profile_uuid_str, enum shaping_profile_type type);
+void stub_set_profile_limit_direction(const char *profile_uuid_str, enum shaping_profile_limit_direction limit_direction);
-void stub_set_matched_shaping_rules(int rule_num, long long *rule_id, const int *priority, const int *profile_num, int profile_id[][MAX_REF_PROFILE]);
-void stub_set_shaping_rule_dscp_value(int rule_id, int dscp_value);
-void stub_set_shaping_rule_fair_factor(int rule_id, int fair_factor);
-void stub_clear_matched_shaping_rules();
+void stub_set_matched_shaping_rules(int rule_num, const char *rule_uuid_str[], const int *priority, const int *profile_num, const char *profile_uuid_str[][MAX_REF_PROFILE]);
+void stub_set_shaping_rule_dscp_value(const char *rule_uuid_str, int dscp_value);
+void stub_set_shaping_rule_fair_factor(const char *rule_uuid_str, int fair_factor);
+void stub_clear_resource();
+void stub_swarmkv_clear_resource();
void stub_send_packet(struct stub_packet *packet);
struct stub_pkt_queue* stub_get_tx_queue();
@@ -49,7 +66,6 @@ void stub_curr_time_s_inc(int time_s);
unsigned long long stub_curr_time_ns_get();
void stub_init();
-void dummy_swarmkv_init();
/*******************temporary for test******************************/
void stub_shaper_stat_send(int thread_seq);