Documentation
¶
Index ¶
- Constants
- func AppendFcs16(data []byte, fcs uint16) []byte
- func CalcFcs16(data []byte) uint16
- func CalcFcs16WithInit(initialFcs uint16, data []byte) uint16
- func CheckFsc16(dataWithCrc []byte) bool
- func IsIpFrame(frame byte) bool
- func IsIpv4Frame(frame byte) bool
- func IsIpv6Frame(frame byte) bool
- func RemoveFcs16(dataWithCrc []byte) []byte
- type Reader
- type SlipMuxReader
- type SlipMuxWriter
- type Writer
Constants ¶
View Source
const ( END = 0300 /* 0xC0 indicates end of packet */ ESC = 0333 /* 0xDB, indicates byte stuffing */ ESC_END = 0334 /* 0xDC, ESC ESC_END means END data byte */ ESC_ESC = 0335 /* 0xDD, ESC ESC_ESC means ESC data byte */ )
View Source
const ( FRAME_IPV4_START = 0x45 FRAME_IPV4_END = 0x4f FRAME_IPV6_START = 0x60 FRAME_IPV6_END = 0x6f )
View Source
const ( FRAME_UNKNOWN = 0x00 FRAME_DIAGNOSTIC = 0x0a // New Line Character FRAME_COAP = 0xa9 )
View Source
const FCS_GOOD = 0xf0b8
View Source
const FCS_INITIAL = 0xffff
Variables ¶
This section is empty.
Functions ¶
func AppendFcs16 ¶
append the Fcs value to an existing message
func CalcFcs16WithInit ¶
Takes a already calculated FCS and adds more data on it
func CheckFsc16 ¶
func IsIpv4Frame ¶
func IsIpv6Frame ¶
func RemoveFcs16 ¶
Types ¶
type SlipMuxReader ¶
type SlipMuxReader struct {
// contains filtered or unexported fields
}
func NewSlipMuxReader ¶
func NewSlipMuxReader(reader io.Reader) *SlipMuxReader
func (*SlipMuxReader) ReadPacket ¶
func (s *SlipMuxReader) ReadPacket() ([]byte, byte, error)
ReadPacket reads a packet from the stream. Blocks till packet is complete. Returns the packet, the frameType byte and an optional error
The he packet frame is stripped from the returning byte slice. IPv4 and IPv6 frame identifiers are not stripped to keep backwards compatibility with SLIP
type SlipMuxWriter ¶
type SlipMuxWriter struct {
// contains filtered or unexported fields
}
func NewSlipMuxWriter ¶
func NewSlipMuxWriter(writer io.Writer) *SlipMuxWriter
func (*SlipMuxWriter) WritePacket ¶
func (s *SlipMuxWriter) WritePacket(frame byte, p []byte) error
WritePacket writes a SlipMux packet with the given Frame prefix For registered frames see FRAME_* constants. IPV4 and IPV6 frames are not prepended as specified. To not use any Frame identifiers use SlipWriter directly.
Click to show internal directories.
Click to hide internal directories.