transaction

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

transaction package implements SIP Transaction Layer

Index

Constants

View Source
const (
	T1        = 500 * time.Millisecond
	T2        = 4 * time.Second
	T4        = 5 * time.Second
	Timer_A   = T1
	Timer_B   = 64 * T1
	Timer_D   = 32 * time.Second
	Timer_E   = T1
	Timer_F   = 64 * T1
	Timer_G   = T1
	Timer_H   = 64 * T1
	Timer_I   = T4
	Timer_J   = 64 * T1
	Timer_K   = T4
	Timer_1xx = 200 * time.Millisecond
	Timer_L   = 64 * T1
	Timer_M   = 64 * T1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientTx

type ClientTx interface {
	Tx
	Responses() <-chan sip.Response
	Cancel() error
}

func NewClientTx

func NewClientTx(origin sip.Request, tpl sip.Transport, logger log.Logger) (ClientTx, error)

type Layer

type Layer interface {
	Cancel()
	Done() <-chan struct{}
	String() string
	Request(req sip.Request) (sip.ClientTransaction, error)
	Respond(res sip.Response) (sip.ServerTransaction, error)
	Transport() sip.Transport
	// Requests returns channel with new incoming server transactions.
	Requests() <-chan sip.ServerTransaction
	// ACKs on 2xx
	Acks() <-chan sip.Request
	// Responses returns channel with not matched responses.
	Responses() <-chan sip.Response
	Errors() <-chan error
}

Layer serves client and server transactions.

func NewLayer

func NewLayer(tpl sip.Transport, logger log.Logger) Layer

type ServerTx

type ServerTx interface {
	Tx
	Respond(res sip.Response) error
	Acks() <-chan sip.Request
	Cancels() <-chan sip.Request
}

func NewServerTx

func NewServerTx(origin sip.Request, tpl sip.Transport, logger log.Logger) (ServerTx, error)

type Tx

type Tx interface {
	Init() error
	Key() TxKey
	Origin() sip.Request
	// Receive receives message from transport layer.
	Receive(msg sip.Message) error
	String() string
	Transport() sip.Transport
	Terminate()
	Errors() <-chan error
	Done() <-chan bool
}

Tx is an common SIP transaction

type TxError

type TxError interface {
	error
	Key() TxKey
	Terminated() bool
	Timeout() bool
	Transport() bool
}

type TxKey

type TxKey = sip.TransactionKey

func MakeClientTxKey

func MakeClientTxKey(msg sip.Message) (TxKey, error)

MakeClientTxKey creates client commonTx key for matching responses - RFC 3261 17.1.3.

func MakeServerTxKey

func MakeServerTxKey(msg sip.Message) (TxKey, error)

MakeServerTxKey creates server commonTx key for matching retransmitting requests - RFC 3261 17.2.3.

type TxTerminatedError

type TxTerminatedError struct {
	Err   error
	TxKey TxKey
	TxPtr string
}

func (*TxTerminatedError) Error

func (err *TxTerminatedError) Error() string

func (*TxTerminatedError) Key

func (err *TxTerminatedError) Key() TxKey

func (*TxTerminatedError) Terminated

func (err *TxTerminatedError) Terminated() bool

func (*TxTerminatedError) Timeout

func (err *TxTerminatedError) Timeout() bool

func (*TxTerminatedError) Transport

func (err *TxTerminatedError) Transport() bool

func (*TxTerminatedError) Unwrap

func (err *TxTerminatedError) Unwrap() error

type TxTimeoutError

type TxTimeoutError struct {
	Err   error
	TxKey TxKey
	TxPtr string
}

func (*TxTimeoutError) Error

func (err *TxTimeoutError) Error() string

func (*TxTimeoutError) Key

func (err *TxTimeoutError) Key() TxKey

func (*TxTimeoutError) Terminated

func (err *TxTimeoutError) Terminated() bool

func (*TxTimeoutError) Timeout

func (err *TxTimeoutError) Timeout() bool

func (*TxTimeoutError) Transport

func (err *TxTimeoutError) Transport() bool

func (*TxTimeoutError) Unwrap

func (err *TxTimeoutError) Unwrap() error

type TxTransportError

type TxTransportError struct {
	Err   error
	TxKey TxKey
	TxPtr string
}

func (*TxTransportError) Error

func (err *TxTransportError) Error() string

func (*TxTransportError) Key

func (err *TxTransportError) Key() TxKey

func (*TxTransportError) Terminated

func (err *TxTransportError) Terminated() bool

func (*TxTransportError) Timeout

func (err *TxTransportError) Timeout() bool

func (*TxTransportError) Transport

func (err *TxTransportError) Transport() bool

func (*TxTransportError) Unwrap

func (err *TxTransportError) Unwrap() error

Jump to

Keyboard shortcuts

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