MCPcopy Create free account
hub / github.com/FDio/vpp / append

Method append

extras/packetforge/ProtocolHeader.py:310–354  ·  view source on GitHub ↗
(self, big, phf)

Source from the content-addressed store, hash-verified

308 return big
309
310 def append(self, big, phf):
311 bigVal = big["bigVal"]
312 bigMsk = big["bigMsk"]
313
314 if phf.Field.IsReserved:
315 bigVal <<= phf.Size
316 bigMsk <<= phf.Size
317 big.update(bigVal=bigVal, bigMsk=bigMsk)
318 return big, phf.Size
319
320 size = phf.Size
321
322 if (
323 phf.Field.Format == InputFormat.u8
324 or phf.Field.Format == InputFormat.u16
325 or phf.Field.Format == InputFormat.u32
326 ):
327 bigVal = self.appendNum(bigVal, phf.Value, size)
328 bigMsk = self.appendNum(bigMsk, phf.Mask, size)
329
330 elif phf.Field.Format == InputFormat.u64:
331 bigVal = self.appendUInt64(bigVal, phf.Value, size)
332 bigMsk = self.appendUInt64(bigMsk, phf.Mask, size)
333
334 elif phf.Field.Format == InputFormat.ipv4:
335 bigVal = self.appendIPv4(bigVal, phf.Value)
336 bigMsk = self.appendIPv4(bigMsk, phf.Mask)
337
338 elif phf.Field.Format == InputFormat.ipv6:
339 bigVal = self.appendIPv6(bigVal, phf.Value)
340 bigMsk = self.appendIPv6(bigMsk, phf.Mask)
341
342 elif phf.Field.Format == InputFormat.mac:
343 bigVal = self.appendMAC(bigVal, phf.Value)
344 bigMsk = self.appendMAC(bigMsk, phf.Mask)
345
346 elif phf.Field.Format == InputFormat.bytearray:
347 bigVal = self.appendByteArray(bigVal, phf.Value, size)
348 bigMsk = self.appendByteArray(bigMsk, phf.Mask, size)
349
350 else:
351 print("Invalid input format")
352
353 big.update(bigVal=bigVal, bigMsk=bigMsk)
354 return big, size
355
356 def Resolve(self):
357 big = {"bigVal": 0, "bigMsk": 0}

Callers 15

ResolveMethod · 0.95
setUpClassMethod · 0.80
test_groMethod · 0.80
delete_bdMethod · 0.80
create_streamMethod · 0.80
test_igmp_hostMethod · 0.80
create_packetsMethod · 0.80
create_packetsMethod · 0.80
create_packetsMethod · 0.80
create_packetsMethod · 0.80
expand_mix_stringFunction · 0.80

Calls 8

appendNumMethod · 0.95
appendUInt64Method · 0.95
appendIPv4Method · 0.95
appendIPv6Method · 0.95
appendMACMethod · 0.95
appendByteArrayMethod · 0.95
printFunction · 0.85
updateMethod · 0.45

Tested by 15

setUpClassMethod · 0.64
test_groMethod · 0.64
delete_bdMethod · 0.64
create_streamMethod · 0.64
test_igmp_hostMethod · 0.64
create_packetsMethod · 0.64
create_packetsMethod · 0.64
create_packetsMethod · 0.64
create_packetsMethod · 0.64