SerializableLayer allows its implementations to be written out as a set of bytes, so those bytes may be sent on the wire or otherwise used by the caller. SerializableLayer is implemented by certain Layer types, and can be encoded to bytes using the LayerWriter object.
| 15 | // SerializableLayer is implemented by certain Layer types, and can be encoded to |
| 16 | // bytes using the LayerWriter object. |
| 17 | type SerializableLayer interface { |
| 18 | // SerializeTo writes this layer to a slice, growing that slice if necessary |
| 19 | // to make it fit the layer's data. |
| 20 | // Args: |
| 21 | // b: SerializeBuffer to write this layer on to. When called, b.Bytes() |
| 22 | // is the payload this layer should wrap, if any. Note that this |
| 23 | // layer can either prepend itself (common), append itself |
| 24 | // (uncommon), or both (sometimes padding or footers are required at |
| 25 | // the end of packet data). It's also possible (though probably very |
| 26 | // rarely needed) to overwrite any bytes in the current payload. |
| 27 | // After this call, b.Bytes() should return the byte encoding of |
| 28 | // this layer wrapping the original b.Bytes() payload. |
| 29 | // opts: options to use while writing out data. |
| 30 | // Returns: |
| 31 | // error if a problem was encountered during encoding. If an error is |
| 32 | // returned, the bytes in data should be considered invalidated, and |
| 33 | // not used. |
| 34 | // |
| 35 | // SerializeTo calls SHOULD entirely ignore LayerContents and |
| 36 | // LayerPayload. It just serializes based on struct fields, neither |
| 37 | // modifying nor using contents/payload. |
| 38 | SerializeTo(b SerializeBuffer, opts SerializeOptions) error |
| 39 | // LayerType returns the type of the layer that is being serialized to the buffer |
| 40 | LayerType() LayerType |
| 41 | } |
| 42 | |
| 43 | // SerializeOptions provides options for behaviors that SerializableLayers may want to |
| 44 | // implement. |
no outgoing calls
no test coverage detected
searching dependent graphs…