MCPcopy
hub / github.com/osrg/gobgp / serialize

Method serialize

pkg/zebra/zapi.go:3595–3612  ·  view source on GitHub ↗

Ref: zread_get_label_chunk in zebra/zserv.c of FRR3.x Ref: zread_get_label_chunk in zebra/zapi_msg.c of FRR5.x, 6.x, 7,x, and 8

(version uint8, software Software)

Source from the content-addressed store, hash-verified

3593// Ref: zread_get_label_chunk in zebra/zserv.c of FRR3.x
3594// Ref: zread_get_label_chunk in zebra/zapi_msg.c of FRR5.x, 6.x, 7,x, and 8
3595func (b *GetLabelChunkBody) serialize(version uint8, software Software) ([]byte, error) {
3596 buf := make([]byte, 12)
3597 pos := 0
3598 b.base = 0
3599 if version > 4 && !(software.name == "frr" && software.version == 4) {
3600 buf[pos] = b.proto
3601 binary.BigEndian.PutUint16(buf[pos+1:pos+3], b.instance)
3602 pos += 3
3603 }
3604 buf[pos] = b.keep
3605 binary.BigEndian.PutUint32(buf[pos+1:pos+5], b.ChunkSize)
3606 pos += 5
3607 if version == 6 && software.name == "frr" && software.version >= 7.2 {
3608 binary.BigEndian.PutUint32(buf[pos:pos+4], b.base)
3609 pos += 4
3610 }
3611 return buf[:pos], nil
3612}
3613
3614// Ref: zsend_assign_label_chunk_response in zebra/zserv.c of FRR3.x
3615// Ref: zsend_assign_label_chunk_response in zebra/zapi_msg.c of FRR5.x, 6.x, 7,x, and 8

Callers 1

Test_GetLabelChunkBodyFunction · 0.95

Calls

no outgoing calls

Tested by 1

Test_GetLabelChunkBodyFunction · 0.76