PageRenderTime 76ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/mordor/socks.h

http://github.com/mozy/mordor
C Header | 45 lines | 31 code | 13 blank | 1 comment | 0 complexity | 7d05255b9f608f927af28d7466167ec0 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. #ifndef __MORDOR_SOCKS_H__
  2. #define __MORDOR_SOCKS_H__
  3. // Copyright (c) 2010 - Mozy, Inc.
  4. #include <boost/shared_ptr.hpp>
  5. #include "mordor/exception.h"
  6. namespace Mordor {
  7. struct IPAddress;
  8. class Stream;
  9. struct URI;
  10. namespace HTTP {
  11. class StreamBroker;
  12. }
  13. namespace SOCKS {
  14. struct Exception : virtual Mordor::Exception {};
  15. struct ProtocolViolationException : virtual Exception {};
  16. struct NoAcceptableAuthenticationMethodException : virtual Exception {};
  17. struct InvalidResponseException : virtual Exception
  18. {
  19. InvalidResponseException(unsigned char status)
  20. : m_status(status)
  21. {}
  22. unsigned char status() const { return m_status; }
  23. private:
  24. unsigned char m_status;
  25. };
  26. boost::shared_ptr<Stream> tunnel(boost::shared_ptr<HTTP::StreamBroker> streamBroker,
  27. const URI &proxy, boost::shared_ptr<IPAddress> targetIP,
  28. const std::string &targetDomain = std::string(),
  29. unsigned short targetPort = 0,
  30. unsigned char version = 5);
  31. }}
  32. #endif