summaryrefslogtreecommitdiff
path: root/ACE/protocols/ace/INet/ClientRequestHandler.h
blob: 660eeeaddee91d69b8c26da10eff546116c367e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/**
 * @file ClientRequestHandler.h
 *
 * @author Martin Corino <mcorino@remedy.nl>
 */

#ifndef ACE_INET_CLIENT_REQUEST_HANDLER_H
#define ACE_INET_CLIENT_REQUEST_HANDLER_H

#include /**/ "ace/pre.h"

#include "ace/SString.h"
#include "ace/Singleton.h"
#include "ace/Synch_Traits.h"
#include "ace/Null_Mutex.h"
#include "ace/Thread_Mutex.h"
#include "ace/INet/INet_Export.h"
#include "ace/INet/RequestHandler.h"
#include "ace/INet/ConnectionCache.h"
#include <iostream>

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE
  {
    namespace INet
      {
        class URL_Base; // forward

        /**
        * @class ACE_INet_ClientRequestHandler
        *
        * @brief
        *
        */
        class ACE_INET_Export ClientRequestHandler
          : public RequestHandler
          {
            public:
              ClientRequestHandler ();
              virtual ~ClientRequestHandler ();

              virtual std::istream& handle_open_request (const URL_Base& url) = 0;

              virtual std::istream& response_stream () = 0;

              virtual bool is_response_ok () const = 0;

              static ConnectionCache& connection_cache ();

            private:
              typedef ACE_Singleton<ConnectionCache,
                                    ACE_SYNCH_MUTEX> TConnectionCacheSingleton;
          };

        /**
        * @class ACE_INet_ClientINetRequestHandler
        *
        * @brief
        *
        */
        class ACE_INET_Export ClientINetRequestHandler
          : public ClientRequestHandler
          {
            public:
              ClientINetRequestHandler ();
              virtual ~ClientINetRequestHandler ();

              /**
              * @class ACE_INet_INetConnectionKey
              *
              * @brief
              *
              */
              class ACE_INET_Export INetConnectionKey
                : public ConnectionKey
                {
                  public:
                    INetConnectionKey (const ACE_CString& host,
                                       u_short port);
                    virtual ~INetConnectionKey ();

                    virtual u_long hash () const;

                    virtual ConnectionKey* duplicate () const;

                    const ACE_CString& host () const;

                    u_short port () const;

                  protected:
                    virtual bool equal (const ConnectionKey& key) const;

                  private:
                    ACE_CString host_;
                    u_short port_;
                };
          };

      }
  }

ACE_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
#include "ace/INet/ClientRequestHandler.inl"
#endif

#include /**/ "ace/post.h"
#endif /* ACE_INET_CLIENT_REQUEST_HANDLER_H */