DecodingLayer is an interface for packet layers that can decode themselves. The important part of DecodingLayer is that they decode themselves in-place. Calling DecodeFromBytes on a DecodingLayer totally resets the entire layer to the new state defined by the data passed in. A returned error leave
| 27 | // Because the DecodingLayer is resetting its own fields, a call to |
| 28 | // DecodeFromBytes should normally not require any memory allocation. |
| 29 | type DecodingLayer interface { |
| 30 | // DecodeFromBytes resets the internal state of this layer to the state |
| 31 | // defined by the passed-in bytes. Slices in the DecodingLayer may |
| 32 | // reference the passed-in data, so care should be taken to copy it |
| 33 | // first should later modification of data be required before the |
| 34 | // DecodingLayer is discarded. |
| 35 | DecodeFromBytes(data []byte, df DecodeFeedback) error |
| 36 | // CanDecode returns the set of LayerTypes this DecodingLayer can |
| 37 | // decode. For Layers that are also DecodingLayers, this will most |
| 38 | // often be that Layer's LayerType(). |
| 39 | CanDecode() LayerClass |
| 40 | // NextLayerType returns the LayerType which should be used to decode |
| 41 | // the LayerPayload. |
| 42 | NextLayerType() LayerType |
| 43 | // LayerPayload is the set of bytes remaining to decode after a call to |
| 44 | // DecodeFromBytes. |
| 45 | LayerPayload() []byte |
| 46 | } |
| 47 | |
| 48 | // DecodingLayerFunc decodes given packet and stores decoded LayerType |
| 49 | // values into specified slice. Returns either first encountered |
no outgoing calls
no test coverage detected
searching dependent graphs…