reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
flowmanager::Flow Class Reference

This class represents a Flow that is created by the Flow Manager. More...

#include <Flow.hxx>

Inheritance diagram for flowmanager::Flow:
[legend]

Public Types

enum  FlowState {
  Unconnected , ConnectingServer , Connecting , Binding ,
  Allocating , Connected , Ready
}
 

Public Member Functions

 Flow (asio::io_context &ioService, asio::ssl::context &sslContext, unsigned int componentId, const StunTuple &localBinding, MediaStream &mediaStream, bool forceCOMedia, std::shared_ptr< RTCPEventLoggingHandler > rtcpEventLoggingHandler=nullptr, std::shared_ptr< FlowContext > context=nullptr)
 
 ~Flow ()
 
void activateFlow (uint8_t allocationProps=StunMessage::PropsNone)
 
void activateFlow (uint64_t reservationToken)
 
bool isReady ()
 
unsigned int getSelectSocketDescriptor ()
 Returns a socket descriptor that can be used in a select call WARNING - this descriptor should not be used for any other purpose.
 
unsigned int getSocketDescriptor ()
 
void send (char *buffer, unsigned int size)
 Turn Send Methods WARNING - if using Secure media, then there must be room at the end of the passed in buffer for the SRTP HMAC code to be appended It would be good to make this safer
 
void sendTo (const asio::ip::address &address, unsigned short port, char *buffer, unsigned int size)
 
void rawSendTo (const asio::ip::address &address, unsigned short port, const char *buffer, unsigned int size)
 
asio::error_code receive (char *buffer, unsigned int &size, unsigned int timeout, asio::ip::address *sourceAddress=0, unsigned short *sourcePort=0)
 Receive Methods.
 
asio::error_code receiveFrom (const asio::ip::address &address, unsigned short port, char *buffer, unsigned int &size, unsigned int timeout)
 
void setActiveDestination (const char *address, unsigned short port)
 Used to set where this flow should be sending to.
 
void startDtlsClient (const char *address, unsigned short port)
 Dtls-Srtp Methods.
 
void setRemoteSDPFingerprint (const resip::Data &hashFunction, const resip::Data &fingerprint)
 This method should be called when remote fingerprint is discovered via SDP negotiation (RFC 8122 a=fingerprint): hashFunction is its hash function textual name, eg.
 
const resip::Data getRemoteSDPFingerprint ()
 Retrieves the stored remote SDP Fingerprint.
 
const StunTuple & getLocalTuple ()
 
StunTuple getSessionTuple ()
 
StunTuple getRelayTuple ()
 
StunTuple getReflexiveTuple ()
 
uint64_t getReservationToken ()
 
unsigned int getComponentId ()
 
- Public Member Functions inherited from reTurn::TurnAsyncSocketHandler
 TurnAsyncSocketHandler ()
 
virtual ~TurnAsyncSocketHandler ()
 

Static Public Attributes

static int maxReceiveFifoDuration = 10
 
static int maxReceiveFifoSize = 100 * maxReceiveFifoDuration
 
static int dtlsHandshakeEvictionGrace = 5
 Seconds after which a server DTLS handshake still in progress gives up its place, when a flow already has as many DTLS associations as it allows, to a new peer that has completed the cookie exchange: a real handshake takes a few round trips; one that hasn't finished by then has stalled (eg.
 

Friends

class FlowDtlsSocketContext
 

Detailed Description

This class represents a Flow that is created by the Flow Manager.

A flow is a bi-directional stream of data for communicating with an endpoint, that may use UDP, TCP or TLS over TCP. A flow may also use a Turn Allocation to transmit data to/from an endpoint.

Author: Scott Godin (sgodin AT SipSpectrum DOT com)

Definition at line 44 of file Flow.hxx.

Member Enumeration Documentation

◆ FlowState

Enumerator
Unconnected 
ConnectingServer 
Connecting 
Binding 
Allocating 
Connected 
Ready 

Definition at line 56 of file Flow.hxx.

Constructor & Destructor Documentation

◆ Flow()

Flow::Flow ( asio::io_context &  ioService,
asio::ssl::context &  sslContext,
unsigned int  componentId,
const StunTuple &  localBinding,
MediaStream &  mediaStream,
bool  forceCOMedia,
std::shared_ptr< RTCPEventLoggingHandler >  rtcpEventLoggingHandler = nullptr,
std::shared_ptr< FlowContext >  context = nullptr 
)

Definition at line 126 of file Flow.cxx.

◆ ~Flow()

Flow::~Flow ( )

Definition at line 195 of file Flow.cxx.

Member Function Documentation

◆ activateFlow() [1/2]

void Flow::activateFlow ( uint64_t  reservationToken)

Definition at line 220 of file Flow.cxx.

◆ activateFlow() [2/2]

void Flow::activateFlow ( uint8_t  allocationProps = StunMessage::PropsNone)

Definition at line 227 of file Flow.cxx.

◆ getComponentId()

unsigned int flowmanager::Flow::getComponentId ( )
inline

Definition at line 129 of file Flow.hxx.

◆ getLocalTuple()

const StunTuple & Flow::getLocalTuple ( )

Definition at line 598 of file Flow.cxx.

◆ getReflexiveTuple()

StunTuple Flow::getReflexiveTuple ( )

Definition at line 629 of file Flow.cxx.

◆ getRelayTuple()

StunTuple Flow::getRelayTuple ( )

Definition at line 621 of file Flow.cxx.

◆ getRemoteSDPFingerprint()

const resip::Data Flow::getRemoteSDPFingerprint ( )

Retrieves the stored remote SDP Fingerprint.

Definition at line 591 of file Flow.cxx.

◆ getReservationToken()

uint64_t Flow::getReservationToken ( )

Definition at line 637 of file Flow.cxx.

◆ getSelectSocketDescriptor()

unsigned int Flow::getSelectSocketDescriptor ( )

Returns a socket descriptor that can be used in a select call WARNING - this descriptor should not be used for any other purpose.

  • do NOT set socket options, or send, receive from this descriptor, instead use the Flow api's

Definition at line 259 of file Flow.cxx.

◆ getSessionTuple()

StunTuple Flow::getSessionTuple ( )

Definition at line 604 of file Flow.cxx.

◆ getSocketDescriptor()

unsigned int Flow::getSocketDescriptor ( )

Definition at line 265 of file Flow.cxx.

◆ isReady()

bool flowmanager::Flow::isReady ( )
inline

Definition at line 80 of file Flow.hxx.

◆ rawSendTo()

void Flow::rawSendTo ( const asio::ip::address &  address,
unsigned short  port,
const char *  buffer,
unsigned int  size 
)

Definition at line 307 of file Flow.cxx.

◆ receive()

asio::error_code Flow::receive ( char *  buffer,
unsigned int &  size,
unsigned int  timeout,
asio::ip::address *  sourceAddress = 0,
unsigned short *  sourcePort = 0 
)

Receive Methods.

Definition at line 412 of file Flow.cxx.

◆ receiveFrom()

asio::error_code Flow::receiveFrom ( const asio::ip::address &  address,
unsigned short  port,
char *  buffer,
unsigned int &  size,
unsigned int  timeout 
)

Definition at line 366 of file Flow.cxx.

◆ send()

void Flow::send ( char *  buffer,
unsigned int  size 
)

Turn Send Methods WARNING - if using Secure media, then there must be room at the end of the passed in buffer for the SRTP HMAC code to be appended It would be good to make this safer

Definition at line 272 of file Flow.cxx.

◆ sendTo()

void Flow::sendTo ( const asio::ip::address &  address,
unsigned short  port,
char *  buffer,
unsigned int  size 
)

Definition at line 289 of file Flow.cxx.

◆ setActiveDestination()

void Flow::setActiveDestination ( const char *  address,
unsigned short  port 
)

Used to set where this flow should be sending to.

Definition at line 519 of file Flow.cxx.

◆ setRemoteSDPFingerprint()

void Flow::setRemoteSDPFingerprint ( const resip::Data &  hashFunction,
const resip::Data &  fingerprint 
)

This method should be called when remote fingerprint is discovered via SDP negotiation (RFC 8122 a=fingerprint): hashFunction is its hash function textual name, eg.

"sha-256". SRTP is only set up for dtls-srtp connections whose peer certificate matches it, so none is set up until this is called; connections that have already completed their handshake are checked now. Calling it means DTLS-SRTP was negotiated: from then on, media is only sent to, and passed on from, endpoints whose DTLS handshake has set up SRTP - never in the clear.

Definition at line 574 of file Flow.cxx.

◆ startDtlsClient()

void Flow::startDtlsClient ( const char *  address,
unsigned short  port 
)

Dtls-Srtp Methods.

Starts the dtls client handshake process - (must call setActiveDestination first) Call this method if this client has negotiated the "Active" role via SDP

Definition at line 566 of file Flow.cxx.

Friends And Related Symbol Documentation

◆ FlowDtlsSocketContext

Definition at line 133 of file Flow.hxx.

Member Data Documentation

◆ dtlsHandshakeEvictionGrace

int Flow::dtlsHandshakeEvictionGrace = 5
static

Seconds after which a server DTLS handshake still in progress gives up its place, when a flow already has as many DTLS associations as it allows, to a new peer that has completed the cookie exchange: a real handshake takes a few round trips; one that hasn't finished by then has stalled (eg.

to hold the place)

Definition at line 54 of file Flow.hxx.

◆ maxReceiveFifoDuration

int Flow::maxReceiveFifoDuration = 10
static

Definition at line 48 of file Flow.hxx.

◆ maxReceiveFifoSize

int Flow::maxReceiveFifoSize = 100 * maxReceiveFifoDuration
static

Definition at line 49 of file Flow.hxx.


The documentation for this class was generated from the following files: