1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 // A DstUnreach represents an ICMP destination unreachable message
9 type DstUnreach struct {
10 Data []byte // data, known as original datagram field
11 Extensions []Extension // extensions
14 // Len implements the Len method of MessageBody interface.
15 func (p *DstUnreach) Len(proto int) int {
19 l, _ := multipartMessageBodyDataLen(proto, p.Data, p.Extensions)
23 // Marshal implements the Marshal method of MessageBody interface.
24 func (p *DstUnreach) Marshal(proto int) ([]byte, error) {
25 return marshalMultipartMessageBody(proto, p.Data, p.Extensions)
28 // parseDstUnreach parses b as an ICMP destination unreachable message
30 func parseDstUnreach(proto int, b []byte) (MessageBody, error) {
32 return nil, errMessageTooShort
36 p.Data, p.Extensions, err = parseMultipartMessageBody(proto, b)