reSIProcate/DialogUsageManager  9680
DialogUsageManager.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_DIALOGUSAGEMANAGER_HXX)
00002 #define RESIP_DIALOGUSAGEMANAGER_HXX
00003 
00004 #include <vector>
00005 #include <set>
00006 #include <map>
00007 
00008 #include "resip/stack/Headers.hxx"
00009 #include "resip/dum/EventDispatcher.hxx"
00010 #include "resip/dum/DialogEventInfo.hxx"
00011 #include "resip/dum/DialogSet.hxx"
00012 #include "resip/dum/DumTimeout.hxx"
00013 #include "resip/dum/HandleManager.hxx"
00014 #include "resip/dum/Handles.hxx"
00015 #include "resip/dum/MergedRequestKey.hxx"
00016 #include "resip/dum/RegistrationPersistenceManager.hxx"
00017 #include "resip/dum/ServerSubscription.hxx"
00018 #include "rutil/BaseException.hxx"
00019 #include "rutil/SharedPtr.hxx"
00020 #include "rutil/ThreadIf.hxx"
00021 #include "resip/stack/SipStack.hxx"
00022 #include "resip/stack/TransactionUser.hxx"
00023 #include "resip/dum/DumFeature.hxx"
00024 #include "resip/dum/DumFeatureChain.hxx"
00025 #include "resip/dum/DumFeatureMessage.hxx"
00026 #include "resip/dum/TargetCommand.hxx"
00027 #include "resip/dum/ClientSubscriptionFunctor.hxx"
00028 #include "resip/dum/ServerSubscriptionFunctor.hxx"
00029 
00030 namespace resip 
00031 {
00032 
00033 class Security;
00034 class SipStack;
00035 class FdSet;
00036 class MasterProfile;
00037 class RedirectManager;
00038 class ClientAuthManager;
00039 class ServerAuthManager;
00040 class Uri;
00041 class Contents;
00042 
00043 class ClientRegistrationHandler;
00044 class ServerRegistrationHandler;
00045 class InviteSessionHandler;
00046 class ClientSubscriptionHandler;
00047 class ServerSubscriptionHandler;
00048 class ClientPublicationHandler;
00049 class ServerPublicationHandler;
00050 class ClientPagerMessageHandler;
00051 class ServerPagerMessageHandler;
00052 class OutOfDialogHandler;
00053 class RedirectHandler;
00054 class DialogSetHandler;
00055 class RequestValidationHandler;
00056 
00057 class Dialog;
00058 class InviteSessionCreator;
00059 
00060 class AppDialogSetFactory;
00061 class DumShutdownHandler;
00062 class RemoteCertStore;
00063 
00064 class KeepAliveManager;
00065 class HttpGetMessage;
00066 
00067 class ConnectionTerminated;
00068 
00069 class Lockable;
00070 
00071 class ExternalMessageBase;
00072 class ExternalMessageHandler;
00073 
00074 class DialogEventStateManager;
00075 class DialogEventHandler;
00076 
00077 class DialogUsageManager : public HandleManager, public TransactionUser
00078 {
00079    public:
00080       class Exception : public BaseException
00081       {
00082          public:
00083             Exception(const Data& msg,
00084                       const Data& file,
00085                       int line)
00086                : BaseException(msg, file, line)
00087             {}
00088             
00089             virtual const char* name() const {return "DialogUsageManager::Exception";}
00090       };
00091 
00092       typedef enum
00093       {
00094          None = 0,
00095          Sign,
00096          Encrypt,
00097          SignAndEncrypt
00098       } EncryptionLevel;
00099   
00100       // If createDefaultFeatures is true dum will construct a
00101       // IdentityHandler->EncryptionManager chain.
00102       DialogUsageManager(SipStack& stack, bool createDefaultFeatures=false);
00103       virtual ~DialogUsageManager();
00104       
00105       // !bwc! Maybe add a giveUpSeconds param to these.
00106       void shutdown(DumShutdownHandler*);
00107 
00108       // !bwc! This is not properly implemented (has an assert(0) in it). 
00109       // I am removing this declaration.
00110       // void shutdownIfNoUsages(DumShutdownHandler*);
00111 
00112       void forceShutdown(DumShutdownHandler*);
00113 
00114       void addTransport( TransportType protocol,
00115                          int port=0, 
00116                          IpVersion version=V4,
00117                          const Data& ipInterface = Data::Empty, 
00118                          const Data& sipDomainname = Data::Empty, // only used
00119                                                                   // for TLS
00120                                                                   // based stuff 
00121                          const Data& privateKeyPassPhrase = Data::Empty,
00122                          SecurityTypes::SSLType sslType = SecurityTypes::TLSv1,
00123                          unsigned transportFlags = 0);
00124 
00125       SipStack& getSipStack();
00126       const SipStack& getSipStack() const;
00127       Security* getSecurity();
00128       
00129       Data getHostAddress();
00130 
00131       void setAppDialogSetFactory(std::auto_ptr<AppDialogSetFactory>);
00132 
00133       void setMasterProfile(const SharedPtr<MasterProfile>& masterProfile);
00134       SharedPtr<MasterProfile>& getMasterProfile();
00135       SharedPtr<UserProfile>& getMasterUserProfile();
00136       
00137       //optional handler to track the progress of DialogSets
00138       void setDialogSetHandler(DialogSetHandler* handler);
00139 
00140       void setKeepAliveManager(std::auto_ptr<KeepAliveManager> keepAlive);
00141 
00142       //There is a default RedirectManager.  Setting one may cause the old one
00143       //to be deleted. 
00144       void setRedirectManager(std::auto_ptr<RedirectManager> redirect);
00145       //informational, so a RedirectHandler is not required
00146       void setRedirectHandler(RedirectHandler* handler);      
00147       RedirectHandler* getRedirectHandler();      
00148 
00151       void setClientAuthManager(std::auto_ptr<ClientAuthManager> client);
00152 
00154       void setServerAuthManager(resip::SharedPtr<ServerAuthManager> server);
00155 
00158       void setInviteSessionHandler(InviteSessionHandler*);
00159       
00161       void setClientRegistrationHandler(ClientRegistrationHandler*);
00162 
00164       void setServerRegistrationHandler(ServerRegistrationHandler*);
00165 
00167       void addClientSubscriptionHandler(const Data& eventType, ClientSubscriptionHandler*);
00168 
00170       void addClientPublicationHandler(const Data& eventType, ClientPublicationHandler*);
00171       
00172       void addServerSubscriptionHandler(const Data& eventType, ServerSubscriptionHandler*);
00173       void addServerPublicationHandler(const Data& eventType, ServerPublicationHandler*);
00174       
00175       void addOutOfDialogHandler(MethodTypes, OutOfDialogHandler*);
00176 
00177       void setRequestValidationHandler(RequestValidationHandler*);
00178 
00179       void setClientPagerMessageHandler(ClientPagerMessageHandler*);
00180       void setServerPagerMessageHandler(ServerPagerMessageHandler*);
00181 
00184       void addExternalMessageHandler(ExternalMessageHandler* handler);
00185       void removeExternalMessageHandler(ExternalMessageHandler* handler);
00186       void clearExternalMessageHandler();
00187 
00189       void setRegistrationPersistenceManager(RegistrationPersistenceManager*);
00190 
00191       void setRemoteCertStore(std::auto_ptr<RemoteCertStore> store);
00192       
00193       // The message is owned by the underlying datastructure and may go away in
00194       // the future. If the caller wants to keep it, it should make a copy. The
00195       // memory will exist at least up until the point where the application
00196       // calls DialogUsageManager::send(msg);
00197       SharedPtr<SipMessage> makeInviteSession(const NameAddr& target, const SharedPtr<UserProfile>& userProfile, const Contents* initialOffer, AppDialogSet* ads = 0);
00198       SharedPtr<SipMessage> makeInviteSession(const NameAddr& target, const Contents* initialOffer, AppDialogSet* ads = 0);
00199       SharedPtr<SipMessage> makeInviteSession(const NameAddr& target, const SharedPtr<UserProfile>& userProfile, const Contents* initialOffer, EncryptionLevel level, const Contents* alternative = 0, AppDialogSet* ads = 0);
00200       SharedPtr<SipMessage> makeInviteSession(const NameAddr& target, const Contents* initialOffer, EncryptionLevel level, const Contents* alternative = 0, AppDialogSet* ads = 0);
00201       // Versions that add a replaces header
00202       SharedPtr<SipMessage> makeInviteSession(const NameAddr& target, InviteSessionHandle sessionToReplace, const SharedPtr<UserProfile>& userProfile, const Contents* initialOffer, AppDialogSet* ads = 0);
00203       SharedPtr<SipMessage> makeInviteSession(const NameAddr& target, InviteSessionHandle sessionToReplace, const SharedPtr<UserProfile>& userProfile, const Contents* initialOffer, EncryptionLevel level = None, const Contents* alternative = 0, AppDialogSet* ads = 0);
00204       SharedPtr<SipMessage> makeInviteSession(const NameAddr& target, InviteSessionHandle sessionToReplace, const Contents* initialOffer, EncryptionLevel level = None, const Contents* alternative = 0, AppDialogSet* ads = 0);
00205       
00206       //will send a Notify(100)...currently can be decorated through the
00207       //OnReadyToSend callback.  Probably will change it's own callback/handler soon
00208       SharedPtr<SipMessage> makeInviteSessionFromRefer(const SipMessage& refer, ServerSubscriptionHandle, 
00209                                                        const Contents* initialOffer, AppDialogSet* = 0);
00210       SharedPtr<SipMessage> makeInviteSessionFromRefer(const SipMessage& refer, const SharedPtr<UserProfile>& userProfile, 
00211                                                        const Contents* initialOffer, AppDialogSet* appDs = 0);
00212       SharedPtr<SipMessage> makeInviteSessionFromRefer(const SipMessage& refer, ServerSubscriptionHandle, 
00213                                                        const Contents* initialOffer, EncryptionLevel level = None, const Contents* alternative = 0, AppDialogSet* = 0);
00214       SharedPtr<SipMessage> makeInviteSessionFromRefer(const SipMessage& refer, const SharedPtr<UserProfile>& userProfile, ServerSubscriptionHandle, 
00215                                                        const Contents* initialOffer, EncryptionLevel level = None, const Contents* alternative = 0, AppDialogSet* = 0);
00216       
00217       SharedPtr<SipMessage> makeSubscription(const NameAddr& target, const SharedPtr<UserProfile>& userProfile, const Data& eventType, AppDialogSet* = 0);
00218       SharedPtr<SipMessage> makeSubscription(const NameAddr& target, const SharedPtr<UserProfile>& userProfile, const Data& eventType, 
00219                                              UInt32 subscriptionTime, AppDialogSet* = 0);
00220       SharedPtr<SipMessage> makeSubscription(const NameAddr& target, const SharedPtr<UserProfile>& userProfile, const Data& eventType, 
00221                                              UInt32 subscriptionTime, int refreshInterval, AppDialogSet* = 0);
00222       SharedPtr<SipMessage> makeSubscription(const NameAddr& target, const Data& eventType, AppDialogSet* = 0);
00223       SharedPtr<SipMessage> makeSubscription(const NameAddr& target, const Data& eventType, UInt32 subscriptionTime, AppDialogSet* = 0);
00224       SharedPtr<SipMessage> makeSubscription(const NameAddr& target, const Data& eventType, 
00225                                              UInt32 subscriptionTime, int refreshInterval, AppDialogSet* = 0);
00226 
00227       //unsolicited refer
00228       SharedPtr<SipMessage> makeRefer(const NameAddr& target, const SharedPtr<UserProfile>& userProfile, const H_ReferTo::Type& referTo, AppDialogSet* = 0);
00229       SharedPtr<SipMessage> makeRefer(const NameAddr& target, const H_ReferTo::Type& referTo, AppDialogSet* = 0);
00230 
00231       SharedPtr<SipMessage> makePublication(const NameAddr& target, 
00232                                             const SharedPtr<UserProfile>& userProfile, 
00233                                             const Contents& body, 
00234                                             const Data& eventType, 
00235                                             UInt32 expiresSeconds, 
00236                                             AppDialogSet* = 0);
00237       SharedPtr<SipMessage> makePublication(const NameAddr& target, 
00238                                             const Contents& body, 
00239                                             const Data& eventType, 
00240                                             UInt32 expiresSeconds, 
00241                                             AppDialogSet* = 0);
00242 
00243       SharedPtr<SipMessage> makeRegistration(const NameAddr& target, const SharedPtr<UserProfile>& userProfile, AppDialogSet* = 0);
00244       SharedPtr<SipMessage> makeRegistration(const NameAddr& target, const SharedPtr<UserProfile>& userProfile, UInt32 registrationTime, AppDialogSet* = 0);
00245       SharedPtr<SipMessage> makeRegistration(const NameAddr& target, AppDialogSet* = 0);
00246       SharedPtr<SipMessage> makeRegistration(const NameAddr& target, UInt32 registrationTime, AppDialogSet* = 0);
00247 
00248       SharedPtr<SipMessage> makeOutOfDialogRequest(const NameAddr& target, const SharedPtr<UserProfile>& userProfile, const MethodTypes meth, AppDialogSet* = 0);
00249       SharedPtr<SipMessage> makeOutOfDialogRequest(const NameAddr& target, const MethodTypes meth, AppDialogSet* = 0);
00250 
00251       ClientPagerMessageHandle makePagerMessage(const NameAddr& target, const SharedPtr<UserProfile>& userProfile, AppDialogSet* = 0);
00252       ClientPagerMessageHandle makePagerMessage(const NameAddr& target, AppDialogSet* = 0);
00253       
00254       void end(DialogSetId invSessionId);
00255       void send(SharedPtr<SipMessage> request);
00256       void sendCommand(SharedPtr<SipMessage> request);
00257 
00258       class SendCommand : public DumCommandAdapter
00259       {
00260          public:
00261             SendCommand(SharedPtr<SipMessage> request,
00262                         DialogUsageManager& dum):
00263                mRequest(request),
00264                mDum(dum)
00265             {}
00266             
00267             virtual ~SendCommand(){}
00268 
00269             virtual void executeCommand()
00270             {
00271                mDum.send(mRequest);
00272             }
00273 
00274             virtual EncodeStream& encodeBrief(EncodeStream& strm) const
00275             {
00276                return strm << "DialogUsageManager::SendCommand" << std::endl;
00277             }
00278 
00279          protected:
00280             SharedPtr<SipMessage> mRequest;
00281             DialogUsageManager& mDum;
00282       };
00283 
00284       //void send(SipMessage& request, EncryptionLevel level);
00285       
00286       // give dum an opportunity to handle its events. If process() returns true
00287       // there are more events to process.
00288       bool hasEvents() const;
00289       bool process(Lockable* mutex = NULL);  // non-blocking
00290       bool process(int timeoutMs, Lockable* mutex = NULL);   // Specify -1 for infinte timeout
00291 
00292       AppDialogHandle findAppDialog(const DialogId& id);
00293       AppDialogSetHandle findAppDialogSet(const DialogSetId& id);
00294 
00295       InviteSessionHandle findInviteSession(DialogId id);
00296       //if the handle is inValid, int represents the errorcode
00297       std::pair<InviteSessionHandle, int> findInviteSession(CallId replaces);
00298 
00299       ClientPublicationHandler* getClientPublicationHandler(const Data& eventType);
00300       ServerPublicationHandler* getServerPublicationHandler(const Data& eventType);
00301 
00302       ClientSubscriptionHandler* getClientSubscriptionHandler(const Data& eventType);
00303       ServerSubscriptionHandler* getServerSubscriptionHandler(const Data& eventType);
00304 
00305       // will apply the specified functor(which takes a
00306       //ServerSubscriptionHandle) to each matching ServerSubscription.  
00307       //Returns the functor after the last application.
00308       template<typename UnaryFunction>
00309       UnaryFunction applyToServerSubscriptions(const Data& aor, 
00310                                                const Data& eventType, 
00311                                                UnaryFunction applyFn)
00312       {
00313          Data key = eventType + aor;
00314          std::pair<ServerSubscriptions::iterator,ServerSubscriptions::iterator> 
00315             range = mServerSubscriptions.equal_range(key);
00316          
00317          for (ServerSubscriptions::iterator i=range.first; i!=range.second; ++i)
00318          {
00319             ServerSubscriptionHandle h = i->second->getHandle();
00320             applyFn(h);
00321          }
00322          return applyFn;         
00323       }
00324 
00325       //DUM will delete features in its destructor. Feature manipulation should
00326       //be done before any processing starts.
00327       //ServerAuthManager is now a DumFeature; setServerAuthManager is a special
00328       //case of addFeature; the ServerAuthManager should always be the first
00329       //feature in the chain.
00330       void addIncomingFeature(resip::SharedPtr<DumFeature> feat);
00331       void addOutgoingFeature(resip::SharedPtr<DumFeature> feat);
00332 
00333       void setOutgoingMessageInterceptor(resip::SharedPtr<DumFeature> feat);
00334 
00335       TargetCommand::Target& dumIncomingTarget();
00336 
00337       TargetCommand::Target& dumOutgoingTarget();
00338 
00339       //exposed so DumThread variants can be written
00340       Message* getNext(int ms) { return mFifo.getNext(ms); }
00341       void internalProcess(std::auto_ptr<Message> msg);
00342       bool messageAvailable(void) { return mFifo.messageAvailable(); }
00343 
00344       void applyToAllClientSubscriptions(ClientSubscriptionFunctor*);
00345       void applyToAllServerSubscriptions(ServerSubscriptionFunctor*);
00346 
00348       void registerForConnectionTermination(Postable*);
00349       void unRegisterForConnectionTermination(Postable*);
00350 
00351       // The DialogEventStateManager is returned so that the client can query it for
00352       // the current set of active dialogs (useful when accepting a dialog event subscription).
00353       // The caller is responsible for deleting the DialogEventStateManager
00354       // at the same time it deletes other handlers when DUM is destroyed.
00355       DialogEventStateManager* createDialogEventStateManager(DialogEventHandler* handler);
00356 
00357    protected:
00358       virtual void onAllHandlesDestroyed();      
00359       //TransactionUser virtuals
00360       virtual const Data& name() const;
00361       friend class DumThread;
00362 
00363       DumFeatureChain::FeatureList mIncomingFeatureList;
00364       DumFeatureChain::FeatureList mOutgoingFeatureList;
00365       
00366       SharedPtr<DumFeature> mOutgoingMessageInterceptor;
00367 
00368       typedef std::map<Data, DumFeatureChain*> FeatureChainMap;
00369       FeatureChainMap mIncomingFeatureChainMap;
00370       FeatureChainMap mOutgoingFeatureChainMap;
00371   
00372    private:     
00373       friend class Dialog;
00374       friend class DialogSet;
00375 
00376       friend class ClientInviteSession;
00377       friend class ClientOutOfDialogReq;
00378       friend class ClientPublication;
00379       friend class ClientRegistration;
00380       friend class ClientSubscription;
00381       friend class InviteSession;
00382       friend class ServerInviteSession;
00383       friend class ServerOutOfDialogReq;
00384       friend class ServerPublication;
00385       friend class ServerRegistration;
00386       friend class ServerSubscription;
00387       friend class BaseUsage;
00388       friend class ClientPagerMessage;
00389       friend class ServerPagerMessage;
00390       friend class KeepAliveAssociation;
00391       friend class NetworkAssociation;
00392 
00393       friend class MergedRequestRemovalCommand;
00394       friend class TargetCommand::Target;
00395 
00396       class IncomingTarget : public TargetCommand::Target
00397       {
00398          public:
00399             IncomingTarget(DialogUsageManager& dum) : TargetCommand::Target(dum) 
00400             {
00401             }
00402 
00403             virtual void post(std::auto_ptr<Message> msg)
00404             {
00405                mDum.incomingProcess(msg);
00406             }
00407       };
00408       
00409       class OutgoingTarget : public TargetCommand::Target
00410       {
00411          public:
00412             OutgoingTarget(DialogUsageManager& dum) : TargetCommand::Target(dum) 
00413             {
00414             }
00415 
00416             virtual void post(std::auto_ptr<Message> msg)
00417             {
00418                mDum.outgoingProcess(msg);
00419             }
00420       };
00421 
00422       DialogSet* makeUacDialogSet(BaseCreator* creator, AppDialogSet* appDs);
00423       SharedPtr<SipMessage> makeNewSession(BaseCreator* creator, AppDialogSet* appDs);
00424 
00425       // makes a proto response to a request
00426       void makeResponse(SipMessage& response, 
00427                         const SipMessage& request, 
00428                         int responseCode, 
00429                         const Data& reason = Data::Empty) const;
00430       // May call a callback to let the app adorn
00431       void sendResponse(const SipMessage& response);
00432 
00433       void sendUsingOutboundIfAppropriate(UserProfile& userProfile, std::auto_ptr<SipMessage> msg);
00434 
00435       void addTimer(DumTimeout::Type type,
00436                     unsigned long durationSeconds,
00437                     BaseUsageHandle target, 
00438                     unsigned int seq, 
00439                     unsigned int altseq=0);
00440 
00441       void addTimerMs(DumTimeout::Type type,
00442                         unsigned long duration,
00443                         BaseUsageHandle target, 
00444                         unsigned int seq, 
00445                         unsigned int altseq=0,
00446                         const Data &transactionId = Data::Empty);
00447 
00448       Dialog& findOrCreateDialog(const SipMessage* msg);
00449       Dialog* findDialog(const DialogId& id);
00450       DialogSet* findDialogSet(const DialogSetId& id);
00451       
00452       // return 0, if no matching BaseCreator
00453       BaseCreator* findCreator(const DialogId& id);
00454 
00455       void processRequest(const SipMessage& request);
00456       void processResponse(const SipMessage& response);
00457       bool validateRequestURI(const SipMessage& request);
00458       bool validateRequiredOptions(const SipMessage& request);
00459       bool validateContent(const SipMessage& request);
00460       bool validateAccept(const SipMessage& request);
00461       bool validateTo(const SipMessage& request);
00462       bool validate100RelSuport(const SipMessage& request);
00463       
00464       bool mergeRequest(const SipMessage& request);
00465 
00466       void processPublish(const SipMessage& publish);
00467 
00468       void removeDialogSet(const DialogSetId& );      
00469 
00470       bool checkEventPackage(const SipMessage& request);
00471 
00472       bool queueForIdentityCheck(SipMessage* msg);
00473       void processIdentityCheckResponse(const HttpGetMessage& msg);
00474 
00475       void incomingProcess(std::auto_ptr<Message> msg);
00476       void outgoingProcess(std::auto_ptr<Message> msg);
00477       void processExternalMessage(ExternalMessageBase* externalMessage);
00478 
00479       // For delayed delete of a Usage
00480       void destroy(const BaseUsage* usage);
00481       void destroy(DialogSet*);
00482       void destroy(Dialog*);
00483 
00484       void requestMergedRequestRemoval(const MergedRequestKey&);
00485       void removeMergedRequest(const MergedRequestKey&);
00486 
00487       typedef std::set<MergedRequestKey> MergedRequests;
00488       MergedRequests mMergedRequests;
00489             
00490       typedef std::map<Data, DialogSet*> CancelMap;
00491       CancelMap mCancelMap;
00492       
00493       typedef HashMap<DialogSetId, DialogSet*> DialogSetMap;
00494       DialogSetMap mDialogSetMap;
00495 
00496       SharedPtr<MasterProfile> mMasterProfile;
00497       SharedPtr<UserProfile> mMasterUserProfile;
00498       std::auto_ptr<RedirectManager>   mRedirectManager;
00499       std::auto_ptr<ClientAuthManager> mClientAuthManager;
00500       //std::auto_ptr<ServerAuthManager> mServerAuthManager;  
00501     
00502       InviteSessionHandler* mInviteSessionHandler;
00503       ClientRegistrationHandler* mClientRegistrationHandler;
00504       ServerRegistrationHandler* mServerRegistrationHandler;      
00505       RedirectHandler* mRedirectHandler;
00506       DialogSetHandler* mDialogSetHandler;      
00507       RequestValidationHandler* mRequestValidationHandler;
00508 
00509       RegistrationPersistenceManager *mRegistrationPersistenceManager;
00510 
00511       OutOfDialogHandler* getOutOfDialogHandler(const MethodTypes type);
00512 
00513       std::map<Data, ClientSubscriptionHandler*> mClientSubscriptionHandlers;
00514       std::map<Data, ServerSubscriptionHandler*> mServerSubscriptionHandlers;
00515       std::map<Data, ClientPublicationHandler*> mClientPublicationHandlers;
00516       std::map<Data, ServerPublicationHandler*> mServerPublicationHandlers;
00517       std::map<MethodTypes, OutOfDialogHandler*> mOutOfDialogHandlers;
00518       std::auto_ptr<KeepAliveManager> mKeepAliveManager;
00519       bool mIsDefaultServerReferHandler;
00520 
00521       ClientPagerMessageHandler* mClientPagerMessageHandler;
00522       ServerPagerMessageHandler* mServerPagerMessageHandler;
00523       std::vector<ExternalMessageHandler*> mExternalMessageHandlers;
00524 
00525       // a pointer because we'll only initialize if we add a
00526       // server subscription handler for the 'dialog' event...
00527       DialogEventStateManager* mDialogEventStateManager;
00528 
00529       std::auto_ptr<AppDialogSetFactory> mAppDialogSetFactory;
00530 
00531       SipStack& mStack;
00532       DumShutdownHandler* mDumShutdownHandler;
00533       typedef enum 
00534       {
00535          Running,
00536          ShutdownRequested, // while ending usages
00537          RemovingTransactionUser, // while removing TU from stack
00538          Shutdown,  // after TU has been removed from stack
00539          Destroying // while calling destructor
00540       } ShutdownState;
00541       ShutdownState mShutdownState;
00542 
00543       // from ETag -> ServerPublication
00544       typedef std::map<Data, ServerPublication*> ServerPublications;
00545       ServerPublications mServerPublications;
00546       typedef std::map<Data, SipMessage*> RequiresCerts;
00547       RequiresCerts mRequiresCerts;      
00548       // from Event-Type+document-aor -> ServerSubscription
00549       // Managed by ServerSubscription
00550       typedef std::multimap<Data, ServerSubscription*> ServerSubscriptions;
00551       ServerSubscriptions mServerSubscriptions;
00552 
00553       IncomingTarget* mIncomingTarget;
00554       OutgoingTarget* mOutgoingTarget;
00555       ThreadIf::TlsKey mThreadDebugKey;
00556       ThreadIf::TlsKey mHiddenThreadDebugKey;
00557 
00558       EventDispatcher<ConnectionTerminated> mConnectionTerminatedEventDispatcher;
00559 };
00560 
00561 }
00562 
00563 #endif
00564 
00565 /* ====================================================================
00566  * The Vovida Software License, Version 1.0 
00567  * 
00568  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00569  * 
00570  * Redistribution and use in source and binary forms, with or without
00571  * modification, are permitted provided that the following conditions
00572  * are met:
00573  * 
00574  * 1. Redistributions of source code must retain the above copyright
00575  *    notice, this list of conditions and the following disclaimer.
00576  * 
00577  * 2. Redistributions in binary form must reproduce the above copyright
00578  *    notice, this list of conditions and the following disclaimer in
00579  *    the documentation and/or other materials provided with the
00580  *    distribution.
00581  * 
00582  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00583  *    and "Vovida Open Communication Application Library (VOCAL)" must
00584  *    not be used to endorse or promote products derived from this
00585  *    software without prior written permission. For written
00586  *    permission, please contact vocal@vovida.org.
00587  *
00588  * 4. Products derived from this software may not be called "VOCAL", nor
00589  *    may "VOCAL" appear in their name, without prior written
00590  *    permission of Vovida Networks, Inc.
00591  * 
00592  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00593  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00594  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00595  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00596  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00597  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00598  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00599  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00600  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00601  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00602  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00603  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00604  * DAMAGE.
00605  * 
00606  * ====================================================================
00607  * 
00608  * This software consists of voluntary contributions made by Vovida
00609  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00610  * Inc.  For more information on Vovida Networks, Inc., please see
00611  * <http://www.vovida.org/>.
00612  *
00613  */