Mixe for Privacy and Anonymity in the Internet
CATLSClientSocket.hpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2000, The JAP-Team
00003 All rights reserved.
00004 Redistribution and use in source and binary forms, with or without modification,
00005 are permitted provided that the following conditions are met:
00006 
00007   - Redistributions of source code must retain the above copyright notice,
00008     this list of conditions and the following disclaimer.
00009 
00010   - Redistributions in binary form must reproduce the above copyright notice,
00011     this list of conditions and the following disclaimer in the documentation and/or
00012     other materials provided with the distribution.
00013 
00014   - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors
00015     may be used to endorse or promote products derived from this software without specific
00016     prior written permission.
00017 
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
00020 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
00021 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
00022 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00024 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
00025 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00027 */
00028 
00029 #ifndef __CATLSCLIENTSOCKET_HPP__
00030 #define __CATLSCLIENTSOCKET_HPP__
00031 #ifndef ONLY_LOCAL_PROXY
00032 #include "CASocketAddr.hpp"
00033 #include "CASocket.hpp"
00034 #include "CAMsg.hpp"
00035 #include "CACertificate.hpp"
00046 #define DEFAULT_HANDSHAKE_TIMEOUT 4
00047 
00048 class CATLSClientSocket:public CASocket
00049 {
00050 
00051 public:
00052   CATLSClientSocket();
00053   ~CATLSClientSocket();
00054   SINT32 sendFully(const UINT8* buff,UINT32 len);
00055   SINT32 send(const UINT8* buff,UINT32 len);
00056   SINT32 receive(UINT8* buff,UINT32 len);
00057   SINT32 close();
00058 
00060   SINT32 connect(CASocketAddr & psa, UINT32 msTimeout);
00061 
00062   /*
00063   SINT32 connect(CASocketAddr & psa)
00064     {
00065       return connect(psa, 1, 0);
00066     }*/
00067 
00072   SINT32 setServerCertificate(CACertificate* pCert);
00073 
00074 protected:
00075 
00076   /*CASocket* getSocket()
00077   {
00078     return m_pSocket;
00079   }*/
00080 
00081 private:
00082   SINT32 doTLSConnect(CASocketAddr &psa);
00083 
00084   SSL *m_pSSL;
00085   SSL_CTX *m_pCtx;
00086   //CASocket* m_pSocket;
00087   CACertificate *m_pRootCert;
00089   bool m_bConnectedTLS;
00090 };
00091 
00092 #endif
00093 #endif //ONLY_LOCAL_PROXY