types

package
v0.7.19 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 2 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// SolSctp ...
	SolSctp = 132
	// SctpBindxAddAddr  SCTP_BINDX_ADD_ADDR directs SCTP to add the given addresses to the
	//   socket (i.e., endpoint)
	SctpBindxAddAddr = 0x01
	// SctpBindxRemAddr SCTP_BINDX_REM_ADDR directs SCTP to
	//   remove the given addresses from the socket.
	SctpBindxRemAddr = 0x02

	// MsgNotification  If a notification has arrived, recvmsg() will return the notification
	//   in the msg_iov field and set the MSG_NOTIFICATION flag in msg_flags.
	//   If the MSG_NOTIFICATION flag is not set, recvmsg() will return data.
	MsgNotification = 0x8000

	// MsgEOR  If all portions of a data frame or notification have been read,
	//   recvmsg() will return with MSG_EOR set in msg_flags. If the application
	//   does not provide enough buffer space to completely
	//   receive a data message, MSG_EOR will not be set in msg_flags.
	//   Successive reads will consume more of the same message until the
	//   entire message has been delivered, and MSG_EOR will be set.
	MsgEOR = 0x80
)
View Source
const (
	// SctpRtoinfoIota ...
	SctpRtoinfoIota = iota
	// SctpAssocinfo ...
	SctpAssocinfo
	// SctpInitmsg applications can specify protocol parameters for the default
	//   association initialization. Setting initialization parameters is effective only on an unconnected
	//   socket (for one-to-many style sockets, only future associations are
	//   affected by the change)
	SctpInitmsg

	// SctpNodelay this option turns on/off any Nagle-like algorithm.  This means that
	//   packets are generally sent as soon as possible, and no unnecessary
	//   delays are introduced, at the cost of more packets in the network.
	SctpNodelay
	// SctpAutoclose ...
	SctpAutoclose
	// SctpSetPeerPrimaryAddr ...
	SctpSetPeerPrimaryAddr
	// SctpPrimaryAddr ...
	SctpPrimaryAddr
	// SctpAdaptationLayer ...
	SctpAdaptationLayer
	// SctpDisableFragments ...
	SctpDisableFragments
	// SctpPeerAddrParams ...
	SctpPeerAddrParams
	// SctpDefaultSentParam ...
	SctpDefaultSentParam
	// SctpEvents ...
	SctpEvents

	// SctpIWantMappedV4Addr ...
	SctpIWantMappedV4Addr
	// SctpMaxseg ...
	SctpMaxseg
	// SctpStatus ...
	SctpStatus
	// SctpGetPeerAddrInfo ...
	SctpGetPeerAddrInfo

	// SctpDelayedAckTime ...
	SctpDelayedAckTime
	// SctpDelayedAck ...
	SctpDelayedAck = SctpDelayedAckTime
	// SctpDelayedSack ...
	SctpDelayedSack = SctpDelayedAckTime

	// SctpSockoptBindxAdd ...
	SctpSockoptBindxAdd = 100
	// SctpSockoptBindxRem ...
	SctpSockoptBindxRem = 101
	// SctpSockoptPeeloff ...
	SctpSockoptPeeloff = 102
	// SctpGetPeerAddrs  ...
	SctpGetPeerAddrs = 108
	// SctpGetLocalAddrs ...
	SctpGetLocalAddrs = 109
	// SctpSockoptConnectx ...
	SctpSockoptConnectx = 110
	// SctpSockoptConnectx3 ...
	SctpSockoptConnectx3 = 111
)
View Source
const (
	// SctpCmsgInit ...
	SctpCmsgInit = CmsgType(iota)
	// SctpCmsgSndrcv ...
	SctpCmsgSndrcv
	// SctpCmsgSndinfo ...
	SctpCmsgSndinfo
	// SctpCmsgRcvinfo ...
	SctpCmsgRcvinfo
	// SctpCmsgNxtinfo ...
	SctpCmsgNxtinfo
)
View Source
const (
	// SctpUnordered this flag is present when the message was sent unordered.
	SctpUnordered = 1 << iota

	// SctpAddrOver  for a one-to-many style socket requests that the SCTP stack override
	//   the primary destination address with the address found with the sendto sendmsg call.
	SctpAddrOver

	// SctpAbort Setting this flag causes the specified association to abort by sending an ABORT message to the peer.
	SctpAbort

	// SctpSackImmediately ...
	SctpSackImmediately

	// SctpEOF Setting this flag invokes the SCTP graceful shutdown
	//  procedures on the specified association.
	SctpEOF
)
View Source
const (
	// SctpCommUp this state means a new association is now ready, and data may be
	// exchanged with this peer. When an association has been
	// established successfully, this notification should be the
	// first one.
	SctpCommUp = State(iota)

	// SctpCommLost this state means the association has failed. The association is
	// now in the closed state. If SEND_FAILED notifications are turned on, an
	// SCTP_COMM_LOST is accompanied by a series of SCTP_SEND_FAILED_EVENT events,
	// one for each outstanding message.
	SctpCommLost

	// SctpRestart SCTP has detected that the peer has restarted.
	SctpRestart

	// SctpShutdownComp the association has gracefully closed.
	SctpShutdownComp

	// SctpCantStrAssoc the association setup failed.  If non-blocking mode is set and data was sent (on a one-to-many
	//  style socket), an SCTP_CANT_STR_ASSOC is accompanied by a
	//  series of SCTP_SEND_FAILED_EVENT events, one for each
	//  outstanding message.
	SctpCantStrAssoc
)
View Source
const (
	// Sctp4 sctp4
	Sctp4 = AddressFamily(iota)
	// Sctp6 sctp6
	Sctp6
	// Sctp6Only sctp6
	Sctp6Only
)
View Source
const (
	// OneToOne one-to-one mode. the goal of this style is to follow as closely as possible the
	//   current practice of using the sockets interface for a connection-
	//   oriented protocol such as TCP.  This style enables existing
	//   applications using connection-oriented protocols to be ported to SCTP
	//   with very little effort.
	OneToOne = SocketMode(iota)
	// OneToMany one to many mode. This set of semantics is
	// similar to that defined for connectionless protocols, such as
	//  UDP.  A one-to-many style SCTP socket should be able to control
	//  multiple SCTP associations.  This is similar to a UDP socket,
	//  which can communicate with many peer endpoints.
	OneToMany
)
View Source
const (
	// SctpAddrAvailable   address reachable notification.
	SctpAddrAvailable = iota

	// SctpAddrUnreachable address unreachable notification
	SctpAddrUnreachable

	// SctpAddrRemoved the address is no longer part of the association.
	SctpAddrRemoved

	// SctpAddrAdded the address is now part of the association.
	SctpAddrAdded

	// SctpAddrMadePrim  the address has now been made the primary
	// destination address.
	SctpAddrMadePrim
)
View Source
const (
	// SctpSnTypeBase ...
	SctpSnTypeBase = NotificationType(iota + (1 << 15))
	// SctpAssocChange ...
	SctpAssocChange
	// SctpPeerAddrChange ...
	SctpPeerAddrChange
	// SctpSendFailed ...
	SctpSendFailed
	// SctpRemoteError ...
	SctpRemoteError
	// SctpShutdownEvent ...
	SctpShutdownEvent
	// SctpPartialDeliveryEvent ...
	SctpPartialDeliveryEvent
	// SctpAdaptationIndication ...
	SctpAdaptationIndication
	// SctpAuthenticationIndication ...
	SctpAuthenticationIndication
	// SctpSenderDryEvent ...
	SctpSenderDryEvent
)
View Source
const (
	// SctpEventDataIo ...
	SctpEventDataIo = 1 << iota
	// SctpEventAssociation communication notifications inform the application that an SCTP
	// association has either begun or ended.
	SctpEventAssociation
	// SctpEventAddress when a destination address of a multi-homed peer encounters a state
	//   change, a peer address change event is sent.
	SctpEventAddress
	// SctpEventSendFailure If SCTP cannot deliver a message, it can return back the message as a
	//   notification if the SCTP_SEND_FAILED_EVENT event is enabled.
	SctpEventSendFailure
	// SctpEventPeerError ...
	SctpEventPeerError
	// SctpEventShutdown  When a peer sends a SHUTDOWN, SCTP delivers this notification to
	// inform the application that it should cease sending data.
	SctpEventShutdown
	// SctpEventPartialDelivery  When a receiver is engaged in a partial delivery of a message, this
	//   notification will be used to indicate various events.
	SctpEventPartialDelivery
	// SctpEventAdaptationLayer When a peer sends an Adaptation Layer Indication parameter as
	//   described in [RFC5061], SCTP delivers this notification to inform the
	//   application about the peer's adaptation layer indication.
	SctpEventAdaptationLayer
	// SctpEventAuthentication defines an extension to authenticate SCTP messages.  The
	//   following notification is used to report different events relating to
	//   the use of this extension.
	SctpEventAuthentication
	// SctpEventSenderDry   When the SCTP stack has no more user data to send or retransmit, this
	//   notification is given to the user.  Also, at the time when a user app
	//   subscribes to this event, if there is no data to be sent or
	//   retransmit, the stack will immediately send up this notification.
	SctpEventSenderDry

	// SctpEventAll ...
	SctpEventAll = SctpEventDataIo | SctpEventAssociation | SctpEventAddress | SctpEventSendFailure | SctpEventPeerError | SctpEventShutdown | SctpEventPartialDelivery | SctpEventAdaptationLayer | SctpEventAuthentication | SctpEventSenderDry
)
View Source
const (
	// SctpMaxStream ...
	SctpMaxStream = 0xffff
)

Variables

This section is empty.

Functions

func WithAdaptationLayer

func WithAdaptationLayer() func(*EventSubscribe)

WithAdaptationLayer sets adaptation layer event

func WithAddress

func WithAddress() func(*EventSubscribe)

WithAddress sets address event

func WithAssociation

func WithAssociation() func(*EventSubscribe)

WithAssociation sets association event

func WithAuthentication

func WithAuthentication() func(*EventSubscribe)

WithAuthentication sets authentication event

func WithDataIO

func WithDataIO() func(*EventSubscribe)

WithDataIO sets data io event

func WithPartialDelivery

func WithPartialDelivery() func(*EventSubscribe)

WithPartialDelivery sets partial delivery event

func WithPeerError

func WithPeerError() func(*EventSubscribe)

WithPeerError sets peer error event

func WithSendFailure

func WithSendFailure() func(*EventSubscribe)

WithSendFailure sets send failure event

func WithSenderDry

func WithSenderDry() func(*EventSubscribe)

WithSenderDry sets sender dry event

func WithShutdown

func WithShutdown() func(*EventSubscribe)

WithShutdown sets shut down event

Types

type AdaptationIndication

type AdaptationIndication struct {
	Type       NotificationType
	Flags      uint16
	Length     uint32
	Indication uint32
	AssocID    int32
}

AdaptationIndication for informing the application about the peer's adaptation layer indication.

type AddressFamily

type AddressFamily int

AddressFamily ...

func (AddressFamily) String

func (af AddressFamily) String() string

func (AddressFamily) ToSyscall

func (af AddressFamily) ToSyscall() int

ToSyscall converts to syscall address family constant values

type AssociationChange

type AssociationChange struct {
	Type  NotificationType
	Flags uint16
	// Length length of the notification data,
	Length uint32
	State  State
	//  If the state was reached due to an error condition (e.g.,
	//  SCTP_COMM_LOST), any relevant error information is available in this field.
	Error uint16
	// OutboundStreams  The maximum number of
	// streams allowed in each direction is available in
	// sac_outbound_streams and sac_inbound streams.
	OutboundStreams uint16
	InboundStreams  uint16
	AssocID         int32
	Info            []byte
}

AssociationChange Communication notifications inform the application that an SCTP

association has either begun or ended.

type Authentication

type Authentication struct {
	Type       NotificationType
	Flags      uint16
	Length     uint32
	KeyNumber  uint16
	Indication uint32
	AssocID    int32
}

Authentication ...

type CmsgType

type CmsgType int32

CmsgType ...

func (CmsgType) I32

func (t CmsgType) I32() int32

I32 ...

type Event

type Event func(*EventSubscribe)

Event SCTP event

type EventSubscribe

type EventSubscribe struct {
	DataIO          uint8
	Association     uint8
	Address         uint8
	SendFailure     uint8
	PeerError       uint8
	Shutdown        uint8
	PartialDelivery uint8
	AdaptationLayer uint8
	Authentication  uint8
	SenderDry       uint8
}

EventSubscribe Data structure for different types of SCTP events.

An SCTP application may need to understand and process events and
errors that happen on the SCTP stack.  These events include network
status changes, association startups, remote operational errors, and
undeliverable messages.  All of these can be essential for the
application.

type GetAddrsOld

type GetAddrsOld struct {
	AssocID int32
	AddrNum int32
	Addrs   uintptr
}

GetAddrsOld ...

type InitMsg

type InitMsg struct {
	// NumOstreams specifies the number of
	// streams to which the application wishes to be able to send.
	NumOstreams uint16
	// MaxInstreams specifies the maximum number of
	// inbound streams the application is prepared to support.
	MaxInstreams uint16
	// MaxAttempts specifies how many attempts the
	//  SCTP endpoint should make at resending the INIT.
	MaxAttempts uint16
	// MaxInitTimeout specifies the largest timeout or
	// retransmission timeout (RTO) value (in milliseconds) to use in attempting an INIT.
	MaxInitTimeout uint16
}

InitMsg the default association initialization.

func NewDefaultInitMsg

func NewDefaultInitMsg() *InitMsg

NewDefaultInitMsg creates new InitMsg

type Notification

type Notification struct {
	Data []byte
}

Notification ...

func (*Notification) GetAdaptationIndication

func (n *Notification) GetAdaptationIndication() *AdaptationIndication

GetAdaptationIndication ...

func (*Notification) GetAssociationChange

func (n *Notification) GetAssociationChange() *AssociationChange

GetAssociationChange ...

func (*Notification) GetAuthentication

func (n *Notification) GetAuthentication() *Authentication

GetAuthentication ...

func (*Notification) GetPartialDelivery

func (n *Notification) GetPartialDelivery() *PartialDelivery

GetPartialDelivery ...

func (*Notification) GetPeerAddrChange

func (n *Notification) GetPeerAddrChange() *PeerAddrChange

GetPeerAddrChange ...

func (*Notification) GetRemoteError

func (n *Notification) GetRemoteError() *RemoteError

GetRemoteError ...

func (*Notification) GetSendFailed

func (n *Notification) GetSendFailed() *SendFailed

GetSendFailed ...

func (*Notification) GetSenderDry

func (n *Notification) GetSenderDry() *SenderDry

GetSenderDry ...

func (*Notification) Header

func (n *Notification) Header() *NotificationHeader

Header gets notification header

func (*Notification) Type

func (n *Notification) Type() NotificationType

Type gets notification type

type NotificationHeader

type NotificationHeader struct {
	Type   NotificationType
	Flags  uint16
	Length uint32
}

NotificationHeader ...

type NotificationType

type NotificationType uint16

NotificationType sctp notification type

func (NotificationType) String

func (n NotificationType) String() string

type NxtInfo

type NxtInfo struct {
	// Stream next message's stream number
	Stream uint16
	Flags  uint16
	PPID   uint32
	// Length length of the message currently within
	// the socket buffer
	Length uint32
	// holds the identifier for the association announced
	// in the SCTP_COMM_UP notification.
	AssocID int32
}

NxtInfo information of the next message that will be delivered if this information is already available when delivering the current message.

type OOBMessage

type OOBMessage struct {
	syscall.SocketControlMessage
}

OOBMessage ...

func (*OOBMessage) GetNxtInfo

func (o *OOBMessage) GetNxtInfo() *NxtInfo

GetNxtInfo ...

func (*OOBMessage) GetSndInfo

func (o *OOBMessage) GetSndInfo() *SndInfo

GetSndInfo ...

func (*OOBMessage) GetSndRcvInfo

func (o *OOBMessage) GetSndRcvInfo() *SndRcvInfo

GetSndRcvInfo ...

func (*OOBMessage) IsSCTP

func (o *OOBMessage) IsSCTP() bool

IsSCTP ...

func (*OOBMessage) Type

func (o *OOBMessage) Type() CmsgType

Type ...

type PartialDelivery

type PartialDelivery struct {
	Type           NotificationType
	Flags          uint16
	Length         uint32
	Indication     uint32
	StreamID       uint32
	SequenceNumber uint32
}

PartialDelivery ...

type PeerAddrChange

type PeerAddrChange struct {
	Type   NotificationType
	Length uint32
	//Addr    C.struct_sockaddr_storage
	State   PeerChangeState
	Error   uint32
	AssocID int32
}

PeerAddrChange ...

type PeerChangeState

type PeerChangeState uint32

PeerChangeState ...

type RemoteError

type RemoteError struct {
	Type    NotificationType
	Flags   uint16
	Length  uint32
	Error   uint16
	AssocID int32
	Info    []byte
}

RemoteError a remote peer may send an Operation Error message to its peer.

type SendFailed

type SendFailed struct {
	Type    NotificationType
	Flags   uint16
	Length  uint32
	Error   uint16
	SndInfo SndInfo
	AssocID int32
	Data    []byte
}

SendFailed ....

type SenderDry

type SenderDry struct {
	Type    NotificationType
	Flags   uint16
	Length  uint32
	AssocID int32
}

SenderDry ...

type SndInfo

type SndInfo struct {
	Stream  uint16
	Flags   uint16
	PPID    uint32
	Context uint32
	AssocID int32
}

SndInfo SCTP options for sending a msg.

type SndRcvInfo

type SndRcvInfo struct {
	// Stream stream number
	Stream uint16
	// SSN  this value contains the stream sequence
	// number that the remote endpoint placed in the DATA chunk.
	SSN uint16
	// Flags ...
	Flags uint16

	// PPID This value in sendmsg() is an unsigned integer that is
	// passed to the remote end in each user message.
	PPID uint32
	// Context This value is an opaque 32-bit context datum that is
	// used in the sendmsg() function.  This value is passed back to the
	// upper layer if an error occurs on the send of a message and is
	// retrieved with each undelivered message.
	Context uint32
	// TTL For the sending side, this field contains the
	// message's time to live, in milliseconds.
	TTL uint32
	// TSN For the receiving side, this field holds a Transmission Sequence Number (TSN)
	// that was assigned to one of the SCTP DATA chunks.
	TSN uint32
	// CumTSN This field will hold the current cumulative TSN as known by the underlying SCTP layer.
	CumTSN uint32
	// AssocID  The association handle field, sinfo_assoc_id, holds the identifier for the association announced in the SCTP_COMM_UP
	//  notification.  All notifications for a given association have the
	//  same identifier.  This field is ignored for one-to-one style sockets.
	AssocID int32
	// contains filtered or unexported fields
}

SndRcvInfo ...

type SocketMode

type SocketMode int

SocketMode ...

type State

type State uint16

State SCTP association event value.

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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