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

Method GetId

core/modules/drr.cc:293–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293DRR::FlowId DRR::GetId(bess::Packet *pkt) {
294 using bess::utils::Ethernet;
295 using bess::utils::Ipv4;
296 using bess::utils::Udp;
297
298 Ethernet *eth = pkt->head_data<Ethernet *>();
299 Ipv4 *ip = reinterpret_cast<Ipv4 *>(eth + 1);
300 size_t ip_bytes = ip->header_length << 2;
301 Udp *udp = reinterpret_cast<Udp *>(reinterpret_cast<uint8_t *>(ip) +
302 ip_bytes); // Assumes a l-4 header
303 // TODO(joshua): handle packet fragmentation
304 FlowId id = {ip->src.value(), ip->dst.value(), udp->src_port.value(),
305 udp->dst_port.value(), ip->protocol};
306 return id;
307}
308
309void DRR::AddNewFlow(bess::Packet *pkt, FlowId id, int *err) {
310 // creates flow

Callers

nothing calls this directly

Calls 1

valueMethod · 0.80

Tested by

no test coverage detected