frames.go 572 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package oscar
  2. import (
  3. "bytes"
  4. "io"
  5. )
  6. type SnacError struct {
  7. Code uint16
  8. TLVRestBlock
  9. }
  10. type FlapFrame struct {
  11. StartMarker uint8
  12. FrameType uint8
  13. Sequence uint16
  14. PayloadLength uint16
  15. }
  16. func (f FlapFrame) SNACBuffer(r io.Reader) (*bytes.Buffer, error) {
  17. b := make([]byte, f.PayloadLength)
  18. if _, err := r.Read(b); err != nil {
  19. return nil, err
  20. }
  21. return bytes.NewBuffer(b), nil
  22. }
  23. type SnacFrame struct {
  24. FoodGroup uint16
  25. SubGroup uint16
  26. Flags uint16
  27. RequestID uint32
  28. }
  29. type FlapSignonFrame struct {
  30. FlapVersion uint32
  31. TLVRestBlock
  32. }