MCPcopy Create free account
hub / github.com/NetSys/bess / RandomSplit

Class RandomSplit

core/modules/random_split.h:42–62  ·  view source on GitHub ↗

RandomSplit splits and drop packets.

Source from the content-addressed store, hash-verified

40
41// RandomSplit splits and drop packets.
42class RandomSplit final : public Module {
43 public:
44 RandomSplit() : Module() { max_allowed_workers_ = Worker::kMaxWorkers; }
45
46 static const gate_idx_t kNumOGates = MAX_GATES;
47 static const Commands cmds;
48
49 CommandResponse Init(const bess::pb::RandomSplitArg &arg);
50 CommandResponse CommandSetDroprate(
51 const bess::pb::RandomSplitCommandSetDroprateArg &arg);
52 CommandResponse CommandSetGates(
53 const bess::pb::RandomSplitCommandSetGatesArg &arg);
54
55 void ProcessBatch(Context *ctx, bess::PacketBatch *batch) override;
56
57 private:
58 Random rng_; // Random number generator
59 double drop_rate_;
60 gate_idx_t gates_[MAX_SPLIT_GATES];
61 gate_idx_t ngates_;
62};
63
64#endif // BESS_MODULES_RANDOM_SPLIT_H_

Callers 3

test_dropnoneMethod · 0.85
test_dropallMethod · 0.85
_drop_with_rateMethod · 0.85

Calls

no outgoing calls

Tested by 2

test_dropnoneMethod · 0.68
test_dropallMethod · 0.68