content.go 648 B

123456789101112131415161718192021222324
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. package protocol
  4. // ContentType represents the IANA Registered ContentTypes
  5. //
  6. // https://tools.ietf.org/html/rfc4346#section-6.2.1
  7. type ContentType uint8
  8. // ContentType enums
  9. const (
  10. ContentTypeChangeCipherSpec ContentType = 20
  11. ContentTypeAlert ContentType = 21
  12. ContentTypeHandshake ContentType = 22
  13. ContentTypeApplicationData ContentType = 23
  14. )
  15. // Content is the top level distinguisher for a DTLS Datagram
  16. type Content interface {
  17. ContentType() ContentType
  18. Marshal() ([]byte, error)
  19. Unmarshal(data []byte) error
  20. }