/[resiprocate]/main/resip/dum/test/certServer.cxx
ViewVC logotype

Diff of /main/resip/dum/test/certServer.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

main/sip/resiprocate/dum/test/certServer.cxx revision 3593 by jason, Tue Nov 23 06:13:16 2004 UTC branches/b-directory-reorg/resip/dum/test/certServer.cxx revision 5283 by derek, Fri Aug 19 01:27:14 2005 UTC
# Line 2  Line 2 
2  #  define usleep(t) Sleep(t)  #  define usleep(t) Sleep(t)
3  #endif  #endif
4    
 #define HAVE_POPT_H  
   
5  #if defined (HAVE_POPT_H)  #if defined (HAVE_POPT_H)
6  #include <popt.h>  #include <popt.h>
7  #endif  #endif
8    
9  #include <signal.h>  #include <signal.h>
10    
11  #include "resiprocate/NameAddr.hxx"  #include "resip/stack/NameAddr.hxx"
12  #include "resiprocate/Pkcs8Contents.hxx"  #include "resip/stack/Pkcs8Contents.hxx"
13  #include "resiprocate/SipMessage.hxx"  #include "resip/stack/SipMessage.hxx"
14  #include "resiprocate/Symbols.hxx"  #include "resip/stack/Symbols.hxx"
15  #include "resiprocate/Uri.hxx"  #include "resip/stack/Uri.hxx"
16  #include "resiprocate/X509Contents.hxx"  #include "resip/stack/X509Contents.hxx"
17  #include "resiprocate/dum/AppDialogSet.hxx"  #include "resip/dum/AppDialogSet.hxx"
18  #include "resiprocate/dum/ClientAuthManager.hxx"  #include "resip/dum/ClientAuthManager.hxx"
19  #include "resiprocate/dum/DialogUsageManager.hxx"  #include "resip/dum/DialogUsageManager.hxx"
20  #include "resiprocate/dum/DumShutdownHandler.hxx"  #include "resip/dum/DumShutdownHandler.hxx"
21  #include "resiprocate/dum/OutOfDialogHandler.hxx"  #include "resip/dum/OutOfDialogHandler.hxx"
22  #include "resiprocate/dum/Profile.hxx"  #include "resip/dum/MasterProfile.hxx"
23  #include "resiprocate/dum/PublicationHandler.hxx"  #include "resip/dum/PublicationHandler.hxx"
24  #include "resiprocate/dum/RegistrationHandler.hxx"  #include "resip/dum/RegistrationHandler.hxx"
25  #include "resiprocate/dum/ServerPublication.hxx"  #include "resip/dum/ServerPublication.hxx"
26  #include "resiprocate/dum/ServerSubscription.hxx"  #include "resip/dum/ServerSubscription.hxx"
27  #include "resiprocate/dum/SubscriptionHandler.hxx"  #include "resip/dum/SubscriptionHandler.hxx"
28  #include "resiprocate/os/Log.hxx"  #include "rutil/Log.hxx"
29  #include "resiprocate/os/Logger.hxx"  #include "rutil/Logger.hxx"
30  #include "resiprocate/os/Random.hxx"  #include "rutil/Random.hxx"
31  #include "resiprocate/os/Subsystem.hxx"  #include "rutil/Subsystem.hxx"
32    
33  #define RESIPROCATE_SUBSYSTEM Subsystem::TEST  #define RESIPROCATE_SUBSYSTEM Subsystem::TEST
34    
# Line 193  Line 191 
191           {           {
192              // !jf! really need to do this async. send neutral state in the meantime,              // !jf! really need to do this async. send neutral state in the meantime,
193              // blah blah blah              // blah blah blah
194              mSecurity.generateUserCert(h->getDocumentKey(), Data::Empty);              mSecurity.generateUserCert(h->getDocumentKey());
195           }           }
196    
197           if (mSecurity.hasUserCert(h->getDocumentKey()))           if (mSecurity.hasUserCert(h->getDocumentKey()))
# Line 277  Line 275 
275  class CertServer : public OutOfDialogHandler,  public DialogUsageManager  class CertServer : public OutOfDialogHandler,  public DialogUsageManager
276  {  {
277     public:     public:
278        CertServer(const resip::NameAddr& me) :        CertServer(const resip::NameAddr& me, SipStack& stack) :
279           DialogUsageManager(),           DialogUsageManager(stack),
280           mCertServer(getSecurity()),           mCertServer(*getSecurity()),
281           mPrivateKeyServer(getSecurity()),           mPrivateKeyServer(*getSecurity()),
282           mCertUpdater(getSecurity()),           mCertUpdater(*getSecurity()),
283           mPrivateKeyUpdater(getSecurity())           mPrivateKeyUpdater(*getSecurity()),
284             mDone(false)
285        {        {
286           addTransport(UDP, 5100);           addTransport(UDP, 5100);
287           addTransport(TCP, 5100);           addTransport(TCP, 5100);
288           addTransport(TLS, 5101, V4, Data::Empty, me.uri().host(), Data::Empty);           addTransport(TLS, 5101, V4, Data::Empty, me.uri().host(), Data::Empty);
289                    
290           mProfile.clearSupportedMethods();           mProfile = new MasterProfile;
291           mProfile.addSupportedMethod(PUBLISH);           mProfile->clearSupportedMethods();
292           mProfile.addSupportedMethod(SUBSCRIBE);           mProfile->addSupportedMethod(PUBLISH);
293           mProfile.validateAcceptEnabled() = true;           mProfile->addSupportedMethod(SUBSCRIBE);
294           mProfile.validateContentEnabled() = true;           mProfile->validateAcceptEnabled() = true;
295           mProfile.addSupportedMimeType(Pkcs8Contents::getStaticType());           mProfile->validateContentEnabled() = true;
296           mProfile.addSupportedMimeType(X509Contents::getStaticType());           mProfile->addSupportedMimeType(PUBLISH, Pkcs8Contents::getStaticType());
297             mProfile->addSupportedMimeType(SUBSCRIBE, Pkcs8Contents::getStaticType());
298             mProfile->addSupportedMimeType(PUBLISH, X509Contents::getStaticType());
299             mProfile->addSupportedMimeType(SUBSCRIBE, X509Contents::getStaticType());
300                    
301           mProfile.setDefaultFrom(me);           mProfile.setDefaultFrom(me);
302           setProfile(&mProfile);           setMasterProfile(mProfile);
303    
304           addServerSubscriptionHandler(Symbols::Credential, &mPrivateKeyServer);           addServerSubscriptionHandler(Symbols::Credential, &mPrivateKeyServer);
305           addServerSubscriptionHandler(Symbols::Certificate, &mCertServer);           addServerSubscriptionHandler(Symbols::Certificate, &mCertServer);
# Line 342  Line 344 
344        }        }
345    
346     private:     private:
347        Profile mProfile;        SharedPtr<MasterProfile> mProfile;
348        CertSubscriptionHandler mCertServer;        CertSubscriptionHandler mCertServer;
349        PrivateKeySubscriptionHandler mPrivateKeyServer;        PrivateKeySubscriptionHandler mPrivateKeyServer;
350        CertPublicationHandler mCertUpdater;        CertPublicationHandler mCertUpdater;
# Line 395  Line 397 
397  #endif  #endif
398    
399     NameAddr domain(myUrl);     NameAddr domain(myUrl);
400     CertServer server(domain);     SipStack stack;
401       CertServer server(domain, stack);
402     server.run();     server.run();
403     return 0;     return 0;
404  }  }
405    
406    
407    /* ====================================================================
408     * The Vovida Software License, Version 1.0
409     *
410     * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
411     *
412     * Redistribution and use in source and binary forms, with or without
413     * modification, are permitted provided that the following conditions
414     * are met:
415     *
416     * 1. Redistributions of source code must retain the above copyright
417     *    notice, this list of conditions and the following disclaimer.
418     *
419     * 2. Redistributions in binary form must reproduce the above copyright
420     *    notice, this list of conditions and the following disclaimer in
421     *    the documentation and/or other materials provided with the
422     *    distribution.
423     *
424     * 3. The names "VOCAL", "Vovida Open Communication Application Library",
425     *    and "Vovida Open Communication Application Library (VOCAL)" must
426     *    not be used to endorse or promote products derived from this
427     *    software without prior written permission. For written
428     *    permission, please contact vocal@vovida.org.
429     *
430     * 4. Products derived from this software may not be called "VOCAL", nor
431     *    may "VOCAL" appear in their name, without prior written
432     *    permission of Vovida Networks, Inc.
433     *
434     * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
435     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
436     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
437     * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
438     * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
439     * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
440     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
441     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
442     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
443     * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
444     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
445     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
446     * DAMAGE.
447     *
448     * ====================================================================
449     *
450     * This software consists of voluntary contributions made by Vovida
451     * Networks, Inc. and many individuals on behalf of Vovida Networks,
452     * Inc.  For more information on Vovida Networks, Inc., please see
453     * <http://www.vovida.org/>.
454     *
455     */

Legend:
Removed from v.3593  
changed lines
  Added in v.5283

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27