Bayonne2 / Common C++ 2 Framework
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Friends
ZrtpQueue Class Referenceabstract

GNU ccRTP extension to support GNU ZRTP. More...

#include <ZrtpQueue.h>

Inheritance diagram for ZrtpQueue:
Inheritance graph
[legend]
Collaboration diagram for ZrtpQueue:
Collaboration graph
[legend]

Public Types

enum  Tos { tosBestEffort, tosEnhanced }
 rtp.h cc++/rtp.h More...
 

Public Member Functions

int32_t initialize (const char *zidFilename, bool autoEnable=true, ZrtpConfigure *config=NULL)
 Initialize the ZrtpQueue. More...
 
void setEnableZrtp (bool onOff)
 Enable or disable ZRTP processing. More...
 
bool isEnableZrtp ()
 Return the state of ZRTP enable state. More...
 
void SASVerified ()
 Set SAS as verified. More...
 
void resetSASVerified ()
 Reset the SAS verfied flag for the current user's retained secrets. More...
 
void goClearOk ()
 To confirm a go clear request. More...
 
void requestGoClear ()
 Request to switch off secure mode. More...
 
void setAuxSecret (uint8_t *data, int32_t length)
 Set the auxilliary secret. More...
 
void setUserCallback (ZrtpUserCallback *ucb)
 Set the application's callback class. More...
 
void setClientId (std::string id)
 Set the client ID for ZRTP Hello message. More...
 
std::string getHelloHash ()
 Get the ZRTP Hello Hash data. More...
 
std::string getPeerHelloHash ()
 Get the peer's ZRTP Hello Hash data. More...
 
std::string getMultiStrParams ()
 Get Multi-stream parameters. More...
 
void setMultiStrParams (std::string parameters)
 Set Multi-stream parameters. More...
 
bool isMultiStream ()
 Check if this ZRTP use Multi-stream. More...
 
bool isMultiStreamAvailable ()
 Check if the other ZRTP client supports Multi-stream. More...
 
void acceptEnrollment (bool accepted)
 Accept a PBX enrollment request. More...
 
std::string getSasType ()
 Get the commited SAS rendering algorithm for this ZRTP session. More...
 
uint8_t * getSasHash ()
 Get the computed SAS hash for this ZRTP session. More...
 
bool sendSASRelayPacket (uint8_t *sh, std::string render)
 Send the SAS relay packet. More...
 
bool isMitmMode ()
 Check the state of the MitM mode flag. More...
 
void setMitmMode (bool mitmMode)
 Set the state of the MitM mode flag. More...
 
void setParanoidMode (bool yesNo)
 Enable or disable paranoid mode. More...
 
bool isParanoidMode ()
 Check status of paranoid mode. More...
 
bool isEnrollmentMode ()
 Check the state of the enrollment mode. More...
 
void setEnrollmentMode (bool enrollmentMode)
 Check the state of the enrollment mode. More...
 
void setPBXEnrollment (bool enrollmentMode)
 Backwards compatible api fix... More...
 
bool isPeerEnrolled ()
 Check if a peer's cache entry has a vaild MitM key. More...
 
void setSignSas (bool sasSignMode)
 Set the state of the SAS signature mode flag. More...
 
bool setSignatureData (uint8 *data, int32 length)
 Set signature data. More...
 
const uint8 * getSignatureData ()
 Get signature data. More...
 
int32 getSignatureLength ()
 Get length of signature data. More...
 
void putData (uint32 stamp, const unsigned char *data=NULL, size_t len=0)
 Put data into the RTP output queue. More...
 
void sendImmediate (uint32 stamp, const unsigned char *data=NULL, size_t len=0)
 Immediatly send a data packet. More...
 
void startZrtp ()
 Starts the ZRTP protocol engine. More...
 
void stopZrtp ()
 Stops the ZRTP protocol engine. More...
 
int32 getPeerZid (uint8 *data)
 Get other party's ZID (ZRTP Identifier) data. More...
 
void setControlBandwidth (float fraction)
 Specify the bandwith available for control (RTCP) packets. More...
 
float getControlBandwidth () const
 
RTCPSenderInfogetMRSenderInfo (SyncSource &src)
 Get the most recent sender report received from a synchronization source. More...
 
RTCPReceiverInfogetMRReceiverInfo (SyncSource &srcFrom)
 Ask for the info in the most recent receiver report about the local source received from the source given as parameter. More...
 
void setLeavingDelay (microtimeout_t delay)
 Set how much time the stack will wait before deleting a synchronization source that has sent an RTCP BYE packet. More...
 
void setEnd2EndDelay (microtimeout_t t)
 This method sets the maximum end to end delay allowed. More...
 
microtimeout_t getDefaultEnd2EndDelay () const
 
microtimeout_t getEnd2EndDelay () const
 
void setSendersControlFraction (float fraction)
 Specify the fraction of the total control bandwith to be dedicated to senders reports. More...
 
void setMinRTCPInterval (microtimeout_t interval)
 Manually set the minimum interval for sending RTP compound packets. More...
 
uint32 getSendRTCPPacketCount () const
 Get the total number of RTCP packets sent until now. More...
 
void setSDESItem (Participant *part, SDESItemType item, const std::string &val)
 
void setPRIVPrefix (Participant *part, const std::string val)
 
void setTypeOfService (Tos tos)
 Specify the kind of service the application expects to use. More...
 
void enableStack ()
 Enable packet queue processing in the stack. More...
 
void disableStack ()
 Disable packet queue processing in the stack. More...
 
bool isActive () const
 Get active connection state flag. More...
 
uint32 getCurrentTimestamp () const
 Get the timestamp that should be given for a packet whose payload sampling instant corresponds to the current system time. More...
 
void setSessionBandwidth (uint32 bw)
 Specify the bandwidth of the current session. More...
 
uint32 getDefaultSessionBandwidth () const
 
uint32 getSessionBandwidth () const
 
void setTimeclock ()
 Set the packet timeclock for synchronizing timestamps. More...
 
timeout_t getTimeclock () const
 Get the packet timeclock for synchronizing timestamps. More...
 
SyncSourcesIterator begin ()
 
SyncSourcesIterator end ()
 
const AppDataUnitgetData (uint32 stamp, const SyncSource *src=NULL)
 Retreive data from a specific timestamped packet if such a packet is currently available in the receive buffer. More...
 
bool isWaiting (const SyncSource *src=NULL) const
 Determine if packets are waiting in the reception queue. More...
 
uint32 getFirstTimestamp (const SyncSource *src=NULL) const
 Get timestamp of first packet waiting in the queue. More...
 
void setMinValidPacketSequence (uint8 packets)
 When receiving packets from a new source, it may be convenient to reject a first few packets before we are really sure the source is valid. More...
 
uint8 getDefaultMinValidPacketSequence () const
 
uint8 getMinValidPacketSequence () const
 Get the minimun number of consecutive packets that must be received from a source before accepting its data packets. More...
 
void setMaxPacketMisorder (uint16 packets)
 
uint16 getDefaultMaxPacketMisorder () const
 
uint16 getMaxPacketMisorder () const
 
void setMaxPacketDropout (uint16 packets)
 It also prevents packets sent after a restart of the source being immediately accepted. More...
 
uint16 getDefaultMaxPacketDropout () const
 
uint16 getMaxPacketDropout () const
 
void setInQueueCryptoContext (CryptoContext *cc)
 Set input queue CryptoContext. More...
 
void removeInQueueCryptoContext (CryptoContext *cc)
 Remove input queue CryptoContext. More...
 
CryptoContextgetInQueueCryptoContext (uint32 ssrc)
 Get an input queue CryptoContext identified by SSRC. More...
 
size_t getDefaultMaxRecvPacketSize () const
 
size_t getMaxRecvPacketSize () const
 
void setMaxRecvPacketSize (size_t maxsize)
 
bool setPayloadFormat (const PayloadFormat &pf)
 Set the payload format in use, for timing and payload type identification purposes. More...
 
uint32 getLocalSSRC () const
 
uint32 getCurrentRTPClockRate () const
 Get the clock rate in RTP clock units (for instance, 8000 units per second for PCMU, or 90000 units per second for MP2T). More...
 
PayloadType getCurrentPayloadType () const
 
timeval getInitialTime () const
 
bool addDestination (const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
 
bool addDestination (const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
 
bool forgetDestination (const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
 
bool forgetDestination (const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
 
void addContributor (uint32 csrc)
 Add csrc as the CSRC identifier of a new contributor. More...
 
bool removeContributor (uint32 csrc)
 Remove CSRC from the list of contributors. More...
 
bool isSending () const
 Determine if outgoing packets are waiting to send. More...
 
void setPadding (uint8 paddinglen)
 Set padding. More...
 
void setMark (bool mark)
 Set marker bit for the packet in which the next data provided will be send. More...
 
bool getMark () const
 Get wheter the mark bit will be set in the next packet. More...
 
size_t setPartial (uint32 timestamp, unsigned char *data, size_t offset, size_t max)
 Set partial data for an already queued packet. More...
 
microtimeout_t getDefaultSchedulingTimeout () const
 
void setSchedulingTimeout (microtimeout_t to)
 Set the default scheduling timeout to use when no data packets are waiting to be sent. More...
 
microtimeout_t getDefaultExpireTimeout () const
 
void setExpireTimeout (microtimeout_t to)
 Set the "expired" timer for expiring packets pending in the send queue which have gone unsent and are already "too late" to be sent now. More...
 
microtimeout_t getExpireTimeout () const
 
uint32 getSendPacketCount () const
 Get the total number of packets sent so far. More...
 
uint32 getSendOctetCount () const
 Get the total number of octets (payload only) sent so far. More...
 
uint16 getSequenceNumber () const
 Get the sequence number of the next outgoing packet. More...
 
void setOutQueueCryptoContext (CryptoContext *cc)
 Set ouput queue CryptoContext. More...
 
void removeOutQueueCryptoContext (CryptoContext *cc)
 Remove output queue CryptoContext. More...
 
CryptoContextgetOutQueueCryptoContext (uint32 ssrc)
 Get an output queue CryptoContext identified by SSRC. More...
 
size_t getDefaultMaxSendSegmentSize ()
 
void setMaxSendSegmentSize (size_t size)
 Set maximum payload segment size before fragmenting sends. More...
 
size_t getMaxSendSegmentSize ()
 

Static Public Member Functions

static size_t getDefaultMembersSize ()
 

Protected Types

enum  { defaultPathMTU = 1500 }
 

Protected Member Functions

virtual bool onSRTPPacketError (IncomingRTPPkt &pkt, int32 errorCode)
 A hook that gets called if the decoding of an incoming SRTP was erroneous. More...
 
void handleTimeout (const std::string &c)
 Handle timeout event forwarded by the TimeoutProvider. More...
 
virtual size_t takeInDataPacket ()
 This function is used by the service thread to process the next incoming packet and place it in the receive list. More...
 
int32_t sendDataZRTP (const unsigned char *data, int32_t length)
 
int32_t activateTimer (int32_t time)
 Activate timer. More...
 
int32_t cancelTimer ()
 Cancel the active timer. More...
 
void sendInfo (GnuZrtpCodes::MessageSeverity severity, int32_t subCode)
 Send information messages to the hosting environment. More...
 
bool srtpSecretsReady (SrtpSecret_t *secrets, EnableSecurity part)
 SRTP crypto data ready for the sender or receiver. More...
 
void srtpSecretsOff (EnableSecurity part)
 Switch off the security for the defined part. More...
 
void srtpSecretsOn (std::string c, std::string s, bool verified)
 Switch on the security. More...
 
void handleGoClear ()
 This method handles GoClear requests. More...
 
void zrtpNegotiationFailed (GnuZrtpCodes::MessageSeverity severity, int32_t subCode)
 Handle ZRTP negotiation failed. More...
 
void zrtpNotSuppOther ()
 ZRTP calls this method if the other side does not support ZRTP. More...
 
void synchEnter ()
 Enter synchronization mutex. More...
 
void synchLeave ()
 Leave synchronization mutex. More...
 
void zrtpAskEnrollment (GnuZrtpCodes::InfoEnrollment info)
 Inform about a PBX enrollment request. More...
 
void zrtpInformEnrollment (GnuZrtpCodes::InfoEnrollment info)
 Inform about PBX enrollment result. More...
 
void signSAS (uint8_t *sasHash)
 Request a SAS signature. More...
 
bool checkSASSignature (uint8_t *sasHash)
 ZRTPQueue calls this method to request a SAS signature check. More...
 
 ZrtpQueue (uint32 size=RTPDataQueue::defaultMembersHashSize, RTPApplication &app=defaultApplication())
 
 ZrtpQueue (uint32 ssrc, uint32 size=RTPDataQueue::defaultMembersHashSize, RTPApplication &app=defaultApplication())
 Local SSRC is given instead of computed by the queue. More...
 
virtual ~ZrtpQueue ()
 
const RTPApplicationgetApplication ()
 
void controlTransmissionService ()
 Build and send RTCP packets following timing rules (including the "timer reconsideration" algorithm). More...
 
void controlReceptionService ()
 Process incoming RTCP packets pending in the control reception socket. More...
 
bool checkSSRCInRTCPPkt (SyncSourceLink &sourceLink, bool is_new, InetAddress &na, tpport_t tp)
 Appy collision and loop detection and correction algorithm when receiving RTCP packets. More...
 
void endQueueRTCPManager ()
 
virtual void onGotSR (SyncSource &source, SendReport &SR, uint8 blocks)
 Plug-in for processing (acquire information carried in) an incoming RTCP Sender Report. More...
 
virtual void onGotRR (SyncSource &source, RecvReport &RR, uint8 blocks)
 Plug-in for processing (acquire information carried in) an incoming RTCP Receiver Report. More...
 
bool onGotSDES (SyncSource &source, RTCPPacket &pkt)
 
virtual bool onGotSDESChunk (SyncSource &source, SDESChunk &chunk, size_t len)
 Plug-in for handling of SDES chunks. More...
 
virtual void onGotAPP (SyncSource &, RTCPCompoundHandler::APPPacket &, size_t)
 Plug-in for handling of APP (application specific) RTCP packets. More...
 
timeval getRTCPCheckInterval ()
 
uint32 getLastSendPacketCount () const
 Get the number of data packets sent at the time the last SR was generated. More...
 
void setPrevMembersNum (uint32 n)
 
uint32 getPrevMembersCount () const
 
size_t dispatchBYE (const std::string &reason)
 This method is used to send an RTCP BYE packet. More...
 
size_t sendControlToDestinations (unsigned char *buffer, size_t len)
 
virtual void timerTick ()
 A plugin point for timer tick driven events. More...
 
void renewLocalSSRC ()
 
void endQueue ()
 This method ends the queue. More...
 
virtual bool isPendingData (microtimeout_t timeout)=0
 This function is used to check for and schedule against arriving packets based on the derived connection type. More...
 
bool checkSSRCInIncomingRTPPkt (SyncSourceLink &sourceLink, bool is_new, InetAddress &na, tpport_t tp)
 Apply collision and loop detection and correction algorithm when receiving RTP data packets. More...
 
void setSourceExpirationPeriod (uint8 intervals)
 Set the number of RTCP intervals that the stack will wait to change the state of a source from stateActive to stateInactive, or to delete the source after being in stateInactive. More...
 
IncomingDataQueue::IncomingRTPPktLinkgetWaiting (uint32 timestamp, const SyncSource *src=NULL)
 This is used to fetch a packet in the receive queue and to expire packets older than the current timestamp. More...
 
bool recordReception (SyncSourceLink &srcLink, const IncomingRTPPkt &pkt, const timeval recvtime)
 Log reception of a new RTP packet from this source. More...
 
void recordExtraction (const IncomingRTPPkt &pkt)
 Log extraction of a packet from this source from the scheduled reception queue. More...
 
void purgeIncomingQueue ()
 
virtual void onNewSyncSource (const SyncSource &)
 Virtual called when a new synchronization source has joined the session. More...
 
virtual bool onRTPPacketRecv (IncomingRTPPkt &)
 A virtual function to support parsing of arriving packets to determine if they should be kept in the queue and to dispatch events. More...
 
virtual void onExpireRecv (IncomingRTPPkt &)
 A hook to filter packets in the receive queue that are being expired. More...
 
bool insertRecvPacket (IncomingRTPPktLink *packetLink)
 Insert a just received packet in the queue (both general and source specific queues). More...
 
virtual size_t recvData (unsigned char *buffer, size_t length, InetHostAddress &host, tpport_t &port)=0
 This function performs the physical I/O for reading a packet from the source. More...
 
virtual size_t getNextDataPacketSize () const =0
 
void setLocalSSRC (uint32 ssrc)
 
uint32 getLocalSSRCNetwork () const
 
size_t getDefaultMembersHashSize ()
 
SyncSourceLinkgetLink (const SyncSource &source) const
 
bool isMine (const SyncSource &source) const
 Get whether a synchronization source is recorded in this membership controller. More...
 
bool isRegistered (uint32 ssrc)
 Returns whether there is already a synchronizacion source with "ssrc" SSRC identifier. More...
 
SyncSourceLinkgetSourceBySSRC (uint32 ssrc, bool &created)
 Get the description of a source by its ssrc identifier. More...
 
bool BYESource (uint32 ssrc)
 Mark the source identified by ssrc as having sent a BYE packet. More...
 
bool removeSource (uint32 ssrc)
 Remove the description of the source identified by ssrc More...
 
SyncSourceLinkgetFirst ()
 
SyncSourceLinkgetLast ()
 
uint32 getMembersCount ()
 
void setMembersCount (uint32 n)
 
uint32 getSendersCount ()
 
void setLink (SyncSource &source, void *link)
 
void setParticipant (SyncSource &source, Participant &p)
 
void setState (SyncSource &source, SyncSource::State ns)
 
void setSender (SyncSource &source, bool active)
 
void setDataTransportPort (SyncSource &source, tpport_t p)
 
void setControlTransportPort (SyncSource &source, tpport_t p)
 
void setNetworkAddress (SyncSource &source, InetAddress addr)
 
void addParticipant (RTPApplication &app, Participant &part)
 
void removeParticipant (RTPApplication &app, RTPApplication::ParticipantLink *pl)
 
ConflictingTransportAddresssearchDataConflict (InetAddress na, tpport_t dtp)
 
ConflictingTransportAddresssearchControlConflict (InetAddress na, tpport_t ctp)
 
void updateConflict (ConflictingTransportAddress &ca)
 
void addConflict (const InetAddress &na, tpport_t dtp, tpport_t ctp)
 
void dispatchImmediate (OutgoingRTPPkt *packet)
 This is used to write the RTP data packet to one or more destinations. More...
 
microtimeout_t getSchedulingTimeout ()
 This computes the timeout period for scheduling transmission of the next packet at the "head" of the send buffer. More...
 
size_t dispatchDataPacket ()
 This function is used by the service thread to process the next outgoing packet pending in the sending queue. More...
 
void setNextSeqNum (uint32 seqNum)
 For thoses cases in which the application requires a method to set the sequence number for the outgoing stream (such as for implementing the RTSP PLAY command). More...
 
uint32 getCurrentSeqNum (void)
 
void setInitialTimestamp (uint32 ts)
 
uint32 getInitialTimestamp ()
 
void purgeOutgoingQueue ()
 
virtual void setControlPeer (const InetAddress &host, tpport_t port)
 
bool isSingleDestination () const
 Get whether there is only a destination in the list. More...
 
TransportAddressgetFirstDestination () const
 
void lockDestinationList () const
 
void unlockDestinationList () const
 
void writeLockDestinationList () const
 
bool addDestinationToList (const InetAddress &ia, tpport_t data, tpport_t control)
 Locks the object before modifying it. More...
 
bool removeDestinationFromList (const InetAddress &ia, tpport_t dataPort, tpport_t controlPort)
 Locks the object before modifying it. More...
 
void setPathMTU (uint16 mtu)
 
uint16 getPathMTU ()
 
bool checkCompoundRTCPHeader (size_t len)
 Perform RTCP compound packet header validity check as specified in draft-ietv-avt-rtp-new. More...
 

Protected Attributes

ThreadLock recvLock
 
IncomingRTPPktLinkrecvFirst
 
IncomingRTPPktLinkrecvLast
 
uint8 minValidPacketSequence
 
uint16 maxPacketMisorder
 
uint16 maxPacketDropout
 
uint8 sourceExpirationPeriod
 
Mutex cryptoMutex
 
Mutex cryptoMutex
 
std::list< CryptoContext * > cryptoContexts
 
std::list< CryptoContext * > cryptoContexts
 
ConflictingTransportAddressfirstConflict
 
ConflictingTransportAddresslastConflict
 
std::list< TransportAddress * > destList
 
unsigned char * rtcpSendBuffer
 
unsigned char * rtcpRecvBuffer
 

Static Protected Attributes

static const uint8 defaultMinValidPacketSequence
 
static const uint16 defaultMaxPacketMisorder
 
static const uint16 defaultMaxPacketDropout
 
static const size_t defaultMembersSize
 
static const size_t defaultMembersHashSize
 
static const uint32 SEQNUMMOD
 

Private Member Functions

void init ()
 
size_t rtpDataPacket (unsigned char *packet, int32 rtn, InetHostAddress network_address, tpport_t transport_port)
 
virtual int32_t sendDataZRTP (const uint8_t *data, int32_t length)=0
 Send a ZRTP packet via RTP. More...
 

Private Attributes

ZRtpzrtpEngine
 
ZrtpUserCallbackzrtpUserCallback
 
std::string clientIdString
 
bool enableZrtp
 
int32 secureParts
 
int16 senderZrtpSeqNo
 
ost::Mutex synchLock
 
uint32 peerSSRC
 
bool started
 
bool mitmMode
 
bool signSas
 
bool enableParanoidMode
 

Friends

class TimeoutProvider< std::string, ost::ZrtpQueue * >
 

Detailed Description

GNU ccRTP extension to support GNU ZRTP.

ZRTP was developed by Phil Zimmermann and provides functions to negotiate keys and other necessary data (crypto data) to set-up the Secure RTP (SRTP) crypto context. Refer to Phil's ZRTP specification at his Zfone project site to get more detailed imformation about the capabilities of ZRTP.

Short overview of the ZRTP implementation

ZRTP is a specific protocol to negotiate encryption algorithms and the required key material. ZRTP uses a RTP session to exchange its protocol messages.

A complete GNU ZRTP implementation consists of two parts, the GNU ZRTP core and specific code that binds the GNU ZRTP core to the underlying RTP/SRTP stack and the operating system:

The GNU ZRTP core uses a callback interface class (refer to ZrtpCallback) to access RTP/SRTP or operating specific methods, for example to send data via the RTP/SRTP stack, to access timers, provide mutex handling, and to report events to the application.

The ZrtpQueue

ZrtpQueue implements code that is specific to the GNU ccRTP implementation. ZrtpQueue also implements the specific code to provide the mutex and timeout handling to the GNU ZRTP core. Both, the mutex and the timeout handling, use the GNU Common C++ library to stay independent of the operating seystem. For more information refer to the GNU Common C++ web site.

To perform its tasks ZrtpQueue

After instantiating a GNU ZRTP session (see below for a short example) applications may use the ZRTP specific methods of ZrtpQueue to control and setup GNU ZRTP, for example enable or disable ZRTP processing or getting ZRTP status information.

GNU ZRTP provides a ZrtpUserCallback class that an application may extend and register with ZrtpQueue. GNU ZRTP and ZrtpQueue use the ZrtpUserCallback methods to report ZRTP events to the application. The application may display this information to the user or act otherwise.

The following figure depicts the relationships between ZrtpQueue, ccRTP RTP/SRTP implementation, the GNU ZRTP core, and an application that provides an ZrtpUserCallback class.

                      +----------+
                      |  ccRTP   |
                      | RTP/SRTP |
                      |          |
                      +----------+
                           ^
                           | extends
                           |
+----------------+      +-----+------+
|  Application   |      |            |      +-----------------+
|  instantiates  | uses | ZrtpQueue  | uses |                 |
| a ZRTP Session +------+ implements +------+    GNU ZRTP     |
|  and provides  |      |ZrtpCallback|      |      core       |
|ZrtpUserCallback|      |            |      | implementation  |
+----------------+      +------------+      |  (ZRtp et al)   |
                                         |                 |
                                         +-----------------+

Because ZrtpQueue extends the ccRTP RTP/SRTP implementation (AVPQueue) all public methods defined by ccRTP are also available for a ZRTP session. ZrtpQueue overwrites some of the public methods of ccRTP (AVPQueue) to implement ZRTP specific code.

GNU ZRTP provides a SymmetricZRTPSession type to simplify its use. An application uses this type in the same way as it would use the normal ccRTP SymmetricRTPSession type. The following short code snippets show how an application could instantiate ccRTP and GNU ZRTP sessions. The first snippet shows how to instantiate a ccRTP session:

...
#include <ccrtp/rtp.h>
...
SymmetricRTPSession tx(pattern.getSsrc(),
InetHostAddress("localhost"));
...

The same code as above but using a GNU ZRTP session this time:

...
#include <libzrtpcpp/zrtpccrtp.h>
...
SymmetricZRTPSession tx(pattern.getSsrc(),
InetHostAddress("localhost"));
...

The only differences are the different include statements and the different session types.

The demo folder contains a small example that shows how to use GNU ZRTP.

Please refer to the GNU ccRTP documentation for a description of ccRTP methods and functions. This ZrtpQueue documentation shows the ZRTP specific extensions and describes overloaded methods and a possible different behaviour.

Author
Werner Dittmann Werne.nosp@m.r.Di.nosp@m.ttman.nosp@m.n@t-.nosp@m.onlin.nosp@m.e.de

Definition at line 187 of file ZrtpQueue.h.

Member Enumeration Documentation

anonymous enum
protectedinherited
Enumerator
defaultPathMTU 

Definition at line 333 of file rtcppkt.h.

enum RTPDataQueue::Tos
inherited

rtp.h cc++/rtp.h

Type of network service the application uses.

If the application uses enhanced network service, for instance Integrated Services or Differentiated Services, it has not to ensure fair competition with TCP, provided that the requested service is actually being delivered. Whenever the application uses best-effort service or the requested enhanced service is not actually being delivered, it has to ensure fair competition with TCP. By default, best-effot is assumed.

Note
Although not required, RTP packets are always sent on top of UDP segments. No other underlying transport protocol is supported at present.
Todo:
implement fair competition with tcp
Enumerator
tosBestEffort 

Best-effort network service.

tosEnhanced 

Enhanced network service.

Definition at line 101 of file ioqueue.h.

Constructor & Destructor Documentation

ZrtpQueue::ZrtpQueue ( uint32  size = RTPDataQueue::defaultMembersHashSize,
RTPApplication app = defaultApplication() 
)
protected
ZrtpQueue::ZrtpQueue ( uint32  ssrc,
uint32  size = RTPDataQueue::defaultMembersHashSize,
RTPApplication app = defaultApplication() 
)
protected

Local SSRC is given instead of computed by the queue.

virtual ZrtpQueue::~ZrtpQueue ( )
protectedvirtual

Member Function Documentation

void ZrtpQueue::acceptEnrollment ( bool  accepted)

Accept a PBX enrollment request.

If a PBX service asks to enroll the MiTM key and the user accepts this requtes, for example by pressing an OK button, the client application shall call this method and set the parameter accepted to true. If the user does not accept the request set the parameter to false.

Parameters
acceptedTrue if the enrollment request is accepted, false otherwise.
int32_t ZrtpQueue::activateTimer ( int32_t  time)
protectedvirtual

Activate timer.

Parameters
timeThe time in ms for the timer
Returns
zero if activation failed, one if timer was activated

Implements ZrtpCallback.

void ConflictHandler::addConflict ( const InetAddress na,
tpport_t  dtp,
tpport_t  ctp 
)
inherited
void OutgoingDataQueue::addContributor ( uint32  csrc)
inherited

Add csrc as the CSRC identifier of a new contributor.

This method adds the CSRC identifier to a list of contributors that will be inserted in every packet enqueued from now on.

bool OutgoingDataQueue::addDestination ( const InetHostAddress ia,
tpport_t  dataPort = DefaultRTPDataPort,
tpport_t  controlPort = 0 
)
inherited
bool OutgoingDataQueue::addDestination ( const InetMcastAddress ia,
tpport_t  dataPort = DefaultRTPDataPort,
tpport_t  controlPort = 0 
)
inherited
bool DestinationListHandler::addDestinationToList ( const InetAddress ia,
tpport_t  data,
tpport_t  control 
)
protectedinherited

Locks the object before modifying it.

void ApplicationHandler::addParticipant ( RTPApplication app,
Participant part 
)
inlineinherited

Definition at line 212 of file iqueue.h.

SyncSourcesIterator IncomingDataQueue::begin ( )
inlineinherited

Definition at line 938 of file iqueue.h.

bool MembershipBookkeeping::BYESource ( uint32  ssrc)
protectedinherited

Mark the source identified by ssrc as having sent a BYE packet.

It is not deleted until a timeout expires, so that in case some packets from this source arrive a bit later the source is not inserted again in the table of known sources.

Returns
true if the source had been previously identified. false if it was not in the table of known sources.
int32_t ZrtpQueue::cancelTimer ( )
protectedvirtual

Cancel the active timer.

Returns
zero if cancel action failed, one if timer was canceled

Implements ZrtpCallback.

bool RTCPCompoundHandler::checkCompoundRTCPHeader ( size_t  len)
protectedinherited

Perform RTCP compound packet header validity check as specified in draft-ietv-avt-rtp-new.

This method follows appendix A.2. Correct version, payload type, padding bit and length of every RTCP packet in the compound are verified.

Parameters
lenlength of the RTCP compound packet in the reception buffer
Returns
whether the header is valid.
bool ZrtpQueue::checkSASSignature ( uint8_t *  sasHash)
protectedvirtual

ZRTPQueue calls this method to request a SAS signature check.

After ZRTP received a SAS signature in one of the Confirm packets it call this method. The client may use getSignatureLength() and getSignatureData()of ZrtpQueue to get the signature data and perform the signature check. Refer to chapter 8.2 of ZRTP specification.

If the signature check fails the client may return false to ZRTP. In this case ZRTP signals an error to the other peer and terminates the ZRTP handshake.

Note: SAS signing is not yet fully supported by GNU ZRTP.

Parameters
sasHashThe SAS hash that was signed by the other peer.
Returns
true if the signature was ok, false otherwise.

Implements ZrtpCallback.

bool IncomingDataQueue::checkSSRCInIncomingRTPPkt ( SyncSourceLink sourceLink,
bool  is_new,
InetAddress na,
tpport_t  tp 
)
protectedinherited

Apply collision and loop detection and correction algorithm when receiving RTP data packets.

Follows section 8.2 in draft-ietf-avt-rtp-new.

Parameters
sourceLinklink to the source object.
is_newwhether the source has been just recorded.
nadata packet network address.
tpdata packet source transport port.
Returns
whether the packet must not be discarded.
bool QueueRTCPManager::checkSSRCInRTCPPkt ( SyncSourceLink sourceLink,
bool  is_new,
InetAddress na,
tpport_t  tp 
)
protectedinherited

Appy collision and loop detection and correction algorithm when receiving RTCP packets.

Follows section 8.2 in draft-ietf-avp-rtp-new.

Parameters
sourceLinklink to the source object.
is_newwhether the source has been just recorded.
naRTCP packet network address.
tpRTCP packet source transport port.
Returns
whether the packet must not be discarded.
void QueueRTCPManager::controlReceptionService ( )
protectedinherited

Process incoming RTCP packets pending in the control reception socket.

void QueueRTCPManager::controlTransmissionService ( )
protectedinherited

Build and send RTCP packets following timing rules (including the "timer reconsideration" algorithm).

void RTPDataQueue::disableStack ( )
inlineinherited

Disable packet queue processing in the stack.

Definition at line 132 of file ioqueue.h.

size_t QueueRTCPManager::dispatchBYE ( const std::string &  reason)
protectedvirtualinherited

This method is used to send an RTCP BYE packet.

An RTCP BYE packet is sent when one of the the following circumstances occur:

  • when leaving the session
  • when we have detected that another synchronization source in the same session is using the same SSRC identifier as us.

Try to post a BYE message. It will send a BYE packet as long as at least one RTP or RTCP packet has been sent before. If the number of members in the session is more than 50, the algorithm described in section 6.3.7 of RFC 3550 is applied in order to avoid a flood of BYE messages.

Parameters
reasonreason to specify in the BYE packet.

Reimplemented from RTPQueueBase.

size_t OutgoingDataQueue::dispatchDataPacket ( )
protectedinherited

This function is used by the service thread to process the next outgoing packet pending in the sending queue.

Returns
number of bytes sent. 0 if silent, <0 if error.
void OutgoingDataQueue::dispatchImmediate ( OutgoingRTPPkt packet)
protectedinherited

This is used to write the RTP data packet to one or more destinations.

It is used by both sendImmediate and by dispatchDataPacket.

Parameters
RTPpacket to send.
void RTPDataQueue::enableStack ( )
inlineinherited

Enable packet queue processing in the stack.

This method will not any thread of execution.

Definition at line 126 of file ioqueue.h.

SyncSourcesIterator IncomingDataQueue::end ( void  )
inlineinherited

Definition at line 941 of file iqueue.h.

void RTPDataQueue::endQueue ( )
protectedinherited

This method ends the queue.

void QueueRTCPManager::endQueueRTCPManager ( )
protectedinherited
bool OutgoingDataQueue::forgetDestination ( const InetHostAddress ia,
tpport_t  dataPort = DefaultRTPDataPort,
tpport_t  controlPort = 0 
)
inherited
bool OutgoingDataQueue::forgetDestination ( const InetMcastAddress ia,
tpport_t  dataPort = DefaultRTPDataPort,
tpport_t  controlPort = 0 
)
inherited
const RTPApplication& QueueRTCPManager::getApplication ( )
inlineprotectedinherited

Definition at line 193 of file cqueue.h.

float AVPQueue::getControlBandwidth ( ) const
inlineinherited

Definition at line 652 of file cqueue.h.

PayloadType RTPQueueBase::getCurrentPayloadType ( ) const
inlineinherited

Definition at line 201 of file queuebase.h.

uint32 RTPQueueBase::getCurrentRTPClockRate ( ) const
inlineinherited

Get the clock rate in RTP clock units (for instance, 8000 units per second for PCMU, or 90000 units per second for MP2T).

This value depends on what payload format has been selected using setPayloadFormat().

Returns
clock rate in RTP clock units.

Definition at line 198 of file queuebase.h.

uint32 OutgoingDataQueue::getCurrentSeqNum ( void  )
inlineprotectedinherited

Definition at line 525 of file oqueue.h.

uint32 RTPDataQueue::getCurrentTimestamp ( ) const
inherited

Get the timestamp that should be given for a packet whose payload sampling instant corresponds to the current system time.

The timestamp applications should provide for each packet represents the sampling instant of its payload and should not be a reading of the system clock. Nevertheless, the internal operation of the RTP stack relies on the accuracy of the provided timestamp, since several computations assume that there is a certain degree of correspondence between the timestamp and the system clock.

It is recommended that applications use this method in order to periodically adjust the RTP timestamp.

In particular, it is advisable getting the timestamp corresponding to the first sampling instant or any instant after a period of inactivity through a call to this method.

Applications should use the nominal sampling or any other value provided by the coder in order to compute the next timestamps with minimum computational requirement.

For instance, an application using an RTP profile that specifies a fixed sampling rate of 8 Khz with eight bits per sample, continuously transmitting audio blocks 80 octets long, would transmit 100 packets every second. Every packet would carry a timestamp 80 units greater than the previous one. So, the first timestamp would be obtained from this method, whereas the following ones would be computed adding 80 every time. Also the timestamp should be increased for every block whether it is put in the queue or dropped.

The aforementioned increment can be obtained from the RTPDataQueue::getTimestampIncrement() method rather than computing it by hand in the application.

Note
Frame based applications must follow a specific timestamping method, probably specified in a profile.
You should take into account that by default ccRTP assumes that the application begins sampling at the queue creation time. Moreover, the first sampling instant is assigned a "user visible" timestamp of 0, although the RTP stack will then add internally a ramdom offset unknown to the application. That is to say, the application may count samples from 0 in order to get the timestamp for the next packet, provided that the first sampling instant is the same as the queue creation time. Nevertheless, this simpler way of starting will not be as accurate as it would be if the application got at least the first timestamp through getCurrentTimestamp. We provide this option since ccRTP interface is evolving, but we admit that it is ugly, we could remove this option or even replace uint32 timestamps with a restrictively regulated object; suggestions are gladly welcomed
const AppDataUnit* IncomingDataQueue::getData ( uint32  stamp,
const SyncSource src = NULL 
)
inherited

Retreive data from a specific timestamped packet if such a packet is currently available in the receive buffer.

Parameters
stampData unit timestamp.
srcOptional synchronization source selector.
Returns
data retrieved from the reception buffer.
Return values
nullpointer if no packet with such timestamp is available.
microtimeout_t QueueRTCPManager::getDefaultEnd2EndDelay ( ) const
inlineinherited

Definition at line 137 of file cqueue.h.

microtimeout_t OutgoingDataQueue::getDefaultExpireTimeout ( ) const
inlineinherited

Definition at line 371 of file oqueue.h.

uint16 IncomingDataQueue::getDefaultMaxPacketDropout ( ) const
inlineinherited

Definition at line 1035 of file iqueue.h.

uint16 IncomingDataQueue::getDefaultMaxPacketMisorder ( ) const
inlineinherited

Definition at line 1018 of file iqueue.h.

size_t IncomingDataQueueBase::getDefaultMaxRecvPacketSize ( ) const
inlineinherited

Definition at line 301 of file queuebase.h.

size_t OutgoingDataQueueBase::getDefaultMaxSendSegmentSize ( )
inlineinherited

Definition at line 262 of file queuebase.h.

size_t MembershipBookkeeping::getDefaultMembersHashSize ( )
inlineinherited

Definition at line 309 of file iqueue.h.

static size_t IncomingDataQueue::getDefaultMembersSize ( )
inlinestaticinherited

Definition at line 1045 of file iqueue.h.

uint8 IncomingDataQueue::getDefaultMinValidPacketSequence ( ) const
inlineinherited

Definition at line 1002 of file iqueue.h.

microtimeout_t OutgoingDataQueue::getDefaultSchedulingTimeout ( ) const
inlineinherited

Definition at line 357 of file oqueue.h.

uint32 RTPDataQueue::getDefaultSessionBandwidth ( ) const
inlineinherited

Definition at line 218 of file ioqueue.h.

microtimeout_t QueueRTCPManager::getEnd2EndDelay ( ) const
inlineinherited

Definition at line 141 of file cqueue.h.

microtimeout_t OutgoingDataQueue::getExpireTimeout ( ) const
inlineinherited

Definition at line 385 of file oqueue.h.

SyncSourceLink* MembershipBookkeeping::getFirst ( void  )
inlineprotectedinherited

Definition at line 836 of file iqueue.h.

TransportAddress* DestinationListHandler::getFirstDestination ( ) const
inlineinherited

Definition at line 85 of file oqueue.h.

uint32 IncomingDataQueue::getFirstTimestamp ( const SyncSource src = NULL) const
inherited

Get timestamp of first packet waiting in the queue.

Parameters
srcoptional source selector.
Returns
timestamp of first arrival packet.
std::string ZrtpQueue::getHelloHash ( )

Get the ZRTP Hello Hash data.

Use this method to get the ZRTP Hello Hash data. The method returns the data as a string containing hex-digits. Refer to ZRTP specification, chapter 9.1.

Returns
a std:string containing the Hello hash value as hex-digits. The hello hash is available immediatly after calling ZrtpQueue::startZrtp. If ZRTP was not started the method returns an empty string.
timeval RTPQueueBase::getInitialTime ( ) const
inlineinherited

Definition at line 204 of file queuebase.h.

uint32 OutgoingDataQueue::getInitialTimestamp ( )
inlineprotectedinherited

Definition at line 537 of file oqueue.h.

CryptoContext* IncomingDataQueue::getInQueueCryptoContext ( uint32  ssrc)
inherited

Get an input queue CryptoContext identified by SSRC.

Parameters
ssrcRequest CryptoContext for this incoming SSRC
Returns
Pointer to CryptoContext of the SSRC of NULL if no context available for this SSRC.
SyncSourceLink* MembershipBookkeeping::getLast ( void  )
inlineprotectedinherited

Definition at line 839 of file iqueue.h.

uint32 QueueRTCPManager::getLastSendPacketCount ( ) const
inlineprotectedinherited

Get the number of data packets sent at the time the last SR was generated.

Definition at line 304 of file cqueue.h.

SyncSourceLink* MembershipBookkeeping::getLink ( const SyncSource source) const
inlineprotectedinherited

Definition at line 339 of file iqueue.h.

uint32 RTPQueueBase::getLocalSSRC ( ) const
inlineinherited

Definition at line 187 of file queuebase.h.

uint32 RTPQueueBase::getLocalSSRCNetwork ( ) const
inlineprotectedinherited

Definition at line 217 of file queuebase.h.

bool OutgoingDataQueue::getMark ( ) const
inlineinherited

Get wheter the mark bit will be set in the next packet.

Definition at line 340 of file oqueue.h.

uint16 IncomingDataQueue::getMaxPacketDropout ( ) const
inlineinherited

Definition at line 1039 of file iqueue.h.

uint16 IncomingDataQueue::getMaxPacketMisorder ( ) const
inlineinherited

Definition at line 1022 of file iqueue.h.

size_t IncomingDataQueueBase::getMaxRecvPacketSize ( ) const
inlineinherited

Definition at line 305 of file queuebase.h.

size_t OutgoingDataQueueBase::getMaxSendSegmentSize ( )
inlineinherited

Definition at line 276 of file queuebase.h.

uint32 MembershipBookkeeping::getMembersCount ( )
inlineprotectedinherited

Definition at line 843 of file iqueue.h.

uint8 IncomingDataQueue::getMinValidPacketSequence ( ) const
inlineinherited

Get the minimun number of consecutive packets that must be received from a source before accepting its data packets.

Definition at line 1010 of file iqueue.h.

RTCPReceiverInfo* QueueRTCPManager::getMRReceiverInfo ( SyncSource srcFrom)
inherited

Ask for the info in the most recent receiver report about the local source received from the source given as parameter.

Parameters
srcFromSource of the receiver info.
Returns
most recent receiver info received from src.
Return values
NULLwhen no receiver report has been received from the specified source.
RTCPSenderInfo* QueueRTCPManager::getMRSenderInfo ( SyncSource src)
inherited

Get the most recent sender report received from a synchronization source.

Parameters
srcSynchronization source of the sender info.
Returns
Most recent sender info received from src.
Return values
NULLwhen no sender report has been received from the specified source.
std::string ZrtpQueue::getMultiStrParams ( )

Get Multi-stream parameters.

Use this method to get the Multi-stream that were computed during the ZRTP handshake. An application may use these parameters to enable multi-stream processing for an associated SRTP session.

Refer to chapter 5.4.2 in the ZRTP specification for further details and restriction how and when to use multi-stream mode.

Returns
a string that contains the multi-stream parameters. The application must not modify the contents of this string, it is opaque data. The application may hand over this string to a new ZrtpQueue instance to enable multi-stream processing for this ZrtpQueue. If ZRTP was not started or ZRTP is not yet in secure state the method returns an empty string.
See Also
setMultiStrParams()
virtual size_t IncomingDataQueue::getNextDataPacketSize ( ) const
protectedpure virtualinherited

Implemented in RTPDuplex.

CryptoContext* OutgoingDataQueue::getOutQueueCryptoContext ( uint32  ssrc)
inherited

Get an output queue CryptoContext identified by SSRC.

Parameters
ssrcRequest CryptoContext for this incoming SSRC
Returns
Pointer to CryptoContext of the SSRC of NULL if no context available for this SSRC.
uint16 RTCPCompoundHandler::getPathMTU ( )
inlineinherited

Definition at line 98 of file rtcppkt.h.

std::string ZrtpQueue::getPeerHelloHash ( )

Get the peer's ZRTP Hello Hash data.

Use this method to get the peer's ZRTP Hello Hash data. The method returns the data as a string containing the ZRTP protocol version and hex-digits.

The peer's hello hash is available only after ZRTP received a hello. If no data is available the function returns an empty string.

Refer to ZRTP specification, chapter 8.

Returns
a std:string containing the Hello version and the hello hash as hex digits.
int32 ZrtpQueue::getPeerZid ( uint8 *  data)

Get other party's ZID (ZRTP Identifier) data.

This functions returns the other party's ZID that was receivied during ZRTP processing.

The ZID data can be retrieved after ZRTP receive the first Hello packet from the other party. The application may call this method for example during SAS processing in showSAS(...) user callback method.

Parameters
dataPointer to a data buffer. This buffer must have a size of at least 12 bytes (96 bit) (ZRTP Identifier, see chap. 4.9)
Returns
Number of bytes copied into the data buffer - must be equivalent to 96 bit, usually 12 bytes.
uint32 QueueRTCPManager::getPrevMembersCount ( ) const
inlineprotectedinherited

Definition at line 315 of file cqueue.h.

timeval QueueRTCPManager::getRTCPCheckInterval ( )
inlineprotectedinherited

Definition at line 296 of file cqueue.h.

uint8_t* ZrtpQueue::getSasHash ( )

Get the computed SAS hash for this ZRTP session.

A PBX ZRTP back-to-Back function uses this function to get the SAS hash of an enrolled client to construct the SAS relay packet for the other client.

Returns
a refernce to the byte array that contains the full SAS hash.
std::string ZrtpQueue::getSasType ( )

Get the commited SAS rendering algorithm for this ZRTP session.

Returns
the commited SAS rendering algorithm
microtimeout_t OutgoingDataQueue::getSchedulingTimeout ( )
protectedinherited

This computes the timeout period for scheduling transmission of the next packet at the "head" of the send buffer.

If no packets are waiting, a default timeout is used. This actually forms the "isPending()" timeout of the rtp receiver in the service thread.

Returns
timeout until next packet is scheduled to send.
uint32 MembershipBookkeeping::getSendersCount ( )
inlineprotectedinherited

Definition at line 851 of file iqueue.h.

uint32 OutgoingDataQueue::getSendOctetCount ( ) const
inlineinherited

Get the total number of octets (payload only) sent so far.

Returns
total number of payload octets sent in RTP packets.

Definition at line 403 of file oqueue.h.

uint32 OutgoingDataQueue::getSendPacketCount ( ) const
inlineinherited

Get the total number of packets sent so far.

Returns
total number of packets sent

Definition at line 394 of file oqueue.h.

uint32 QueueRTCPManager::getSendRTCPPacketCount ( ) const
inlineinherited

Get the total number of RTCP packets sent until now.

Definition at line 178 of file cqueue.h.

uint16 OutgoingDataQueue::getSequenceNumber ( ) const
inlineinherited

Get the sequence number of the next outgoing packet.

Returns
the 16 bit sequence number.

Definition at line 412 of file oqueue.h.

uint32 RTPDataQueue::getSessionBandwidth ( ) const
inlineinherited

Definition at line 222 of file ioqueue.h.

const uint8* ZrtpQueue::getSignatureData ( )

Get signature data.

This functions returns signature data that was receivied during ZRTP processing. Refer to chapters 6.7 and 8.2.

Returns
Pointer to signature data. This is a pointer to volatile data that is only valid during the checkSASSignature() callback. The application shall copy the data if necessary.
int32 ZrtpQueue::getSignatureLength ( )

Get length of signature data.

This functions returns the length of signature data that was receivied during ZRTP processing. Refer to chapters 6.7 and 8.2.

Returns
Length in bytes of the received signature data. The method returns zero if no signature data avilable.
SyncSourceLink* MembershipBookkeeping::getSourceBySSRC ( uint32  ssrc,
bool &  created 
)
protectedinherited

Get the description of a source by its ssrc identifier.

Parameters
ssrcSSRC identifier, in host order.
createdwhether a new source has been created.
Returns
Pointer to the SyncSource object identified by ssrc.
timeout_t RTPDataQueue::getTimeclock ( ) const
inlineinherited

Get the packet timeclock for synchronizing timestamps.

Returns
runtime in milliseconds since last set.

Definition at line 238 of file ioqueue.h.

IncomingDataQueue::IncomingRTPPktLink* IncomingDataQueue::getWaiting ( uint32  timestamp,
const SyncSource src = NULL 
)
protectedinherited

This is used to fetch a packet in the receive queue and to expire packets older than the current timestamp.

Returns
packet buffer object for current timestamp if found.
Parameters
timestamptimestamp requested.
srcoptional source selector
Note
if found, the packet is removed from the reception queue
void ZrtpQueue::goClearOk ( )

To confirm a go clear request.

Call this method if the user confirmed a go clear (secure mode off).

void ZrtpQueue::handleGoClear ( )
protectedvirtual

This method handles GoClear requests.

According to the ZRTP specification the user must be informed about a GoClear request because the ZRTP implementation switches off security if it could authenticate the GoClear packet.

Note: GoClear is not yet implemented in GNU ZRTP.

Implements ZrtpCallback.

void ZrtpQueue::handleTimeout ( const std::string &  c)
protected

Handle timeout event forwarded by the TimeoutProvider.

Just call the ZRTP engine for further processing.

void ZrtpQueue::init ( )
private
int32_t ZrtpQueue::initialize ( const char *  zidFilename,
bool  autoEnable = true,
ZrtpConfigure config = NULL 
)

Initialize the ZrtpQueue.

Before an application can use ZRTP it has to initialize the ZRTP implementation. This method initializes the timeout thread and opens a file that contains ZRTP specific information such as the applications ZID (ZRTP id) and its retained shared secrets.

If one application requires several ZRTP sessions all sessions use the same timeout thread and use the same ZID file. Therefore an application does not need to do any synchronisation regading ZID files or timeouts. This is managed by the ZRTP implementation.

The current implementation of ZrtpQueue does not support different ZID files for one application instance. This restriction may be removed in later versions.

The application may specify its own ZID file name. If no ZID file name is specified it defaults to $HOME/.GNUccRTP.zid if the HOME environment variable is set. If it is not set the current directory is used.

If the method could set up the timeout thread and open the ZID file then it enables ZRTP processing and returns.

Parameters
zidFilenameThe name of the ZID file, can be a relative or absolut filename.
autoEnableif set to true the method automatically sets enableZrtp to true. This enables the ZRTP auto-sense mode. Default is true.
configthis parameter points to ZRTP configuration data. If it is NULL then ZrtpQueue uses a default setting. Default is NULL.
Returns
1 on success, ZRTP processing enabled, -1 on failure, ZRTP processing disabled.
bool IncomingDataQueue::insertRecvPacket ( IncomingRTPPktLink packetLink)
protectedinherited

Insert a just received packet in the queue (both general and source specific queues).

If the packet was already in the queue (same SSRC and sequence number), it is not inserted but deleted.

Parameters
packetLinklink to a packet just received and generally validated and processed by onRTPPacketRecv.
Returns
whether the packet was successfully inserted.
Return values
falsewhen the packet is duplicated (there is already a packet from the same source with the same timestamp).
truewhen the packet is not duplicated.
bool RTPDataQueue::isActive ( void  ) const
inlineinherited

Get active connection state flag.

Returns
true if connection "active".

Definition at line 141 of file ioqueue.h.

bool ZrtpQueue::isEnableZrtp ( )

Return the state of ZRTP enable state.

Returns
true if ZRTP processing is enabled, false otherwise.
bool ZrtpQueue::isEnrollmentMode ( )

Check the state of the enrollment mode.

If true then we will set the enrollment flag (E) in the confirm packets and performs the enrollment actions. A MitM (PBX) enrollment service sets this flagstarted this ZRTP session. Can be set to true only if mitmMode is also true.

Returns
status of the enrollmentMode flag.
bool MembershipBookkeeping::isMine ( const SyncSource source) const
inlineprotectedinherited

Get whether a synchronization source is recorded in this membership controller.

Definition at line 345 of file iqueue.h.

bool ZrtpQueue::isMitmMode ( )

Check the state of the MitM mode flag.

If true then this ZRTP session acts as MitM, usually enabled by a PBX client (user agent)

Returns
state of mitmMode
bool ZrtpQueue::isMultiStream ( )

Check if this ZRTP use Multi-stream.

Use this method to check if this ZRTP instance uses multi-stream. Even if the application provided multi-stram parameters it may happen that full DH mode was used. Refer to chapters 5.2 and 5.4.2 in the ZRTP # when this may happen.

Returns
True if multi-stream is used, false otherwise.
bool ZrtpQueue::isMultiStreamAvailable ( )

Check if the other ZRTP client supports Multi-stream.

Use this method to check if the other ZRTP client supports Multi-stream mode.

Returns
True if multi-stream is available, false otherwise.
bool ZrtpQueue::isParanoidMode ( )

Check status of paranoid mode.

Returns
Returns true if paranoid mode is enabled.
bool ZrtpQueue::isPeerEnrolled ( )

Check if a peer's cache entry has a vaild MitM key.

If true then the other peer ha a valid MtiM key, i.e. the peer has performed the enrollment procedure. A PBX ZRTP Back-2-Back application can use this function to check which of the peers is enrolled.

Returns
True if the other peer has a valid Mitm key (is enrolled).
virtual bool RTPDataQueue::isPendingData ( microtimeout_t  timeout)
protectedpure virtualinherited

This function is used to check for and schedule against arriving packets based on the derived connection type.

Returns
true if packet waiting for processing.
Parameters
numberof microseconds to wait.

Implemented in RTPDuplex.

bool MembershipBookkeeping::isRegistered ( uint32  ssrc)
protectedinherited

Returns whether there is already a synchronizacion source with "ssrc" SSRC identifier.

bool OutgoingDataQueue::isSending ( ) const
inherited

Determine if outgoing packets are waiting to send.

Returns
true if there are packets waiting to be send.
bool DestinationListHandler::isSingleDestination ( ) const
inlineinherited

Get whether there is only a destination in the list.

Definition at line 82 of file oqueue.h.

bool IncomingDataQueue::isWaiting ( const SyncSource src = NULL) const
inherited

Determine if packets are waiting in the reception queue.

Parameters
srcOptional synchronization source selector.
Returns
True if packets are waiting.
void DestinationListHandler::lockDestinationList ( ) const
inlineinherited

Definition at line 88 of file oqueue.h.

virtual void IncomingDataQueue::onExpireRecv ( IncomingRTPPkt )
inlineprotectedvirtualinherited

A hook to filter packets in the receive queue that are being expired.

This hook may be used to do some application specific processing on expired packets before they are deleted.

Parameters
-packet expired from the recv queue.

Definition at line 1217 of file iqueue.h.

virtual void QueueRTCPManager::onGotAPP ( SyncSource ,
RTCPCompoundHandler::APPPacket ,
size_t   
)
inlineprotectedvirtualinherited

Plug-in for handling of APP (application specific) RTCP packets.

Parameters
-Synchronization source of this packet.
-RTCP APP packet struct.
-Length of the app data packet, including ssrc. name and app. specific data.

Definition at line 291 of file cqueue.h.

virtual void QueueRTCPManager::onGotRR ( SyncSource source,
RecvReport RR,
uint8  blocks 
)
protectedvirtualinherited

Plug-in for processing (acquire information carried in) an incoming RTCP Receiver Report.

The default implementation in this class only processes the receiver report blocks about the local source.

Parameters
sourceSynchronization source this report comes from.
RRReceiver report structure
blocksNumber of report blocks in the packet
bool QueueRTCPManager::onGotSDES ( SyncSource source,
RTCPPacket pkt 
)
protectedinherited
Parameters
sourceSynchronization source of SDES RTCP packet.
pktSDES RTCP packet received.
virtual bool QueueRTCPManager::onGotSDESChunk ( SyncSource source,
SDESChunk chunk,
size_t  len 
)
protectedvirtualinherited

Plug-in for handling of SDES chunks.

Parameters
sourceSynchronization source of SDES chunk.
chunkSDES chunk structure.
lenLength of chunk, in octets.
Returns
whether there was a CNAME.
virtual void QueueRTCPManager::onGotSR ( SyncSource source,
SendReport SR,
uint8  blocks 
)
protectedvirtualinherited

Plug-in for processing (acquire information carried in) an incoming RTCP Sender Report.

The default implementation in this class only processes the sender information and the receiver report blocks about the local source.

Parameters
sourceSynchronization source this report comes from.
SRSender report structure.
blocksNumber of report blocks in the packet.
virtual void IncomingDataQueue::onNewSyncSource ( const SyncSource )
inlineprotectedvirtualinherited

Virtual called when a new synchronization source has joined the session.

Parameters
-new synchronization source

Definition at line 1185 of file iqueue.h.

virtual bool IncomingDataQueue::onRTPPacketRecv ( IncomingRTPPkt )
inlineprotectedvirtualinherited

A virtual function to support parsing of arriving packets to determine if they should be kept in the queue and to dispatch events.

A generic header validity check (as specified in RFC 1889) is performed on every incoming packet. If the generic check completes succesfully, this method is called before the packet is actually inserted into the reception queue.

May be used to perform additional validity checks or to do some application specific processing.

Parameters
-packet just received.
Returns
true if packet is kept in the incoming packets queue.

Definition at line 1206 of file iqueue.h.

virtual bool ZrtpQueue::onSRTPPacketError ( IncomingRTPPkt pkt,
int32  errorCode 
)
protectedvirtual

A hook that gets called if the decoding of an incoming SRTP was erroneous.

Parameters
pktThe SRTP packet with error.
errorCodeThe error code: -1 - SRTP authentication failure, -2 - replay check failed
Returns
True: put the packet in incoming queue for further processing by the applications; false: dismiss packet. The default implementation returns false.

Reimplemented from IncomingDataQueue.

void IncomingDataQueue::purgeIncomingQueue ( )
protectedinherited
void OutgoingDataQueue::purgeOutgoingQueue ( )
protectedinherited
void ZrtpQueue::putData ( uint32  stamp,
const unsigned char *  data = NULL,
size_t  len = 0 
)

Put data into the RTP output queue.

This is used to create a data packet in the send queue. Sometimes a "NULL" or empty packet will be used instead, and these are known as "silent" packets. "Silent" packets are used simply to "push" the scheduler along more accurately by giving the appearence that a next packet is waiting to be sent and to provide a valid timestamp for that packet.

This method overrides the same method in OutgoingDataQueue class. During ZRTP processing it may be necessary to control the flow of outgoing RTP payload packets (GoClear processing).

Parameters
stampTimestamp for expected send time of packet.
dataValue or NULL if special "silent" packet.
lenMay be 0 to indicate a default by payload type.
void IncomingDataQueue::recordExtraction ( const IncomingRTPPkt pkt)
protectedinherited

Log extraction of a packet from this source from the scheduled reception queue.

Parameters
pktPacket extracted from the queue.
bool IncomingDataQueue::recordReception ( SyncSourceLink srcLink,
const IncomingRTPPkt pkt,
const timeval  recvtime 
)
protectedinherited

Log reception of a new RTP packet from this source.

Usually updates data such as the packet counter, the expected sequence number for the next packet and the time the last packet was received at.

Parameters
srcLinkLink structure for the synchronization source of this packet.
pktPacket just created and to be logged.
recvtimeReception time.
Returns
whether, according to the source state and statistics, the packet is considered valid and must be inserted in the incoming packets queue.
virtual size_t IncomingDataQueue::recvData ( unsigned char *  buffer,
size_t  length,
InetHostAddress host,
tpport_t port 
)
protectedpure virtualinherited

This function performs the physical I/O for reading a packet from the source.

It is a virtual that is overriden in the derived class.

Returns
number of bytes read.
Parameters
bufferof read packet.
lengthof data to read.
hostaddress of source.
portnumber of source.

Implemented in RTPDuplex.

bool OutgoingDataQueue::removeContributor ( uint32  csrc)
inherited

Remove CSRC from the list of contributors.

bool DestinationListHandler::removeDestinationFromList ( const InetAddress ia,
tpport_t  dataPort,
tpport_t  controlPort 
)
protectedinherited

Locks the object before modifying it.

void IncomingDataQueue::removeInQueueCryptoContext ( CryptoContext cc)
inherited

Remove input queue CryptoContext.

The endQueue method (provided by RTPQueue) also deletes all registered CryptoContexts.

Parameters
ccPointer to initialized CryptoContext to remove. If pointer if NULL then delete the whole queue
void OutgoingDataQueue::removeOutQueueCryptoContext ( CryptoContext cc)
inherited

Remove output queue CryptoContext.

The endQueue method (provided by RTPQueue) also deletes all registered CryptoContexts.

Parameters
ccPointer to initialized CryptoContext to remove.
void ApplicationHandler::removeParticipant ( RTPApplication app,
RTPApplication::ParticipantLink pl 
)
inlineinherited

Definition at line 216 of file iqueue.h.

bool MembershipBookkeeping::removeSource ( uint32  ssrc)
protectedinherited

Remove the description of the source identified by ssrc

Returns
whether the source has been actually removed or it did not exist.
void RTPDataQueue::renewLocalSSRC ( )
inlineprotectedvirtualinherited

Reimplemented from RTPQueueBase.

Definition at line 284 of file ioqueue.h.

void ZrtpQueue::requestGoClear ( )

Request to switch off secure mode.

Call this method is the user itself wants to switch off secure mode (go clear). After sending the "go clear" request to the peer ZRTP immediatly switch off SRTP processing. Every RTP data is sent in clear after the go clear request.

void ZrtpQueue::resetSASVerified ( )

Reset the SAS verfied flag for the current user's retained secrets.

size_t ZrtpQueue::rtpDataPacket ( unsigned char *  packet,
int32  rtn,
InetHostAddress  network_address,
tpport_t  transport_port 
)
private
void ZrtpQueue::SASVerified ( )

Set SAS as verified.

The application may call this method if the user confirmed (verfied) the Short Authentication String (SAS) with the peer.

ZRTP calls ZrtpUserCallback::showSAS after it computed the SAS and the application registered a user callback class. The application should display the SAS and provide a mechanism at the user interface that enables the user to confirm the SAS.

ZRTP remembers the SAS confirmation status together with the retained secrets data. If both parties confirmed the SAS then ZRTP informs the application about this status on the next ZRTP session.

For more detailed information regarding SAS please refer to the ZRTP specification, chapter 8.

ConflictingTransportAddress* ConflictHandler::searchControlConflict ( InetAddress  na,
tpport_t  ctp 
)
inherited
Parameters
naInet network address.
ctpData transport port.
ConflictingTransportAddress* ConflictHandler::searchDataConflict ( InetAddress  na,
tpport_t  dtp 
)
inherited
Parameters
naInet network address.
dtpData transport port.
size_t QueueRTCPManager::sendControlToDestinations ( unsigned char *  buffer,
size_t  len 
)
protectedinherited
virtual int32_t ZrtpCallback::sendDataZRTP ( const uint8_t *  data,
int32_t  length 
)
protectedpure virtualinherited

Send a ZRTP packet via RTP.

ZRTP calls this method to send a ZRTP packet via the RTP session.

Parameters
dataPoints to ZRTP packet to send.
lengthThe length in bytes of the data
Returns
zero if sending failed, one if packet was send
int32_t ZrtpQueue::sendDataZRTP ( const unsigned char *  data,
int32_t  length 
)
protected
void ZrtpQueue::sendImmediate ( uint32  stamp,
const unsigned char *  data = NULL,
size_t  len = 0 
)

Immediatly send a data packet.

This is used to create a data packet and send it immediately. Sometimes a "NULL" or empty packet will be used instead, and these are known as "silent" packets. "Silent" packets are used simply to "push" the scheduler along more accurately by giving the appearence that a next packet is waiting to be sent and to provide a valid timestamp for that packet.

This method overrides the same method in OutgoingDataQueue class. During ZRTP processing it may be necessary to control the flow of outgoing RTP payload packets (GoClear processing).

Parameters
stampTimestamp immediate send time of packet.
dataValue or NULL if special "silent" packet.
lenMay be 0 to indicate a default by payload type.
void ZrtpQueue::sendInfo ( GnuZrtpCodes::MessageSeverity  severity,
int32_t  subCode 
)
protectedvirtual

Send information messages to the hosting environment.

The ZRTP implementation uses this method to send information messages to the host. Along with the message ZRTP provides a severity indicator that defines: Info, Warning, Error, Alert. Refer to the MessageSeverity enum above.

Parameters
severityThis defines the message's severity
subCodeThe subcode identifying the reason.
See Also
ZrtpCodes::MessageSeverity

Implements ZrtpCallback.

bool ZrtpQueue::sendSASRelayPacket ( uint8_t *  sh,
std::string  render 
)

Send the SAS relay packet.

The method creates and sends a SAS relay packet according to the ZRTP specifications. Usually only a MitM capable user agent (PBX) uses this function.

Parameters
shthe full SAS hash value
renderthe SAS rendering algorithm
void ZrtpQueue::setAuxSecret ( uint8_t *  data,
int32_t  length 
)

Set the auxilliary secret.

Use this method to set the srtps secret data. Refer to ZRTP specification, chapter 5.3 ff

Parameters
dataPoints to the auxilliary secret data.
lengthLength of the auxilliary secrect in bytes
void ZrtpQueue::setClientId ( std::string  id)

Set the client ID for ZRTP Hello message.

The GNU ccRTP client may set its id to identify itself in the ZRTP Hello message. The maximum length is 16 characters. A shorter id string is possible, it will be filled with blanks. A longer id string will be truncated to 16 characters. The standard client id is 'GNU ccRTP ZRTP ' (without the quotes).

Setting the client's id must be done before calling ZrtpQueue::initialize() or ZrtpQueue::startZrtp() .

Parameters
idThe client's id string
void AVPQueue::setControlBandwidth ( float  fraction)
inlineinherited

Specify the bandwith available for control (RTCP) packets.

This method sets the global control bandwidth for both sender and receiver reports. As recommended in RFC 1890, 1/4 of the total control bandwidth is dedicated to senders, whereas 3/4 are dedicated to receivers.

Parameters
fractionfraction of the session bandwidth, between 0 and 1
Note
If this method is not called, it is assumed that the control bandwidth is equal to 5% of the session bandwidth. Note also that the RFC RECOMMENDS the 5%.

Definition at line 648 of file cqueue.h.

virtual void OutgoingDataQueue::setControlPeer ( const InetAddress host,
tpport_t  port 
)
inlineprotectedvirtualinherited

Reimplemented in RTPDuplex.

Definition at line 543 of file oqueue.h.

void SyncSourceHandler::setControlTransportPort ( SyncSource source,
tpport_t  p 
)
inlineinherited

Definition at line 161 of file iqueue.h.

void SyncSourceHandler::setDataTransportPort ( SyncSource source,
tpport_t  p 
)
inlineinherited

Definition at line 157 of file iqueue.h.

void ZrtpQueue::setEnableZrtp ( bool  onOff)

Enable or disable ZRTP processing.

Call this method to enable or disable ZRTP processing after calling initialize(). This can be done before using a RTP session or at any time during a RTP session.

Existing SRTP sessions or currently active ZRTP processing will not be stopped or disconnected.

If the application enables ZRTP then:

  • ZrtpQueue starts to send ZRTP Hello packets after at least one RTP packet was sent and received on the associated RTP session. Thus if an application enables ZRTP and ZrtpQueue detects traffic on the RTP session then ZrtpQueue automatically starts the ZRTP protocol. This automatic start is convenient for applications that negotiate RTP parameters and set up RTP sessions but the actual RTP traffic starts some time later.
  • ZrtpQueue analyses incoming packets to detect ZRTP messages. If ZRTP was started, either via automatic start (see above) or explicitly via startZrtp(), then ZrtpQueue forwards ZRTP packets to the GNU ZRTP core.
Parameters
onOfftrue to enable ZRTP, false to disable ZRTP
void QueueRTCPManager::setEnd2EndDelay ( microtimeout_t  t)
inlineinherited

This method sets the maximum end to end delay allowed.

If the processing delay plus the trip time for a packet is greater than the end to end delay, the packet is discarded, and the application cannot get it.

This is a way of setting an upper bound to the end to end delay, computed as the elapsed time between the packet timestamping at the sender side, and the picking of the packet at the receiver side.

Parameters
tmaximum end to end delay allowed. A value of 0 implies there is no limit and is the default

Definition at line 133 of file cqueue.h.

void ZrtpQueue::setEnrollmentMode ( bool  enrollmentMode)

Check the state of the enrollment mode.

If true then we will set the enrollment flag (E) in the confirm packets and perform the enrollment actions. A MitM (PBX) enrollment service must sets this mode to true.

Can be set to true only if mitmMode is also true.

Parameters
enrollmentModedefines the new state of the enrollmentMode flag
void OutgoingDataQueue::setExpireTimeout ( microtimeout_t  to)
inlineinherited

Set the "expired" timer for expiring packets pending in the send queue which have gone unsent and are already "too late" to be sent now.

Parameters
totimeout to expire unsent packets in milliseconds.

Definition at line 382 of file oqueue.h.

void OutgoingDataQueue::setInitialTimestamp ( uint32  ts)
inlineprotectedinherited

Definition at line 531 of file oqueue.h.

void IncomingDataQueue::setInQueueCryptoContext ( CryptoContext cc)
inherited

Set input queue CryptoContext.

The endQueue method (provided by RTPQueue) deletes all registered CryptoContexts.

Parameters
ccPointer to initialized CryptoContext.
void QueueRTCPManager::setLeavingDelay ( microtimeout_t  delay)
inlineinherited

Set how much time the stack will wait before deleting a synchronization source that has sent an RTCP BYE packet.

Parameters
delaydelay in microseconds.
Note
The default delay is 1000000 microseconds

Definition at line 115 of file cqueue.h.

void SyncSourceHandler::setLink ( SyncSource source,
void *  link 
)
inlineinherited

Definition at line 141 of file iqueue.h.

void RTPQueueBase::setLocalSSRC ( uint32  ssrc)
inlineprotectedinherited

Definition at line 214 of file queuebase.h.

void OutgoingDataQueue::setMark ( bool  mark)
inlineinherited

Set marker bit for the packet in which the next data provided will be send.

When transmitting audio, should be set for the first packet of a talk spurt. When transmitting video, should be set for the last packet for a video frame.

Parameters
markMarker bit value for next packet.

Definition at line 334 of file oqueue.h.

void IncomingDataQueue::setMaxPacketDropout ( uint16  packets)
inlineinherited

It also prevents packets sent after a restart of the source being immediately accepted.

Definition at line 1031 of file iqueue.h.

void IncomingDataQueue::setMaxPacketMisorder ( uint16  packets)
inlineinherited

Definition at line 1014 of file iqueue.h.

void IncomingDataQueueBase::setMaxRecvPacketSize ( size_t  maxsize)
inlineinherited
Parameters
maxsizemaximum length of received RTP data packets, in octets. Defaults to the value returned by getDefaultMaxRecvPacketSize().
Note
This method sets a filter for incoming packets. Setting higher values does not necessarily imply higher memory usage (this method does not set any buffer size).

Definition at line 319 of file queuebase.h.

void OutgoingDataQueueBase::setMaxSendSegmentSize ( size_t  size)
inlineinherited

Set maximum payload segment size before fragmenting sends.

Parameters
sizeMaximum payload size.
Returns
Whether segment size was successfully set.

Definition at line 272 of file queuebase.h.

void MembershipBookkeeping::setMembersCount ( uint32  n)
inlineprotectedinherited

Definition at line 847 of file iqueue.h.

void QueueRTCPManager::setMinRTCPInterval ( microtimeout_t  interval)
inlineinherited

Manually set the minimum interval for sending RTP compound packets.

Parameters
intervalminimum interval between RTCP packets, in microseconds.
See Also
computeRTCPInterval()

Definition at line 171 of file cqueue.h.

void IncomingDataQueue::setMinValidPacketSequence ( uint8  packets)
inlineinherited

When receiving packets from a new source, it may be convenient to reject a first few packets before we are really sure the source is valid.

This method sets how many data packets must be received in sequence before the source is considered valid and the stack starts to accept its packets.

Note
the default (see defaultMinValidPacketSequence()) value for this parameter is 0, so that no packets are rejected (data packets are accepted from the first one).
this validation is performed after the generic header validation and the additional validation done in onRTPPacketRecv().
if any valid RTCP packet is received from this source, it will be immediatly considered valid regardless of the number of sequential data packets received.
Parameters
packetsnumber of sequential packet required

Definition at line 998 of file iqueue.h.

void ZrtpQueue::setMitmMode ( bool  mitmMode)

Set the state of the MitM mode flag.

If MitM mode is set to true this ZRTP session acts as MitM, usually enabled by a PBX client (user agent).

Parameters
mitmModedefines the new state of the mitmMode flag
void ZrtpQueue::setMultiStrParams ( std::string  parameters)

Set Multi-stream parameters.

Use this method to set the parameters required to enable Multi-stream processing of ZRTP. The multi-stream parameters must be set before the application starts the ZRTP protocol engine.

Refer to chapter 5.4.2 in the ZRTP specification for further details of multi-stream mode.

Parameters
parametersA string that contains the multi-stream parameters that this new ZrtpQueue instanace shall use.
See Also
getMultiStrParams()
void SyncSourceHandler::setNetworkAddress ( SyncSource source,
InetAddress  addr 
)
inlineinherited

Definition at line 165 of file iqueue.h.

void OutgoingDataQueue::setNextSeqNum ( uint32  seqNum)
inlineprotectedinherited

For thoses cases in which the application requires a method to set the sequence number for the outgoing stream (such as for implementing the RTSP PLAY command).

Parameters
seqNumnext sequence number to be used for outgoing packets.

Definition at line 521 of file oqueue.h.

void OutgoingDataQueue::setOutQueueCryptoContext ( CryptoContext cc)
inherited

Set ouput queue CryptoContext.

The endQueue method (provided by RTPQueue) deletes all registered CryptoContexts.

Parameters
ccPointer to initialized CryptoContext.
void OutgoingDataQueue::setPadding ( uint8  paddinglen)
inlineinherited

Set padding.

All outgoing packets will be transparently padded to a multiple of paddinglen.

Parameters
paddinglenpad packets to a length multiple of paddinglen.

Definition at line 323 of file oqueue.h.

void ZrtpQueue::setParanoidMode ( bool  yesNo)

Enable or disable paranoid mode.

The Paranoid mode controls the behaviour and handling of the SAS verify flag. If Panaoid mode is set to flase then ZRtp applies the normal handling. If Paranoid mode is set to true then the handling is:

  • always set the SAS verify flag to false at srtpSecretsOn() callback. The user interface (UI) must show SAS not verified. See implementation note below.
  • don't set the SAS verify flag in the Confirm packets, thus forcing the other peer to report SAS not verified.
  • ignore the SASVerified() function, thus do not set the SAS verified flag in the ZRTP cache.
  • Disable the Trusted PBX MitM feature. Just send the SASRelay packet but do not process the relayed data. This protects the user from a malicious "trusted PBX".

ZRtp performs alls other steps during the ZRTP negotiations as usual, in particular it computes, compares, uses, and stores the retained secrets. This avoids unnecessary warning messages. The user may enable or disable the Paranoid mode on a call-by-call basis without breaking the key continuity data.

Implementation note:
An application shall always display the SAS if the SAS verify flag is false. The application shall remind the user to compare the SAS code, for example using larger fonts, different colours and other display features.

size_t OutgoingDataQueue::setPartial ( uint32  timestamp,
unsigned char *  data,
size_t  offset,
size_t  max 
)
inherited

Set partial data for an already queued packet.

This is often used for multichannel data.

Parameters
timestampTimestamp of packet.
dataBuffer to copy from.
offsetOffset to copy from.
maxMaximum data size.
Returns
Number of packet data bytes set.
void SyncSourceHandler::setParticipant ( SyncSource source,
Participant p 
)
inlineinherited

Definition at line 145 of file iqueue.h.

void RTCPCompoundHandler::setPathMTU ( uint16  mtu)
inlineinherited

Definition at line 95 of file rtcppkt.h.

bool RTPQueueBase::setPayloadFormat ( const PayloadFormat pf)
inlineinherited

Set the payload format in use, for timing and payload type identification purposes.

Parameters
pfpayload format to use from now on.
Returns
whether the payload format has been successfully set.

Definition at line 180 of file queuebase.h.

void ZrtpQueue::setPBXEnrollment ( bool  enrollmentMode)
inline

Backwards compatible api fix...

Definition at line 596 of file ZrtpQueue.h.

void QueueRTCPManager::setPrevMembersNum ( uint32  n)
inlineprotectedinherited
Parameters
nNumber of members.

Definition at line 311 of file cqueue.h.

void ParticipantHandler::setPRIVPrefix ( Participant part,
const std::string  val 
)
inlineinherited

Definition at line 191 of file iqueue.h.

void OutgoingDataQueue::setSchedulingTimeout ( microtimeout_t  to)
inlineinherited

Set the default scheduling timeout to use when no data packets are waiting to be sent.

Parameters
totimeout in milliseconds.

Definition at line 367 of file oqueue.h.

void ParticipantHandler::setSDESItem ( Participant part,
SDESItemType  item,
const std::string &  val 
)
inlineinherited

Definition at line 186 of file iqueue.h.

void SyncSourceHandler::setSender ( SyncSource source,
bool  active 
)
inlineinherited

Definition at line 153 of file iqueue.h.

void QueueRTCPManager::setSendersControlFraction ( float  fraction)
inlineinherited

Specify the fraction of the total control bandwith to be dedicated to senders reports.

Parameters
fractionfraction of bandwidth, must be between 0 an 1.

This method sets the fraction of the global control bandwidth that will be dedicated to senders reports. Of course, 1 - fraction will be dedicated to receivers reports.

See Also
setControlBandwidth

Definition at line 158 of file cqueue.h.

void RTPDataQueue::setSessionBandwidth ( uint32  bw)
inlineinherited

Specify the bandwidth of the current session.

Parameters
bwbandwidth of the current session, in bits/s.
See Also
AVPQueue::setControlBandwidth()

Definition at line 214 of file ioqueue.h.

bool ZrtpQueue::setSignatureData ( uint8 *  data,
int32  length 
)

Set signature data.

This functions stores signature data and transmitts it during ZRTP processing to the other party as part of the Confirm packets. Refer to chapters 6.7 and 8.2 in the ZRTP specification.

Parameters
dataThe signature data including the signature type block. The method copies this data into the Confirm packet at signature type block.
lengthThe length of the signature data in bytes. This length must be multiple of 4.
Returns
True if the method stored the data, false otherwise.
void ZrtpQueue::setSignSas ( bool  sasSignMode)

Set the state of the SAS signature mode flag.

If SAS signature mode is set to true this ZRTP session support SAS signature callbacks and signature transfer between clients.

Parameters
sasSignModedefines the new state of the sasSignMode flag
void IncomingDataQueue::setSourceExpirationPeriod ( uint8  intervals)
inlineprotectedinherited

Set the number of RTCP intervals that the stack will wait to change the state of a source from stateActive to stateInactive, or to delete the source after being in stateInactive.

Note that this value should be uniform accross all participants and SHOULD be fixed for a particular profile.

Parameters
intervalsnumber of RTCP report intervals
Note
If RTCP is not being used, the RTCP interval is assumed to be the default: 5 seconds.
The default for this value is, as RECOMMENDED, 5.

Definition at line 1122 of file iqueue.h.

void SyncSourceHandler::setState ( SyncSource source,
SyncSource::State  ns 
)
inlineinherited

Definition at line 149 of file iqueue.h.

void RTPDataQueue::setTimeclock ( )
inlineinherited

Set the packet timeclock for synchronizing timestamps.

Definition at line 229 of file ioqueue.h.

void RTPDataQueue::setTypeOfService ( Tos  tos)
inlineinherited

Specify the kind of service the application expects to use.

Parameters
tostype of service the application expects to use
Note
If enhanced service is specified but packet loss is high (the requested service does not appear to actually be delivered) ccRTP defaults to best-effort suitable behaviour: guarantee fair competition with TCP.
Todo:
Implement fair competition with tcp

Definition at line 119 of file ioqueue.h.

void ZrtpQueue::setUserCallback ( ZrtpUserCallback ucb)

Set the application's callback class.

The destructor of ZrtpQueue also destorys the user callback class if it was set. The application must not delete the callback object or use/reference the callback object after ZrtpQueue was destroyed.

Parameters
ucbImplementation of the application's ZrtpUserCallback class
void ZrtpQueue::signSAS ( uint8_t *  sasHash)
protectedvirtual

Request a SAS signature.

After ZRTP was able to compute the Short Authentication String (SAS) it calls this method. The client may now use an approriate method to sign the SAS. The client may use ZrtpQueue::setSignatureData() to store the signature data an enable signature transmission to the other peer. Refer to chapter 8.2 of ZRTP specification.

Note: SAS signing is not yet fully supported by GNU ZRTP.

Parameters
sasHashThe SAS hash to sign.

Implements ZrtpCallback.

void ZrtpQueue::srtpSecretsOff ( EnableSecurity  part)
protectedvirtual

Switch off the security for the defined part.

Parameters
partDefines for which part (sender or receiver) to switch on security

Implements ZrtpCallback.

void ZrtpQueue::srtpSecretsOn ( std::string  c,
std::string  s,
bool  verified 
)
protectedvirtual

Switch on the security.

ZRTP calls this method after it has computed the SAS and check if it is verified or not. In addition ZRTP provides information about the cipher algorithm and key length for the SRTP session.

This method must enable SRTP processing if it was not enabled during sertSecretsReady().

Parameters
cThe name of the used cipher algorithm and mode, or NULL
sThe SAS string
verifiedif verified is true then SAS was verified by both parties during a previous call.

Implements ZrtpCallback.

bool ZrtpQueue::srtpSecretsReady ( SrtpSecret_t secrets,
EnableSecurity  part 
)
protectedvirtual

SRTP crypto data ready for the sender or receiver.

The ZRTP implementation calls this method right after all SRTP secrets are computed and ready to be used. The parameter points to a structure that contains pointers to the SRTP secrets and a enum Role. The called method (the implementation of this abstract method) must either copy the pointers to the SRTP data or the SRTP data itself to a save place. The SrtpSecret_t structure is destroyed after the callback method returns to the ZRTP implementation.

The SRTP data themselfs are ontained in the ZRtp object and are valid as long as the ZRtp object is active. TheZRtp's destructor clears the secrets. Thus the called method needs to save the pointers only, ZRtp takes care of the data.

The implementing class may enable SRTP processing in this method or delay it to srtpSecertsOn().

Parameters
secretsA pointer to a SrtpSecret_t structure that contains all necessary data.
partfor which part (Sender or Receiver) this data is valid.
Returns
Returns false if something went wrong during initialization of SRTP context, for example memory shortage.

Implements ZrtpCallback.

void ZrtpQueue::startZrtp ( )

Starts the ZRTP protocol engine.

Applications may call this method to immediatly start the ZRTP protocol engine any time after initializing ZRTP and setting optinal parameters, for example client id or multi-stream parameters.

If the application does not call this method but sucessfully initialized the ZRTP engine using initialize() then ZRTP also starts after the application sent and received RTP packets. An application can disable this automatic, delayed start of the ZRTP engine using setEnableZrtp(false) before sending or receiving RTP packets.

void ZrtpQueue::stopZrtp ( )

Stops the ZRTP protocol engine.

Applications call this method to stop the ZRTP protocol engine.

void ZrtpQueue::synchEnter ( )
protectedvirtual

Enter synchronization mutex.

GNU ZRTP requires one mutes to synchronize its processing. Because mutex implementations depend on the underlying infrastructure, for example operating system or thread implementation, GNU ZRTP delegates mutex handling to the spcific part of its implementation.

Implements ZrtpCallback.

void ZrtpQueue::synchLeave ( )
protectedvirtual

Leave synchronization mutex.

Implements ZrtpCallback.

virtual size_t ZrtpQueue::takeInDataPacket ( )
protectedvirtual

This function is used by the service thread to process the next incoming packet and place it in the receive list.

This class overloads the function of IncomingDataQueue implementation.

Returns
number of payload bytes received, <0 if error.

Reimplemented from IncomingDataQueue.

virtual void RTPDataQueue::timerTick ( )
inlineprotectedvirtualinherited

A plugin point for timer tick driven events.

Definition at line 281 of file ioqueue.h.

void DestinationListHandler::unlockDestinationList ( ) const
inlineinherited

Definition at line 91 of file oqueue.h.

void ConflictHandler::updateConflict ( ConflictingTransportAddress ca)
inlineinherited

Definition at line 276 of file iqueue.h.

void DestinationListHandler::writeLockDestinationList ( ) const
inlineprotectedinherited

Definition at line 95 of file oqueue.h.

void ZrtpQueue::zrtpAskEnrollment ( GnuZrtpCodes::InfoEnrollment  info)
protectedvirtual

Inform about a PBX enrollment request.

Please refer to chapter 8.3 ff to get more details about PBX enrollment and SAS relay.

Note: PBX enrollement is not yet fully supported by GNU ZRTP.

Parameters
infoGive some information to the user about the PBX requesting an enrollment.

Implements ZrtpCallback.

void ZrtpQueue::zrtpInformEnrollment ( GnuZrtpCodes::InfoEnrollment  info)
protectedvirtual

Inform about PBX enrollment result.

Informs the use about the acceptance or denial of an PBX enrollment request

Note: PBX enrollement is not yet fully supported by GNU ZRTP.

Parameters
infoinformation to the user about the result of an enrollment.

Implements ZrtpCallback.

void ZrtpQueue::zrtpNegotiationFailed ( GnuZrtpCodes::MessageSeverity  severity,
int32_t  subCode 
)
protectedvirtual

Handle ZRTP negotiation failed.

ZRTP calls this method in case ZRTP negotiation failed. The parameters show the severity as well as the reason.

Parameters
severityThis defines the message's severity
subCodeThe subcode identifying the reason.
See Also
ZrtpCodes::MessageSeverity

Implements ZrtpCallback.

void ZrtpQueue::zrtpNotSuppOther ( )
protectedvirtual

ZRTP calls this method if the other side does not support ZRTP.

If the other side does not answer the ZRTP Hello packets then ZRTP calls this method,

Implements ZrtpCallback.

Friends And Related Function Documentation

friend class TimeoutProvider< std::string, ost::ZrtpQueue * >
friend

Definition at line 753 of file ZrtpQueue.h.

Field Documentation

std::string ZrtpQueue::clientIdString
private

Definition at line 851 of file ZrtpQueue.h.

bool OutgoingDataQueue::complete
inherited

Definition at line 618 of file oqueue.h.

std::list<CryptoContext *> OutgoingDataQueue::cryptoContexts
protectedinherited

Definition at line 552 of file oqueue.h.

std::list<CryptoContext *> IncomingDataQueue::cryptoContexts
protectedinherited

Definition at line 1290 of file iqueue.h.

Mutex OutgoingDataQueue::cryptoMutex
mutableprotectedinherited

Definition at line 551 of file oqueue.h.

Mutex IncomingDataQueue::cryptoMutex
mutableprotectedinherited

Definition at line 1289 of file iqueue.h.

const uint16 IncomingDataQueue::defaultMaxPacketDropout
staticprotectedinherited

Definition at line 1283 of file iqueue.h.

const uint16 IncomingDataQueue::defaultMaxPacketMisorder
staticprotectedinherited

Definition at line 1282 of file iqueue.h.

const size_t MembershipBookkeeping::defaultMembersHashSize
staticprotectedinherited

Definition at line 854 of file iqueue.h.

const size_t IncomingDataQueue::defaultMembersSize
staticprotectedinherited

Definition at line 1287 of file iqueue.h.

const uint8 IncomingDataQueue::defaultMinValidPacketSequence
staticprotectedinherited

Definition at line 1281 of file iqueue.h.

std::list<TransportAddress*> DestinationListHandler::destList
protectedinherited

Definition at line 71 of file oqueue.h.

bool ZrtpQueue::enableParanoidMode
private

Definition at line 863 of file ZrtpQueue.h.

bool ZrtpQueue::enableZrtp
private

Definition at line 853 of file ZrtpQueue.h.

ConflictingTransportAddress* ConflictHandler::firstConflict
protectedinherited

Definition at line 288 of file iqueue.h.

ConflictingTransportAddress * ConflictHandler::lastConflict
protectedinherited

Definition at line 288 of file iqueue.h.

bool OutgoingDataQueue::marked
inherited

Definition at line 616 of file oqueue.h.

uint16 IncomingDataQueue::maxPacketDropout
protectedinherited

Definition at line 1286 of file iqueue.h.

uint16 IncomingDataQueue::maxPacketMisorder
protectedinherited

Definition at line 1285 of file iqueue.h.

uint8 IncomingDataQueue::minValidPacketSequence
protectedinherited

Definition at line 1284 of file iqueue.h.

bool ZrtpQueue::mitmMode
private

Definition at line 861 of file ZrtpQueue.h.

uint32 OutgoingDataQueue::octetCount
inherited

Definition at line 604 of file oqueue.h.

timeval OutgoingDataQueue::overflowTime
inherited

Definition at line 623 of file oqueue.h.

uint32 OutgoingDataQueue::packetCount
inherited

Definition at line 602 of file oqueue.h.

uint8 OutgoingDataQueue::paddinglen
inherited

Definition at line 612 of file oqueue.h.

uint32 ZrtpQueue::peerSSRC
private

Definition at line 859 of file ZrtpQueue.h.

IncomingRTPPktLink* IncomingDataQueue::recvFirst
protectedinherited

Definition at line 1279 of file iqueue.h.

IncomingRTPPktLink * IncomingDataQueue::recvLast
protectedinherited

Definition at line 1279 of file iqueue.h.

ThreadLock IncomingDataQueue::recvLock
mutableprotectedinherited

Definition at line 1277 of file iqueue.h.

uint32 QueueRTCPManager::rtcpPMembers
inherited

Definition at line 588 of file cqueue.h.

unsigned char* RTCPCompoundHandler::rtcpRecvBuffer
protectedinherited

Definition at line 358 of file rtcppkt.h.

unsigned char* RTCPCompoundHandler::rtcpSendBuffer
protectedinherited

Definition at line 355 of file rtcppkt.h.

timeval QueueRTCPManager::rtcpTc
inherited

Definition at line 587 of file cqueue.h.

timeval QueueRTCPManager::rtcpTn
inherited

Definition at line 587 of file cqueue.h.

timeval QueueRTCPManager::rtcpTp
inherited

Definition at line 587 of file cqueue.h.

int32 ZrtpQueue::secureParts
private

Definition at line 855 of file ZrtpQueue.h.

uint16 OutgoingDataQueue::sendCC
inherited

Definition at line 610 of file oqueue.h.

int16 ZrtpQueue::senderZrtpSeqNo
private

Definition at line 857 of file ZrtpQueue.h.

uint16 OutgoingDataQueue::sendSeq
inherited

Definition at line 606 of file oqueue.h.

uint32 OutgoingDataQueue::sendSources[16]
inherited

Definition at line 608 of file oqueue.h.

const uint32 MembershipBookkeeping::SEQNUMMOD
staticprotectedinherited

Definition at line 855 of file iqueue.h.

bool ZrtpQueue::signSas
private

Definition at line 862 of file ZrtpQueue.h.

uint8 IncomingDataQueue::sourceExpirationPeriod
protectedinherited

Definition at line 1288 of file iqueue.h.

bool ZrtpQueue::started
private

Definition at line 860 of file ZrtpQueue.h.

ost::Mutex ZrtpQueue::synchLock
private

Definition at line 858 of file ZrtpQueue.h.

ZRtp* ZrtpQueue::zrtpEngine
private

Definition at line 848 of file ZrtpQueue.h.

ZrtpUserCallback* ZrtpQueue::zrtpUserCallback
private

Definition at line 849 of file ZrtpQueue.h.


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