reSIProcate/stack  9694
TlsTransport.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_TLSTRANSPORT_HXX)
00002 #define RESIP_TLSTRANSPORT_HXX
00003 
00004 #if defined(HAVE_CONFIG_H)
00005   #include "config.h"
00006 #endif
00007 
00008 
00009 #include "resip/stack/TcpBaseTransport.hxx"
00010 #include "resip/stack/SecurityTypes.hxx"
00011 #include "rutil/HeapInstanceCounter.hxx"
00012 #include "resip/stack/Compression.hxx"
00013 
00014 #include <openssl/ssl.h>
00015 
00016 namespace resip
00017 {
00018 
00019 class Connection;
00020 class Message;
00021 class Security;
00022 
00023 class TlsTransport : public TcpBaseTransport
00024 {
00025    public:
00026       RESIP_HeapCount(TlsTransport);
00027       TlsTransport(Fifo<TransactionMessage>& fifo, 
00028                    int portNum, 
00029                    IpVersion version,
00030                    const Data& interfaceObj,
00031                    Security& security,
00032                    const Data& sipDomain, 
00033                    SecurityTypes::SSLType sslType,
00034                    AfterSocketCreationFuncPtr socketFunc=0,
00035                    Compression &compression = Compression::Disabled,
00036                    unsigned transportFlags = 0,
00037                    SecurityTypes::TlsClientVerificationMode cvm = SecurityTypes::None,
00038                    bool useEmailAsSIP = false);
00039       virtual  ~TlsTransport();
00040 
00041       TransportType transport() const { return TLS; }
00042       SSL_CTX* getCtx() const;
00043 
00044       SecurityTypes::TlsClientVerificationMode getClientVerificationMode() 
00045          { return mClientVerificationMode; };
00046       bool isUseEmailAsSIP()
00047          { return mUseEmailAsSIP; };
00048 
00049    protected:
00050       Connection* createConnection(const Tuple& who, Socket fd, bool server=false);
00051 
00052       Security* mSecurity;
00053       SecurityTypes::SSLType mSslType;
00054       SSL_CTX* mDomainCtx;
00055       SecurityTypes::TlsClientVerificationMode mClientVerificationMode;
00056       /* If true, we will accept the email address in a client's subjectAltName
00057          as if it were a SIP URI.  This is convenient because many commercial
00058          CAs offer email certificates but not sip: certificates */
00059       bool mUseEmailAsSIP;
00060 };
00061 
00062 }
00063 
00064 #endif
00065 
00066 /* ====================================================================
00067  * The Vovida Software License, Version 1.0 
00068  * 
00069  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00070  * 
00071  * Redistribution and use in source and binary forms, with or without
00072  * modification, are permitted provided that the following conditions
00073  * are met:
00074  * 
00075  * 1. Redistributions of source code must retain the above copyright
00076  *    notice, this list of conditions and the following disclaimer.
00077  * 
00078  * 2. Redistributions in binary form must reproduce the above copyright
00079  *    notice, this list of conditions and the following disclaimer in
00080  *    the documentation and/or other materials provided with the
00081  *    distribution.
00082  * 
00083  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00084  *    and "Vovida Open Communication Application Library (VOCAL)" must
00085  *    not be used to endorse or promote products derived from this
00086  *    software without prior written permission. For written
00087  *    permission, please contact vocal@vovida.org.
00088  *
00089  * 4. Products derived from this software may not be called "VOCAL", nor
00090  *    may "VOCAL" appear in their name, without prior written
00091  *    permission of Vovida Networks, Inc.
00092  * 
00093  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00094  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00095  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00096  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00097  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00098  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00099  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00100  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00101  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00102  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00103  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00104  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00105  * DAMAGE.
00106  * 
00107  * ====================================================================
00108  * 
00109  * This software consists of voluntary contributions made by Vovida
00110  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00111  * Inc.  For more information on Vovida Networks, Inc., please see
00112  * <http://www.vovida.org/>.
00113  *
00114  */