sctp

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PAYLOADDATA      chunkType = 0
	INIT             chunkType = 1
	INITACK          chunkType = 2
	SACK             chunkType = 3
	HEARTBEAT        chunkType = 4
	HEARTBEATACK     chunkType = 5
	ABORT            chunkType = 6
	SHUTDOWN         chunkType = 7
	SHUTDOWNACK      chunkType = 8
	ERROR            chunkType = 9
	COOKIEECHO       chunkType = 10
	COOKIEACK        chunkType = 11
	CWR              chunkType = 13
	SHUTDOWNCOMPLETE chunkType = 14
)

List of known chunkType enums

Variables

This section is empty.

Functions

This section is empty.

Types

type Association

type Association struct {
	// contains filtered or unexported fields
}

Association represents an SCTP association 13.2. Parameters Necessary per Association (i.e., the TCB) Peer : Tag value to be sent in every packet and is received Verification: in the INIT or INIT ACK chunk. Tag :

My : Tag expected in every inbound packet and sent in the Verification: INIT or INIT ACK chunk.

Tag : State : A state variable indicating what state the association

: is in, i.e., COOKIE-WAIT, COOKIE-ECHOED, ESTABLISHED,
: SHUTDOWN-PENDING, SHUTDOWN-SENT, SHUTDOWN-RECEIVED,
: SHUTDOWN-ACK-SENT.

  Note: No "CLOSED" state is illustrated since if a
  association is "CLOSED" its TCB SHOULD be removed.

func Client added in v1.2.0

func Client(nextConn net.Conn) (*Association, error)

Client opens a SCTP stream over a conn

func Server added in v1.2.0

func Server(nextConn net.Conn) (*Association, error)

Server accepts a SCTP stream over a conn

func (*Association) AcceptStream added in v1.2.0

func (a *Association) AcceptStream() (*Stream, error)

AcceptStream accepts a stream

func (*Association) Close

func (a *Association) Close() error

Close ends the SCTP Association and cleans up any state

func (*Association) OpenStream added in v1.2.0

func (a *Association) OpenStream(streamIdentifier uint16, defaultPayloadType PayloadProtocolIdentifier) (*Stream, error)

OpenStream opens a stream

type AssociationState

type AssociationState uint8

AssociationState is an enum for the states that an Association will transition through while connecting https://tools.ietf.org/html/rfc4960#section-13.2

const (
	Open AssociationState = iota + 1
	CookieEchoed
	CookieWait
	Established
	ShutdownAckSent
	ShutdownPending
	ShutdownReceived
	ShutdownSent
)

AssociationState enums

func (AssociationState) String

func (a AssociationState) String() string

type PayloadProtocolIdentifier

type PayloadProtocolIdentifier uint32

PayloadProtocolIdentifier is an enum for DataChannel payload types

const (
	PayloadTypeWebRTCDCEP        PayloadProtocolIdentifier = 50
	PayloadTypeWebRTCString      PayloadProtocolIdentifier = 51
	PayloadTypeWebRTCBinary      PayloadProtocolIdentifier = 53
	PayloadTypeWebRTCStringEmpty PayloadProtocolIdentifier = 56
	PayloadTypeWebRTCBinaryEmpty PayloadProtocolIdentifier = 57
)

PayloadProtocolIdentifier enums https://www.iana.org/assignments/sctp-parameters/sctp-parameters.xhtml#sctp-parameters-25

func (PayloadProtocolIdentifier) String

func (p PayloadProtocolIdentifier) String() string

type Stream added in v1.2.0

type Stream struct {
	// contains filtered or unexported fields
}

Stream represents an SCTP stream

func (*Stream) Close added in v1.2.0

func (s *Stream) Close() error

Close closes the conn and releases any Read calls

func (*Stream) Read added in v1.2.0

func (s *Stream) Read(p []byte) (int, error)

Read reads a packet of len(p) bytes, dropping the Payload Protocol Identifier

func (*Stream) ReadSCTP added in v1.2.0

func (s *Stream) ReadSCTP(p []byte) (int, PayloadProtocolIdentifier, error)

ReadSCTP reads a packet of len(p) bytes and returns the associated Payload Protocol Identifier

func (*Stream) SetDefaultPayloadType added in v1.2.0

func (s *Stream) SetDefaultPayloadType(defaultPayloadType PayloadProtocolIdentifier)

SetDefaultPayloadType sets the default payload type used by Write.

func (*Stream) StreamIdentifier added in v1.2.0

func (s *Stream) StreamIdentifier() uint16

StreamIdentifier returns the Stream identifier associated to the stream.

func (*Stream) Write added in v1.2.0

func (s *Stream) Write(p []byte) (n int, err error)

Write writes len(p) bytes from p with the default Payload Protocol Identifier

func (*Stream) WriteSCTP added in v1.2.0

func (s *Stream) WriteSCTP(p []byte, ppi PayloadProtocolIdentifier) (n int, err error)

WriteSCTP writes len(p) bytes from p to the DTLS connection

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL