|
reSIProcate
SIP stack, Dialog Usage Manager and related libraries
|
This is the primary point of interaction between the app-layer and the stack. More...
#include <SipStack.hxx>
Classes | |
| class | Exception |
| thrown when the stack is unable to function. More... | |
Public Member Functions | |
| SipStack (const SipStackOptions &options) | |
| Constructor. | |
| SipStack (Security *security=0, const DnsStub::NameserverList &additional=DnsStub::EmptyNameserverList, AsyncProcessHandler *handler=0, bool stateless=false, AfterSocketCreationFuncPtr socketFunc=0, Compression *compression=0, FdPollGrp *pollGrp=0, bool useDnsVip=false) | |
| Constructor. | |
| virtual | ~SipStack () |
| void | run () |
| Causes this SipStack object to create and run threads for carrying out processing. | |
| void | shutdown () |
| perform orderly shutdown | |
| void | shutdownAndJoinThreads () |
| Shutdown and join any threads that the SipStack is running. | |
| void | onReload () |
| reload configuration | |
| void | reloadCertificates () |
| reload the TLS X.509 certificates | |
| void | setTransportSipMessageLoggingHandler (std::shared_ptr< Transport::SipMessageLoggingHandler > handler) |
| Used by the application to provide a handler that will get called for all inbound and outbound SIP messages on transports that are added after calling this. | |
| void | addTransportSipMessageLoggingHandler (std::shared_ptr< Transport::SipMessageLoggingHandler > handler) |
| Used by the application to provide a handler that will get called for all inbound and outbound SIP messages on transports that are added after calling this. | |
| Transport * | addTransport (TransportType protocol, int port, IpVersion version=V4, StunSetting stun=StunDisabled, const Data &ipInterface=Data::Empty, const Data &sipDomainname=Data::Empty, const Data &privateKeyPassPhrase=Data::Empty, SecurityTypes::SSLType sslType=SecurityTypes::DynamicTLS, unsigned transportFlags=0, const Data &certificateFilename="", const Data &privateKeyFilename="", SecurityTypes::TlsClientVerificationMode cvm=SecurityTypes::None, bool useEmailAsSIP=false, std::shared_ptr< WsConnectionValidator >=nullptr, std::shared_ptr< WsCookieContextFactory >=nullptr, const Data &netNs=Data::Empty) |
| Used by the application to add in a new built-in transport. | |
| void | addTransport (std::unique_ptr< Transport > transport) |
| Used to plug-in custom transports. | |
| void | removeTransport (unsigned int transportKey) |
| Used to remove a previously added transport. | |
| Fifo< TransactionMessage > & | stateMacFifo () |
| Returns the fifo that subclasses of Transport should use for the rxFifo cons. | |
| void | addAlias (const Data &domain, int port) |
| add an alias for this sip element | |
| void | removeAlias (const Data &domain, int port) |
| removes an alias from this sip element | |
| bool | isMyDomain (const Data &domain, int port) const |
| Returns true if domain is handled by this stack. | |
| bool | isMyPort (int port) const |
| Returns true if port is handled by this stack. | |
| const Uri & | getUri () const |
| Get one of the domains/ports that are handled by this stack in Uri form. | |
| void | send (const SipMessage &msg, TransactionUser *tu=0) |
| allows a TU to send a message | |
| void | send (std::unique_ptr< SipMessage > msg, TransactionUser *tu=0) |
| void | sendTo (std::unique_ptr< SipMessage > msg, const Uri &uri, TransactionUser *tu=0) |
| this is only if you want to send to a destination not in the route. | |
| void | sendTo (std::unique_ptr< SipMessage > msg, const Tuple &tuple, TransactionUser *tu=0) |
| this is only if you want to send to a destination not in the route. | |
| void | sendTo (const SipMessage &msg, const Uri &uri, TransactionUser *tu=0) |
| send a message to a destination not in the route | |
| void | sendTo (const SipMessage &msg, const Tuple &tuple, TransactionUser *tu=0) |
| send a message to a destination not in the route | |
| void | sendOverExistingConnection (const SipMessage &msg, const Tuple &tuple, TransactionUser *tu=0) |
| force the a message out over an existing connection | |
| void | post (std::unique_ptr< ApplicationMessage > message, unsigned int secondsLater, TransactionUser *tu=0) |
| Makes the message available to the TU at some later time, specified in seconds. | |
| void | postMS (std::unique_ptr< ApplicationMessage > message, unsigned int ms, TransactionUser *tu=0) |
| Makes the message available to the TU at some later time, specified in milli-seconds. | |
| void | post (std::unique_ptr< ApplicationMessage > message, std::chrono::duration< double > interval, TransactionUser *tu=0) |
| Makes the message available to the TU at some later time, specified as an interval. | |
| void | post (std::unique_ptr< ApplicationMessage > message) |
| Makes the message available to the TU later. | |
| void | post (const ApplicationMessage &message) |
| Makes the message available to the TU later. | |
| void | post (const ApplicationMessage &message, unsigned int secondsLater, TransactionUser *tu=0) |
| Makes the message available to the TU at some later time, specified in seconds. | |
| void | postMS (const ApplicationMessage &message, unsigned int ms, TransactionUser *tu=0) |
| Makes the message available to the TU at some later time, specified in milli-seconds. | |
| void | post (const ApplicationMessage &message, std::chrono::duration< double > interval, TransactionUser *tu=0) |
| Makes the message available to the TU at some later time, specified as an interval. | |
| void | abandonServerTransaction (const Data &tid) |
| Tells the stack that the TU has abandoned a server transaction. | |
| void | cancelClientInviteTransaction (const Data &tid, const Tokens *reasons) |
| Tells the stack that the TU wishes to CANCEL an INVITE request. | |
| bool | hasMessage () const |
| does the stack have new messages for the TU? | |
| SipMessage * | receive () |
| retrieve a SipMessage off the old TuFifo | |
| Message * | receiveAny () |
| retrieve a message off the old TuFifo | |
| void | setFallbackPostNotify (AsyncProcessHandler *handler) |
| virtual void | buildFdSet (FdSet &fdset) |
| Build the FD set to use in a select to find out when process(FdSet&) must be called again. | |
| virtual void | process (FdSet &fdset) |
| This allows the executive to give processing time to stack components. | |
| bool | process (unsigned int timeoutMs) |
| Give processing time to the SipStack components, when operating in single-threaded mode. | |
| FdPollGrp * | getPollGrp () |
| virtual unsigned int | getTimeTillNextProcessMS () |
| Returns time in milliseconds when process next needs to be called. | |
| virtual void | processTimers () |
| Check all timers. | |
| void | setStatisticsInterval (unsigned long seconds) |
| Sets the interval that determines the time between Statistics messages. | |
| void | zeroOutStatistics () |
| Resets all of the cumulative statistics counters. | |
| bool | pollStatistics () |
| Immediately polls for statistics to be logged and sent to external handlers, instead of waiting for next statistics interval. | |
| void | setExternalStatsHandler (ExternalStatsHandler *handler) |
| Installs a handler for the stacks internal StatisticsManager. | |
| const StatisticsManager * | getStatisticsManager () |
| get statistics manager | |
| EncodeStream & | dump (EncodeStream &strm) const |
| output current state of the stack - for debug | |
| Security * | getSecurity () const |
| Returns a pointer to the embedded Security object, 0 if not set. | |
| void | registerTransactionUser (TransactionUser &, const bool front=false) |
| add a TU to the TU selection chain | |
| void | requestTransactionUserShutdown (TransactionUser &) |
| Queue a shutdown request to the specified TU. | |
| void | unregisterTransactionUser (TransactionUser &) |
| Removes a TU from the TU selection chain. | |
| void | registerMarkListener (MarkListener *listener) |
| Register a handler with the DNS Interface for notifications of when a Dns Resource Record has been blacklisted. | |
| void | unregisterMarkListener (MarkListener *listener) |
| Removed a registered BlacklistListener handler from the DNS Interface for a particualr Resource Record type and handler pointer. | |
| DnsStub & | getDnsStub () const |
| void | setEnumSuffixes (const std::vector< Data > &suffixes) |
| Specify which enum domains will be searched when sending. | |
| void | setEnumDomains (const std::map< Data, Data > &domains) |
| Specify which domains in the To: Uri will be subject to ENUM. | |
| void | clearDnsCache () |
| Clear the DNS Cache. | |
| void | logDnsCache () |
| Log the DNS Cache to WarningLog for Debugging. | |
| void | getDnsCacheDump (std::pair< unsigned long, unsigned long > key, GetDnsCacheDumpHandler *handler) |
| Get a string representation of the DNS Cache. | |
| void | reloadDnsServers () |
| Check if DnsServers list has changed, and if so reinitializes the DNS resolver (ares). | |
| volatile bool & | statisticsManagerEnabled () |
| Enable Statistics Manager. | |
| const bool | statisticsManagerEnabled () const |
| bool | getFixBadDialogIdentifiers () const |
| Returns whether the stack is fixing corrupted/changed dialog identifiers (ie, Call-Id and tags) in responses from the wire. | |
| void | setFixBadDialogIdentifiers (bool pFixBadDialogIdentifiers) |
| Specify whether the stack should fix corrupted/changed dialog identifiers (ie, Call-Id and tags) in responses from the wire. | |
| bool | getFixBadCSeqNumbers () const |
| void | setFixBadCSeqNumbers (bool pFixBadCSeqNumbers) |
| bool | setUdpOnlyOnNumeric (bool value) |
| bool | getUdpOnlyOnNumeric () const |
| void | setContentLengthChecking (bool check) |
| Used to enable/disable content-length checking on datagram-based transports. | |
| void | setCongestionManager (CongestionManager *manager) |
| Sets the CongestionManager used by the stack. | |
| CongestionManager * | getCongestionManager () |
| Accessor for the CongestionManager object the stack is using. | |
| Compression & | getCompression () |
| Accessor for the Compression object the stack is using. | |
| void | terminateFlow (const resip::Tuple &flow) |
| void | enableFlowTimer (const resip::Tuple &flow) |
| void | invokeAfterSocketCreationFunc (TransportType type=UNKNOWN_TRANSPORT) |
Public Member Functions inherited from resip::FdSetIOObserver | |
| FdSetIOObserver () | |
| virtual | ~FdSetIOObserver () |
Static Public Member Functions | |
| static Data | getHostname () |
| Get one of the names for this host (calls through to gethostbyname) and is not threadsafe. | |
| static Data | getHostAddress () |
| Get one of the IP address for this host (calls through to gethostbyname) and is not threadsafe. | |
Friends | |
| class | Executive |
| class | StatelessHandler |
| class | StatisticsManager |
| class | TestDnsResolver |
| class | TestFSM |
| class | TransactionState |
| class | TransactionController |
| class | TuSelector |
This is the primary point of interaction between the app-layer and the stack.
For a SipStack to be usable, transports must be added by calling the addTransport() method.
The useful work done by SipStack occurs when SipStack::process(unsigned int) is called. A separate thread (such as EventStackThread) can be dedicated to this task, or it can be called from within a loop in the main thread of the executable.
Graceful shutdown is accomplished by advising the SipStack to begin shutdown procedures via the shutdown() method. The SipStack should continue to be serviced through the process(unsigned int) method until the Transaction User is informed by receiving a ShutdownMessage that the requested shutdown is complete.
Definition at line 159 of file SipStack.hxx.
| SipStack::SipStack | ( | const SipStackOptions & | options | ) |
Constructor.
First instantiate SipStackOptions, then set any values special to your application, then call this constructor. The {options} instance is not referenced after construction (i.e., the SipStack doesn't keep a reference to it). However, it does copy each individual value, and takes ownership of several of the objects.
Definition at line 73 of file SipStack.cxx.
| SipStack::SipStack | ( | Security * | security = 0, |
| const DnsStub::NameserverList & | additional = DnsStub::EmptyNameserverList, |
||
| AsyncProcessHandler * | handler = 0, |
||
| bool | stateless = false, |
||
| AfterSocketCreationFuncPtr | socketFunc = 0, |
||
| Compression * | compression = 0, |
||
| FdPollGrp * | pollGrp = 0, |
||
| bool | useDnsVip = false |
||
| ) |
Constructor.
This constructor is obsolete. The SipStackOptions-based constructor should be used instead.
| security | Security Object required by the stack for TLS, DTLS, SMIME and Identity-draft compliance. If 0 is passed in the stack will not support these advanced security features. The compile flag USE_SSL is also required. The security object will be owned by the SipStack and deleted in the SipStack destructor. Default is 0. |
| handler | AsyncProcessHandler that will be invoked when Messages are posted to the stack. For example: SelectInterruptor. Default is 0. |
| stateless | This parameter does not appear to be used. |
| socketFunc | A pointer to a function that will be called after a socket in the DNS or SIP transport layers of the stack has been created. This callback can be used to control low level socket options, such as Quality-of-Service/DSCP. Note: For SIP TCP sockets there is one call for the listen socket, and one (or two) calls for each connection created afterwards. For each inbound TCP connection the first callback is called immediately before the socket is connected, and if configured it is called again after the connect call has completed and before the first data is sent out. On some OS's you cannot set QOS until the socket is successfully connected. To enable this behavior call: Connection::setEnablePostConnectSocketFuncCall(); DNS sockets get one call each. With c-ares it comes before the socket connects, and the setting above adds a second call once it is connected; the bundled ares makes its one call after connecting. |
| compression | Compression configuration object required for SigComp. If set to 0, then SigComp compression will be disabled. |
| pollGrp | Polling group to support file-io callbacks; if one is not passed, one will be created. Ownership is not taken. |
| useDnsVip | Set to true to enable Whitelisting of DNS entries. A feature that usually desired by UA's that want to stick to a known good server / dns result. |
Definition at line 87 of file SipStack.cxx.
|
virtual |
Definition at line 224 of file SipStack.cxx.
| void SipStack::abandonServerTransaction | ( | const Data & | tid | ) |
Tells the stack that the TU has abandoned a server transaction.
This is provided to allow better behavior in cases where an exception is thrown due to garbage in the request, and the code catching the exception has no way of telling whether the original request is still around. This frees the TU of the obligation to respond to the request.
| tid | The transaction identifier for the server transaction. |
Definition at line 1040 of file SipStack.cxx.
| void SipStack::addTransport | ( | std::unique_ptr< Transport > | transport | ) |
Used to plug-in custom transports.
Adds the transport to the Transport Selector.
| transport | Pointer to an externally created transport. SipStack assumes ownership. |
Definition at line 523 of file SipStack.cxx.
| Transport * SipStack::addTransport | ( | TransportType | protocol, |
| int | port, | ||
| IpVersion | version = V4, |
||
| StunSetting | stun = StunDisabled, |
||
| const Data & | ipInterface = Data::Empty, |
||
| const Data & | sipDomainname = Data::Empty, |
||
| const Data & | privateKeyPassPhrase = Data::Empty, |
||
| SecurityTypes::SSLType | sslType = SecurityTypes::DynamicTLS, |
||
| unsigned | transportFlags = 0, |
||
| const Data & | certificateFilename = "", |
||
| const Data & | privateKeyFilename = "", |
||
| SecurityTypes::TlsClientVerificationMode | cvm = SecurityTypes::None, |
||
| bool | useEmailAsSIP = false, |
||
| std::shared_ptr< WsConnectionValidator > | wsConnectionValidator = nullptr, |
||
| std::shared_ptr< WsCookieContextFactory > | wsCookieContextFactory = nullptr, |
||
| const Data & | netNs = Data::Empty |
||
| ) |
Used by the application to add in a new built-in transport.
The transport is created and then added to the Transport Selector.
| Transport::Exception | If the transport couldn't be added, usually because the port was already bound. |
| protocol | TCP, UDP, TLS, DTLS, etc. |
| port | Specifies which port to bind to. |
| version | Protocol Version: V4 or V6 |
| stun | Specifies whether STUN is enabled. |
| ipInterface | Specifies which ethernet interface to bind to. If set to Data::Empty, bind to all interfaces. Binding to all interfaces can impose a performance penalty, however, so it is recommended that you bind to specific interfaces when using in high-throughput deployments. Note: Interfaces must be identified via IP address. |
| sipDomainname | Only allow messages to be sent as the specified domain. For default case, you can pass in domainname = DnsUtil::getLocalDomainName(). |
| privateKeyPassPhrase | Private key pass phrase used to decrypt private key certificates. Note: For now this parameter is not used we are loading PKCS7 keys, so a pass phrase is not required. |
| sslType | Version of the TLS specification to use: DynamicTLS or TLSv1 |
| transportFlags | Bit-mask of TransportFlags to control transport behavior. All flags default to "off" (0) to preserve traditional behavior. Available flags (see Transport.hxx for details):
|
| certificateFilename | Path to the host domain TLS certificate file (PEM format). Used for TLS/DTLS transports. If empty, uses certificates from Security object. |
| privateKeyFilename | Path to the host domain TLS private key file (PEM format). Used for TLS/DTLS transports. If empty, uses private key from Security object. |
| cvm | SSL verify mode for the peer (whether we accept and/or insist on a client certificate from the peer) |
| useEmailAsSIP | If true, we will accept the email address in a client's subjectAltName as if it were a SIP URI. This is convenient because many commercial CAs offer email certificates but not sip: certificates. For reasons of standards compliance, it is disabled by default. |
| netNs | Set the network namespace (netns) in which the Transport is to bind the the given address and port. |
Definition at line 362 of file SipStack.cxx.
| void SipStack::addTransportSipMessageLoggingHandler | ( | std::shared_ptr< Transport::SipMessageLoggingHandler > | handler | ) |
Used by the application to provide a handler that will get called for all inbound and outbound SIP messages on transports that are added after calling this.
Multiple handlers can be added with this method.
| handler | std::shared_ptr to a handler to call for inbound and outbound SIP messages for all transports added after calling this. |
Definition at line 343 of file SipStack.cxx.
|
virtual |
Build the FD set to use in a select to find out when process(FdSet&) must be called again.
| fdset | an empty or partially populated fdset, fd's are added to the fdset on return |
Implements resip::FdSetIOObserver.
Definition at line 1179 of file SipStack.cxx.
Tells the stack that the TU wishes to CANCEL an INVITE request.
This frees the TU of the obligation to keep state on whether a 1xx has come in yet before actually sending a CANCEL request, and also the obligation of forming the CANCEL request itself. This does not free the TU of the obligation to handle any INVITE/200 that come in (usually by sending an ACK to the 200, and then a BYE).
| tid | The transaction identifier of the INVITE request sent. |
| reasons | Optional reason headers to be added to any resulting CANCEL request. |
Definition at line 1046 of file SipStack.cxx.
| void SipStack::clearDnsCache | ( | ) |
Clear the DNS Cache.
Definition at line 1267 of file SipStack.cxx.
| EncodeStream & SipStack::dump | ( | EncodeStream & | strm | ) | const |
output current state of the stack - for debug
Definition at line 1303 of file SipStack.cxx.
| void SipStack::enableFlowTimer | ( | const resip::Tuple & | flow | ) |
Definition at line 1340 of file SipStack.cxx.
| void SipStack::getDnsCacheDump | ( | std::pair< unsigned long, unsigned long > | key, |
| GetDnsCacheDumpHandler * | handler | ||
| ) |
Get a string representation of the DNS Cache.
| key | - a pair representing the request key, can be used by the callback handler to identify the originating request |
| handler | - pointer to a class that implements the handler method: onDnsCacheRetrieved |
Definition at line 1279 of file SipStack.cxx.
| DnsStub & SipStack::getDnsStub | ( | ) | const |
Definition at line 1249 of file SipStack.cxx.
|
inline |
Definition at line 1045 of file SipStack.hxx.
|
static |
Get one of the IP address for this host (calls through to gethostbyname) and is not threadsafe.
Definition at line 794 of file SipStack.cxx.
|
static |
Get one of the names for this host (calls through to gethostbyname) and is not threadsafe.
Definition at line 763 of file SipStack.cxx.
|
inline |
Definition at line 854 of file SipStack.hxx.
| Security * SipStack::getSecurity | ( | ) | const |
Returns a pointer to the embedded Security object, 0 if not set.
Definition at line 1185 of file SipStack.cxx.
|
inline |
get statistics manager
Definition at line 908 of file SipStack.hxx.
|
virtual |
Returns time in milliseconds when process next needs to be called.
returns time in milliseconds when process next needs to be called
Implements resip::FdSetIOObserver.
Definition at line 1160 of file SipStack.cxx.
|
inline |
Definition at line 1060 of file SipStack.hxx.
| const Uri & SipStack::getUri | ( | ) | const |
Get one of the domains/ports that are handled by this stack in Uri form.
"sip:" scheme is assumed.
Definition at line 854 of file SipStack.cxx.
| bool SipStack::hasMessage | ( | ) | const |
does the stack have new messages for the TU?
Definition at line 1052 of file SipStack.cxx.
| void SipStack::invokeAfterSocketCreationFunc | ( | TransportType | type = UNKNOWN_TRANSPORT | ) |
Definition at line 1346 of file SipStack.cxx.
| bool SipStack::isMyDomain | ( | const Data & | domain, |
| int | port | ||
| ) | const |
Returns true if domain is handled by this stack.
Convenience for Transaction Users.
| domain | Domain name to check. |
| port | Port number to check. |
Definition at line 837 of file SipStack.cxx.
| bool SipStack::isMyPort | ( | int | port | ) | const |
Returns true if port is handled by this stack.
Convenience for Transaction Users.
| port | Port number to check. |
Definition at line 847 of file SipStack.cxx.
| void SipStack::logDnsCache | ( | ) |
Log the DNS Cache to WarningLog for Debugging.
Definition at line 1273 of file SipStack.cxx.
| void SipStack::onReload | ( | ) |
reload configuration
Perform actions typically associated with the HUP signal, for example, reloading certificate files from disk.
Definition at line 317 of file SipStack.cxx.
| bool SipStack::pollStatistics | ( | ) |
Immediately polls for statistics to be logged and sent to external handlers, instead of waiting for next statistics interval.
Returns false if statistics manager is not enabled.
Definition at line 1206 of file SipStack.cxx.
| void SipStack::post | ( | const ApplicationMessage & | message | ) |
Makes the message available to the TU later.
| message | ApplicationMessage to post |
Definition at line 966 of file SipStack.cxx.
| void SipStack::post | ( | const ApplicationMessage & | message, |
| std::chrono::duration< double > | interval, | ||
| TransactionUser * | tu = 0 |
||
| ) |
Makes the message available to the TU at some later time, specified as an interval.
| message | ApplicationMessage to post |
| interval | Delay before message is to be posted. |
| tu | TransactionUser to post to. |
Definition at line 990 of file SipStack.cxx.
| void SipStack::post | ( | const ApplicationMessage & | message, |
| unsigned int | secondsLater, | ||
| TransactionUser * | tu = 0 |
||
| ) |
Makes the message available to the TU at some later time, specified in seconds.
| message | ApplicationMessage to post. |
| secondsLater | Number of seconds before message is to be posted. |
| tu | TransactionUser to post to. |
Definition at line 974 of file SipStack.cxx.
| void SipStack::post | ( | std::unique_ptr< ApplicationMessage > | message | ) |
Makes the message available to the TU later.
| message | ApplicationMessage to post |
Definition at line 959 of file SipStack.cxx.
| void SipStack::post | ( | std::unique_ptr< ApplicationMessage > | message, |
| std::chrono::duration< double > | interval, | ||
| TransactionUser * | tu = 0 |
||
| ) |
Makes the message available to the TU at some later time, specified as an interval.
| message | ApplicationMessage to post |
| interval | Delay before message is to be posted. |
| tu | TransactionUser to post to. |
Definition at line 1024 of file SipStack.cxx.
| void SipStack::post | ( | std::unique_ptr< ApplicationMessage > | message, |
| unsigned int | secondsLater, | ||
| TransactionUser * | tu = 0 |
||
| ) |
Makes the message available to the TU at some later time, specified in seconds.
| message | ApplicationMessage to post |
| secondsLater | Number of seconds before message is to be posted. |
| tu | TransactionUser to post to. |
Definition at line 1007 of file SipStack.cxx.
| void SipStack::postMS | ( | const ApplicationMessage & | message, |
| unsigned int | ms, | ||
| TransactionUser * | tu = 0 |
||
| ) |
Makes the message available to the TU at some later time, specified in milli-seconds.
| message | ApplicationMessage to post |
| ms | Number of milli-seconds before message is to be posted. |
| tu | TransactionUser to post to. |
Definition at line 982 of file SipStack.cxx.
| void SipStack::postMS | ( | std::unique_ptr< ApplicationMessage > | message, |
| unsigned int | ms, | ||
| TransactionUser * | tu = 0 |
||
| ) |
Makes the message available to the TU at some later time, specified in milli-seconds.
| message | ApplicationMessage to post |
| ms | Number of milli-seconds before message is to be posted. |
| tu | TransactionUser to post to. |
Definition at line 1016 of file SipStack.cxx.
|
virtual |
This allows the executive to give processing time to stack components.
| fdset | a populated and 'select'ed fdset |
Implements resip::FdSetIOObserver.
Definition at line 1141 of file SipStack.cxx.
| bool SipStack::process | ( | unsigned int | timeoutMs | ) |
Give processing time to the SipStack components, when operating in single-threaded mode.
This call will allow all the components in the SipStack a chance to perform processing. This includes:
To give the SipStack cycles, it is sufficient to simply call this function repeatedly.
| timeoutMs | The maximum time, in milliseconds, we will wait for IO in this call. We will not necessarily wait this long if no IO occurs; if timers are scheduled to fire before this duration elapses, our timeout value will be adjusted accordingly. Similarly, if there is work waiting in fifos when this call is made, no timeout will be used. Lower values will cause higher CPU utilization when idle, higher values may result in processing delays of messages from the TU sent during the call to process(unsigned int) (eg; you call process(50), then immediately schedule an app timer to fire in 25ms, or send a SipMessage to the stack, it could be 50ms before either of these are processed). You can work around these caveats by creating a SelectInterruptor, adding its FD to the SipStack's FdPollGrp, and calling SelectInterruptor::interrupt() to cause process(unsigned int) to be interrupted. The best approach will vary, based on your performance needs. |
Definition at line 1148 of file SipStack.cxx.
|
virtual |
Check all timers.
Definition at line 1117 of file SipStack.cxx.
| SipMessage * SipStack::receive | ( | ) |
retrieve a SipMessage off the old TuFifo
Retrieve a SipMessage off the old TuFifo. Caller now owns the memory. Returns 0 if nothing there. Since the addition of TransactionUsers, this method is deprecated. This only looks into the old TuFifo that is not associated with any TransactionUser.
Definition at line 1058 of file SipStack.cxx.
| Message * SipStack::receiveAny | ( | ) |
retrieve a message off the old TuFifo
Retrieve a Message off the old TuFifo. Caller now owns the memory. Returns 0 if nothing there. Since the addition of TransactionUsers, this method is deprecated. This only looks into the old TuFifo that is not associated with any TransactionUser.
Definition at line 1088 of file SipStack.cxx.
| void SipStack::registerTransactionUser | ( | TransactionUser & | tu, |
| const bool | front = false |
||
| ) |
add a TU to the TU selection chain
Adds a TU to the TU selection chain. Tu's do not call receive or receiveAny, the SipStack will call postToTu on the appropriate Tu. Messages not associated with a registered TU go into SipStack::mTuFifo.
Definition at line 1217 of file SipStack.cxx.
| void SipStack::reloadCertificates | ( | ) |
reload the TLS X.509 certificates
reloads the X.509 certificate for each transport.
Definition at line 323 of file SipStack.cxx.
| void SipStack::reloadDnsServers | ( | ) |
Check if DnsServers list has changed, and if so reinitializes the DNS resolver (ares).
Any lookups currenlty in progress will fail.
Definition at line 1285 of file SipStack.cxx.
| void SipStack::removeTransport | ( | unsigned int | transportKey | ) |
Used to remove a previously added transport.
| transportKey | The key for the transpor to remove. Use Transport::getKey to get the key of a transport after it is added to the stack. |
Definition at line 620 of file SipStack.cxx.
| void SipStack::requestTransactionUserShutdown | ( | TransactionUser & | tu | ) |
Queue a shutdown request to the specified TU.
Definition at line 1223 of file SipStack.cxx.
| void SipStack::run | ( | ) |
Causes this SipStack object to create and run threads for carrying out processing.
This includes a thread for DNS lookups, a thread for transaction processing, and a thread for transport processing (individual Transport objects may be registered as having their own thread; these are not serviced by the thread spawned by this call). This function is intended to be used in addition to the normal method/s of giving the SipStack cycles (eg; EventStackThread, StackThread, etc); these are still necessary to give the SipStack cycles for handling application timers, statistics logging, and shutdown logic.
Definition at line 258 of file SipStack.cxx.
| void SipStack::send | ( | const SipMessage & | msg, |
| TransactionUser * | tu = 0 |
||
| ) |
allows a TU to send a message
Interface for the TU to send a message. Makes a copy of the SipMessage. Caller is responsible for deleting the memory and may do so as soon as it returns. Loose Routing processing as per RFC3261 must be done before calling send by the TU. See Helper::processStrictRoute
| msg | SipMessage to send. |
| tu | TransactionUser to send from. |
Definition at line 867 of file SipStack.cxx.
| void SipStack::send | ( | std::unique_ptr< SipMessage > | msg, |
| TransactionUser * | tu = 0 |
||
| ) |
Definition at line 884 of file SipStack.cxx.
|
inline |
force the a message out over an existing connection
This is only if you want to force send to only send over an existing connection. If there is no connection, then it will try the next tuple.
If there are no more Tuples to try, then a 503 is sent to the TU. Makes a copy of the SipMessage. Caller is responsible for deleting the memory and may do so as soon as it returns.
| msg | SipMessage to send. |
| tuple | Destination to send to, specified as a Tuple. A connection to this destination must exist. |
| tu | TransactionUser to send from. |
Definition at line 1284 of file SipStack.hxx.
| void SipStack::sendTo | ( | const SipMessage & | msg, |
| const Tuple & | tuple, | ||
| TransactionUser * | tu = 0 |
||
| ) |
send a message to a destination not in the route
This is only if you want to send to a destination not in the route. Useful for implementing Outbound Proxy use. Makes a copy of the SipMessage. Caller is responsible for deleting the memory and may do so as soon as it returns.
| msg | SipMessage to send. |
| tuple | Destination to send to, specified as a Tuple. |
| tu | TransactionUser to send from. |
Definition at line 937 of file SipStack.cxx.
| void SipStack::sendTo | ( | const SipMessage & | msg, |
| const Uri & | uri, | ||
| TransactionUser * | tu = 0 |
||
| ) |
send a message to a destination not in the route
This is only if you want to send to a destination not in the route. Useful for implementing Outbound Proxy use. Makes a copy of the SipMessage. Caller is responsible for deleting the memory and may do so as soon as it returns.
| msg | SipMessage to send. |
| uri | Destination to send to, specified as a Uri. |
| tu | TransactionUser to send from. |
Definition at line 922 of file SipStack.cxx.
| void SipStack::sendTo | ( | std::unique_ptr< SipMessage > | msg, |
| const Tuple & | tuple, | ||
| TransactionUser * | tu = 0 |
||
| ) |
this is only if you want to send to a destination not in the route.
Definition at line 908 of file SipStack.cxx.
| void SipStack::sendTo | ( | std::unique_ptr< SipMessage > | msg, |
| const Uri & | uri, | ||
| TransactionUser * | tu = 0 |
||
| ) |
this is only if you want to send to a destination not in the route.
Definition at line 898 of file SipStack.cxx.
|
inline |
Installs a handler for the stacks internal StatisticsManager.
This handler is called before the default behavior.
Definition at line 902 of file SipStack.hxx.
| void SipStack::setFallbackPostNotify | ( | AsyncProcessHandler * | handler | ) |
Definition at line 1110 of file SipStack.cxx.
|
inline |
Definition at line 1050 of file SipStack.hxx.
| void SipStack::setTransportSipMessageLoggingHandler | ( | std::shared_ptr< Transport::SipMessageLoggingHandler > | handler | ) |
Used by the application to provide a handler that will get called for all inbound and outbound SIP messages on transports that are added after calling this.
Clears any handlers that have been added previously.
| handler | std::shared_ptr to a handler to call for inbound and outbound SIP messages for all transports added after calling this. |
Definition at line 332 of file SipStack.cxx.
|
inline |
Definition at line 1055 of file SipStack.hxx.
| void SipStack::shutdown | ( | ) |
perform orderly shutdown
Inform the transaction state machine processor that it should not create any new transactions and to perform an orderly shutdown. When the transactions are all terminated, return a ShutdownMessage to the TU.
Definition at line 280 of file SipStack.cxx.
| void SipStack::shutdownAndJoinThreads | ( | ) |
Shutdown and join any threads that the SipStack is running.
Definition at line 294 of file SipStack.cxx.
| Fifo< TransactionMessage > & SipStack::stateMacFifo | ( | ) |
Returns the fifo that subclasses of Transport should use for the rxFifo cons.
param.
Definition at line 716 of file SipStack.cxx.
| const bool SipStack::statisticsManagerEnabled | ( | ) | const |
Definition at line 1297 of file SipStack.cxx.
| void SipStack::terminateFlow | ( | const resip::Tuple & | flow | ) |
Definition at line 1334 of file SipStack.cxx.
| void SipStack::unregisterTransactionUser | ( | TransactionUser & | tu | ) |
Removes a TU from the TU selection chain.
Definition at line 1230 of file SipStack.cxx.
| void SipStack::zeroOutStatistics | ( | ) |
Resets all of the cumulative statistics counters.
Definition at line 1197 of file SipStack.cxx.
|
friend |
Definition at line 1271 of file SipStack.hxx.
|
friend |
Definition at line 1272 of file SipStack.hxx.
|
friend |
Definition at line 1273 of file SipStack.hxx.
|
friend |
Definition at line 1274 of file SipStack.hxx.
|
friend |
Definition at line 1275 of file SipStack.hxx.
|
friend |
Definition at line 1277 of file SipStack.hxx.
|
friend |
Definition at line 1276 of file SipStack.hxx.
|
friend |
Definition at line 1278 of file SipStack.hxx.