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

Method Init

core/modules/exact_match.cc:93–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93CommandResponse ExactMatch::Init(const bess::pb::ExactMatchArg &arg) {
94 empty_masks_ = arg.masks_size() == 0;
95 if (arg.fields_size() != arg.masks_size() && !empty_masks_) {
96 return CommandFailure(EINVAL,
97 "must provide masks for all fields (or no masks for "
98 "default match on all bits on all fields)");
99 }
100
101 for (auto i = 0; i < arg.fields_size(); ++i) {
102 CommandResponse err;
103
104 if (empty_masks_) {
105 bess::pb::FieldData emptymask;
106 err = AddFieldOne(arg.fields(i), emptymask, i);
107 } else {
108 err = AddFieldOne(arg.fields(i), arg.masks(i), i);
109 }
110
111 if (err.error().code() != 0) {
112 return err;
113 }
114 }
115
116 default_gate_ = DROP_GATE;
117
118 return CommandSuccess();
119}
120
121// Retrieves an ExactMatchArg that would reconstruct this module.
122CommandResponse ExactMatch::GetInitialArg(const bess::pb::EmptyArg &) {

Callers

nothing calls this directly

Calls 2

CommandFailureFunction · 0.85
CommandSuccessFunction · 0.85

Tested by

no test coverage detected