OCSPDenier.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2002-2009 Moxie Marlinspike
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 3 of the
  7. * License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  17. * USA
  18. */
  19. #ifndef __OCSP_DENIER_H__
  20. #define __OCSP_DENIER_H__
  21. #include <string>
  22. #include <boost/asio.hpp>
  23. #include <boost/shared_ptr.hpp>
  24. #include <boost/bind.hpp>
  25. #include "HttpHeaders.hpp"
  26. using namespace boost::asio;
  27. class OCSPDenier {
  28. private:
  29. static OCSPDenier *ocspDenier;
  30. static const char *ocspResponse;
  31. OCSPDenier() {}
  32. void readComplete(boost::shared_ptr<ip::tcp::socket> socket,
  33. boost::shared_ptr<unsigned char> buffer,
  34. boost::shared_ptr<HttpHeaders> headers,
  35. const boost::system::error_code &error,
  36. size_t bytesRead);
  37. void writeComplete(boost::shared_ptr<ip::tcp::socket> socket,
  38. const boost::system::error_code &error);
  39. public:
  40. static OCSPDenier* getInstance();
  41. void denyOCSPRequest(boost::shared_ptr<ip::tcp::socket> socket);
  42. };
  43. #endif