| 216 | } |
| 217 | |
| 218 | void SetMetadata::ProcessBatch(Context *ctx, bess::PacketBatch *batch) { |
| 219 | for (size_t i = 0; i < attrs_.size(); i++) { |
| 220 | const struct Attr *attr = &attrs_[i]; |
| 221 | mt_offset_t mt_offset = attr_offset(i); |
| 222 | |
| 223 | if (!bess::metadata::IsValidOffset(mt_offset)) { |
| 224 | continue; |
| 225 | } |
| 226 | |
| 227 | if (attr->offset >= 0) { |
| 228 | DoProcessBatch<Mode::FromPacket>(batch, attr, mt_offset); |
| 229 | } else { |
| 230 | DoProcessBatch<Mode::FromValue>(batch, attr, mt_offset); |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | RunNextModule(ctx, batch); |
| 235 | } |
| 236 | |
| 237 | ADD_MODULE(SetMetadata, "setattr", "Set metadata attributes to packets") |
nothing calls this directly
no test coverage detected