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

Method CommandSetGates

core/modules/random_split.cc:82–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82CommandResponse RandomSplit::CommandSetGates(
83 const bess::pb::RandomSplitCommandSetGatesArg &arg) {
84 if (arg.gates_size() > MAX_SPLIT_GATES) {
85 return CommandFailure(EINVAL, "no more than %d gates", MAX_SPLIT_GATES);
86 }
87
88 for (int i = 0; i < arg.gates_size(); i++) {
89 if (!is_valid_gate(arg.gates(i))) {
90 return CommandFailure(EINVAL, "Invalid gate %d", gates_[i]);
91 }
92 }
93
94 ngates_ = arg.gates_size();
95 for (int i = 0; i < ngates_; i++) {
96 gates_[i] = arg.gates(i);
97 }
98
99 return CommandSuccess();
100}
101
102void RandomSplit::ProcessBatch(Context *ctx, bess::PacketBatch *batch) {
103 if (ngates_ <= 0) {

Callers

nothing calls this directly

Calls 3

CommandFailureFunction · 0.85
CommandSuccessFunction · 0.85
is_valid_gateFunction · 0.70

Tested by

no test coverage detected