OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_TOOLS_BALSA_BALSA_VISITOR_INTERFACE_H_ | 5 #ifndef NET_TOOLS_BALSA_BALSA_VISITOR_INTERFACE_H_ |
6 #define NET_TOOLS_BALSA_BALSA_VISITOR_INTERFACE_H_ | 6 #define NET_TOOLS_BALSA_BALSA_VISITOR_INTERFACE_H_ |
7 | 7 |
8 #include <cstddef> | 8 #include <cstddef> |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 12 matching lines...) Expand all Loading... |
23 virtual ~BalsaVisitorInterface() {} | 23 virtual ~BalsaVisitorInterface() {} |
24 | 24 |
25 // Summary: | 25 // Summary: |
26 // This is how the BalsaFrame passes you the raw input which it knows to | 26 // This is how the BalsaFrame passes you the raw input which it knows to |
27 // be a part of the body. To be clear, every byte of the Balsa which isn't | 27 // be a part of the body. To be clear, every byte of the Balsa which isn't |
28 // part of the header (or its framing), or trailers will be passed through | 28 // part of the header (or its framing), or trailers will be passed through |
29 // this function. This includes data as well as chunking framing. | 29 // this function. This includes data as well as chunking framing. |
30 // Arguments: | 30 // Arguments: |
31 // input - contains the bytes available for read. | 31 // input - contains the bytes available for read. |
32 // size - contains the number of bytes it is safe to read from input. | 32 // size - contains the number of bytes it is safe to read from input. |
33 virtual void ProcessBodyInput(const char *input, size_t size) = 0; | 33 virtual void ProcessBodyInput(const char* input, size_t size) = 0; |
34 | 34 |
35 // Summary: | 35 // Summary: |
36 // This is like ProcessBodyInput, but it will only include those parts of | 36 // This is like ProcessBodyInput, but it will only include those parts of |
37 // the body which would be stored by a program such as wget, i.e. the bytes | 37 // the body which would be stored by a program such as wget, i.e. the bytes |
38 // indicating chunking (it will have been omitted). Trailers will not be | 38 // indicating chunking (it will have been omitted). Trailers will not be |
39 // passed in through this function-- they'll be passed in through | 39 // passed in through this function-- they'll be passed in through |
40 // ProcessTrailers. | 40 // ProcessTrailers. |
41 // Arguments: | 41 // Arguments: |
42 // input - contains the bytes available for read. | 42 // input - contains the bytes available for read. |
43 // size - contains the number of bytes it is safe to read from input. | 43 // size - contains the number of bytes it is safe to read from input. |
44 virtual void ProcessBodyData(const char *input, size_t size) = 0; | 44 virtual void ProcessBodyData(const char* input, size_t size) = 0; |
45 | 45 |
46 // Summary: | 46 // Summary: |
47 // BalsaFrame passes the raw header data through this function. This is | 47 // BalsaFrame passes the raw header data through this function. This is |
48 // not cleaned up in any way. | 48 // not cleaned up in any way. |
49 // Arguments: | 49 // Arguments: |
50 // input - contains the bytes available for read. | 50 // input - contains the bytes available for read. |
51 // size - contains the number of bytes it is safe to read from input. | 51 // size - contains the number of bytes it is safe to read from input. |
52 virtual void ProcessHeaderInput(const char *input, size_t size) = 0; | 52 virtual void ProcessHeaderInput(const char* input, size_t size) = 0; |
53 | 53 |
54 // Summary: | 54 // Summary: |
55 // BalsaFrame passes the raw trailer data through this function. This is | 55 // BalsaFrame passes the raw trailer data through this function. This is |
56 // not cleaned up in any way. Note that trailers only occur in a message | 56 // not cleaned up in any way. Note that trailers only occur in a message |
57 // if there was a chunked encoding, and not always then. | 57 // if there was a chunked encoding, and not always then. |
58 // | 58 // |
59 // Arguments: | 59 // Arguments: |
60 // input - contains the bytes available for read. | 60 // input - contains the bytes available for read. |
61 // size - contains the number of bytes it is safe to read from input. | 61 // size - contains the number of bytes it is safe to read from input. |
62 virtual void ProcessTrailerInput(const char *input, size_t size) = 0; | 62 virtual void ProcessTrailerInput(const char* input, size_t size) = 0; |
63 | 63 |
64 // Summary: | 64 // Summary: |
65 // Since the BalsaFrame already has to parse the headers in order to | 65 // Since the BalsaFrame already has to parse the headers in order to |
66 // determine proper framing, it might as well pass the parsed and | 66 // determine proper framing, it might as well pass the parsed and |
67 // cleaned-up results to whatever might need it. This function exists for | 67 // cleaned-up results to whatever might need it. This function exists for |
68 // that purpose-- parsed headers are passed into this function. | 68 // that purpose-- parsed headers are passed into this function. |
69 // Arguments: | 69 // Arguments: |
70 // headers - contains the parsed headers in the order in which | 70 // headers - contains the parsed headers in the order in which |
71 // they occured in the header. | 71 // they occured in the header. |
72 virtual void ProcessHeaders(const BalsaHeaders& headers) = 0; | 72 virtual void ProcessHeaders(const BalsaHeaders& headers) = 0; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // bytes it is safe to read from line_ptr) | 106 // bytes it is safe to read from line_ptr) |
107 // version_input - pointer to the beginning of the version string. | 107 // version_input - pointer to the beginning of the version string. |
108 // version_length - length of the version string (i.e. the number | 108 // version_length - length of the version string (i.e. the number |
109 // of bytes it i ssafe to read from version_input) | 109 // of bytes it i ssafe to read from version_input) |
110 // status_input - pointer to the beginning of the status string | 110 // status_input - pointer to the beginning of the status string |
111 // status_length - length of the status string (i.e. the number | 111 // status_length - length of the status string (i.e. the number |
112 // of bytes it is safe to read from status_input) | 112 // of bytes it is safe to read from status_input) |
113 // reason_input - pointer to the beginning of the reason string | 113 // reason_input - pointer to the beginning of the reason string |
114 // reason_length - length of the reason string (i.e. the number | 114 // reason_length - length of the reason string (i.e. the number |
115 // of bytes it is safe to read from reason_input) | 115 // of bytes it is safe to read from reason_input) |
116 virtual void ProcessResponseFirstLine(const char *line_input, | 116 virtual void ProcessResponseFirstLine(const char* line_input, |
117 size_t line_length, | 117 size_t line_length, |
118 const char *version_input, | 118 const char* version_input, |
119 size_t version_length, | 119 size_t version_length, |
120 const char *status_input, | 120 const char* status_input, |
121 size_t status_length, | 121 size_t status_length, |
122 const char *reason_input, | 122 const char* reason_input, |
123 size_t reason_length) = 0; | 123 size_t reason_length) = 0; |
124 | 124 |
125 // Called when a chunk length is parsed. | 125 // Called when a chunk length is parsed. |
126 // Arguments: | 126 // Arguments: |
127 // chunk length - the length of the next incoming chunk. | 127 // chunk length - the length of the next incoming chunk. |
128 virtual void ProcessChunkLength(size_t chunk_length) = 0; | 128 virtual void ProcessChunkLength(size_t chunk_length) = 0; |
129 | 129 |
130 // Summary: | 130 // Summary: |
131 // BalsaFrame passes the raw chunk extension data through this function. | 131 // BalsaFrame passes the raw chunk extension data through this function. |
132 // The data is not cleaned up at all, use | 132 // The data is not cleaned up at all, use |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // with the BytesSpliced() function, but in the future other interesting | 171 // with the BytesSpliced() function, but in the future other interesting |
172 // errors could occur. | 172 // errors could occur. |
173 // Arguments: | 173 // Arguments: |
174 // framer - the framer in which an error occured. | 174 // framer - the framer in which an error occured. |
175 virtual void HandleBodyError(BalsaFrame* framer) = 0; | 175 virtual void HandleBodyError(BalsaFrame* framer) = 0; |
176 }; | 176 }; |
177 | 177 |
178 } // namespace net | 178 } // namespace net |
179 | 179 |
180 #endif // NET_TOOLS_BALSA_BALSA_VISITOR_INTERFACE_H_ | 180 #endif // NET_TOOLS_BALSA_BALSA_VISITOR_INTERFACE_H_ |
OLD | NEW |