blob: c465148b5b1b9a81990888fe5723795333651412 (
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
|
/**
* @file HTTP_StreamPolicy.h
*
* @author Martin Corino <mcorino@remedy.nl>
*/
#ifndef ACE_HTTP_STREAM_POLICY_H
#define ACE_HTTP_STREAM_POLICY_H
#include /**/ "ace/pre.h"
#include "ace/INet/INet_Export.h"
#include "ace/INet/HTTP_StreamPolicyBase.h"
#include "ace/INet/HTTP_IOStream.h"
#include "ace/INet/String_IOStream.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
namespace ACE
{
namespace HTTP
{
/**
* @class ACE_HTTP_FixedLengthStreamPolicy
*
* @brief Implements stream policy for fixed length data stream
* in HTTP response or request.
*
*/
template <class STREAM_BUFFER>
class FixedLengthStreamPolicyBase
: public StreamPolicyBase<STREAM_BUFFER>
{
public:
typedef typename STREAM_BUFFER::char_type char_type;
FixedLengthStreamPolicyBase (std::streamsize length);
virtual ~FixedLengthStreamPolicyBase ();
protected:
virtual int read_from_stream (char_type* buffer, std::streamsize length);
virtual int write_to_stream (const char_type* buffer, std::streamsize length);
private:
std::streamsize length_;
std::streamsize count_;
};
typedef FixedLengthStreamPolicyBase<StreamBuffer> FixedLengthStreamPolicy;
/**
* @class ACE_HTTP_ChunkedTransferStreamPolicy
*
* @brief Implements stream policy for chunked data streams
* in HTTP response or request.
*
*/
template <class STREAM_BUFFER>
class ChunkedTransferStreamPolicyBase
: public StreamPolicyBase<STREAM_BUFFER>
{
public:
typedef typename STREAM_BUFFER::char_type char_type;
typedef ACE::IOS::String_OStreamBase<char_type> buffer_type;
ChunkedTransferStreamPolicyBase ();
virtual ~ChunkedTransferStreamPolicyBase ();
protected:
virtual int read_from_stream (char_type* buffer, std::streamsize length);
virtual int write_to_stream (const char_type* buffer, std::streamsize length);
int getc ();
private:
std::streamsize chunk_cnt_;
buffer_type chunk_;
};
typedef ChunkedTransferStreamPolicyBase<StreamBuffer> ChunkedTransferStreamPolicy;
}
}
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/INet/HTTP_StreamPolicy.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("HTTP_StreamPolicy.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* ACE_HTTP_STREAM_POLICY_H */
|