atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
GzipInflateTransformation.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 LinkedIn Corp. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
4  * except in compliance with the License. You may obtain a copy of the license at
5  * http://www.apache.org/licenses/LICENSE-2.0
6  *
7  * Unless required by applicable law or agreed to in writing, software distributed under the
8  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
9  * either express or implied.
10  *
11  */
12 
13 /**
14  * @file GzipInflateTransformation.h
15  * @author Brian Geffon
16  * @author Manjesh Nilange
17  * @brief Gzip Inflate Transformation can be used to decompress gzipped content.
18  */
19 
20 #pragma once
21 #ifndef ATSCPPAPI_GZIPINFLATETRANSFORMATION_H_
22 #define ATSCPPAPI_GZIPINFLATETRANSFORMATION_H_
23 
24 #include <string>
26 
27 namespace atscppapi {
28 
29 namespace transformations {
30 
31 /**
32  * Internal state for Inflate Transformations
33  * @private
34  */
35 class GzipInflateTransformationState;
36 
37 /**
38  * @brief A TransformationPlugin to easily add gzip inflate to your TransformationPlugin chain.
39  *
40  * The GzipInflateTransformation is a helper transformation that can be used
41  * to easily decompress gzipped content. For a full example of GzipInflateTransformation
42  * and GzipDeflateTransformation see examples/gzip_transformation/.
43  *
44  * @note GzipDeflateTransformation DOES NOT set or check Content-Encoding headers, it is the
45  * users responsibility to set any applicable headers and check that the content is acctually
46  * gzipped by checking the Content-Encoding header before creating a GzipInflateTransformation,
47  * see examples/gzip_transformation/ for a full example.
48  *
49  * @see GzipDeflateTransformation
50  */
52 public:
53  /**
54  * A full example of how to use GzipInflateTransformation and GzipDeflateTransformation is available
55  * in examples/gzip_tranformation/
56  *
57  * @param transaction As with any TransformationPlugin you must pass in the transaction
58  * @param type because the GzipInflateTransformation can be used with both requests and responses
59  * you must specify the Type.
60  *
61  * @see TransformationPlugin::Type
62  */
64 
65  /**
66  * Any TransformationPlugin must implement consume(), this method will take content
67  * from the transformation chain and gzip decompress it.
68  *
69  * @param data the input data to decompress
70  */
71  void consume(const std::string &);
72 
73  /**
74  * Any TransformationPlugin must implement handleInputComplete(), this method will
75  * finalize the gzip decompression.
76  */
77  void handleInputComplete();
78 
79  virtual ~GzipInflateTransformation();
80 private:
81  GzipInflateTransformationState *state_; /** Internal state for Gzip Deflate Transformations */
82 };
83 
84 } /* transformations */
85 
86 } /* atscppapi */
87 
88 #endif /* ATSCPPAPI_GZIPINFLATETRANSFORMATION_H_ */