PageRenderTime 66ms CodeModel.GetById 41ms app.highlight 3ms RepoModel.GetById 17ms 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
 1#ifndef __MORDOR_SOCKS_H__
 2#define __MORDOR_SOCKS_H__
 3// Copyright (c) 2010 - Mozy, Inc.
 4
 5#include <boost/shared_ptr.hpp>
 6
 7#include "mordor/exception.h"
 8
 9namespace Mordor {
10
11struct IPAddress;
12class Stream;
13struct URI;
14
15namespace HTTP {
16
17class StreamBroker;
18
19}
20
21namespace SOCKS {
22
23struct Exception : virtual Mordor::Exception {};
24struct ProtocolViolationException : virtual Exception {};
25struct NoAcceptableAuthenticationMethodException : virtual Exception {};
26struct InvalidResponseException : virtual Exception
27{
28    InvalidResponseException(unsigned char status)
29        : m_status(status)
30    {}
31
32    unsigned char status() const { return m_status; }
33private:
34    unsigned char m_status;
35};
36
37boost::shared_ptr<Stream> tunnel(boost::shared_ptr<HTTP::StreamBroker> streamBroker,
38    const URI &proxy, boost::shared_ptr<IPAddress> targetIP,
39    const std::string &targetDomain = std::string(),
40    unsigned short targetPort = 0,
41    unsigned char version = 5);
42
43}}
44
45#endif