1 // Copyright 2012 Google, Inc. All rights reserved.
2 // Copyright 2009-2011 Andreas Krennmair. All rights reserved.
4 // Use of this source code is governed by a BSD-style license
5 // that can be found in the LICENSE file in the root of the source
12 "github.com/google/gopacket"
15 // UDPLite is the layer for UDP-Lite headers (rfc 3828).
18 SrcPort, DstPort UDPLitePort
19 ChecksumCoverage uint16
24 // LayerType returns gopacket.LayerTypeUDPLite
25 func (u *UDPLite) LayerType() gopacket.LayerType { return LayerTypeUDPLite }
27 func decodeUDPLite(data []byte, p gopacket.PacketBuilder) error {
29 SrcPort: UDPLitePort(binary.BigEndian.Uint16(data[0:2])),
31 DstPort: UDPLitePort(binary.BigEndian.Uint16(data[2:4])),
33 ChecksumCoverage: binary.BigEndian.Uint16(data[4:6]),
34 Checksum: binary.BigEndian.Uint16(data[6:8]),
35 BaseLayer: BaseLayer{data[:8], data[8:]},
38 p.SetTransportLayer(udp)
39 return p.NextDecoder(gopacket.LayerTypePayload)
42 func (u *UDPLite) TransportFlow() gopacket.Flow {
43 return gopacket.NewFlow(EndpointUDPLitePort, u.sPort, u.dPort)