<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.6"/> <title>HTP: htp_decompressors.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">HTP  <span id="projectnumber">0.5</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.6 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_5edaa2d740570af18be6e40ef0aff597.html">htp</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">htp_decompressors.h</div> </div> </div><!--header--> <div class="contents"> <a href="htp__decompressors_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/***************************************************************************</span></div> <div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright (c) 2009-2010 Open Information Security Foundation</span></div> <div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * Copyright (c) 2010-2013 Qualys, Inc.</span></div> <div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * All rights reserved.</span></div> <div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * </span></div> <div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * Redistribution and use in source and binary forms, with or without</span></div> <div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * modification, are permitted provided that the following conditions are</span></div> <div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * met:</span></div> <div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * </span></div> <div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * - Redistributions of source code must retain the above copyright</span></div> <div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * notice, this list of conditions and the following disclaimer.</span></div> <div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"></span></div> <div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * - Redistributions in binary form must reproduce the above copyright</span></div> <div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span></div> <div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> * documentation and/or other materials provided with the distribution.</span></div> <div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"></span></div> <div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * - Neither the name of the Qualys, Inc. nor the names of its</span></div> <div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * contributors may be used to endorse or promote products derived from</span></div> <div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * this software without specific prior written permission.</span></div> <div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * </span></div> <div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span></div> <div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span></div> <div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"> * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR</span></div> <div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment"> * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT</span></div> <div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="comment"> * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span></div> <div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</span></div> <div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment"> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</span></div> <div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="comment"> * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY</span></div> <div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="comment"> * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span></div> <div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span></div> <div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="comment"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></div> <div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="comment"> ***************************************************************************/</span></div> <div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div> <div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#ifndef _HTP_DECOMPRESSORS_H</span></div> <div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="preprocessor"></span><span class="preprocessor">#define _HTP_DECOMPRESSORS_H</span></div> <div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="preprocessor"></span></div> <div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="preprocessor">#ifdef __cplusplus</span></div> <div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div> <div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="preprocessor">#endif</span></div> <div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="preprocessor"></span></div> <div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="preprocessor">#include <zlib.h></span></div> <div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div> <div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="htp__decompressors_8h.html#a5dd71861da3e1f5080511ab6586055ff"> 48</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structhtp__decompressor__gzip__t.html">htp_decompressor_gzip_t</a> <a class="code" href="structhtp__decompressor__gzip__t.html">htp_decompressor_gzip_t</a>;</div> <div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="htp__decompressors_8h.html#a7f23b81d6eb7ef6ad376b44c8e4605c1"> 49</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structhtp__decompressor__t.html">htp_decompressor_t</a> <a class="code" href="structhtp__decompressor__t.html">htp_decompressor_t</a>;</div> <div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div> <div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="htp__decompressors_8h.html#ae65a4e64c9d4a3e2f4943ea7a44b8adb"> 51</a></span> <span class="preprocessor">#define GZIP_BUF_SIZE 8192</span></div> <div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="preprocessor"></span></div> <div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="htp__decompressors_8h.html#abb144770689923bccb264c3540eee4b7"> 53</a></span> <span class="preprocessor">#define DEFLATE_MAGIC_1 0x1f</span></div> <div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="htp__decompressors_8h.html#a2b3eed58aeef09cc2dc0dd58bb377453"> 54</a></span> <span class="preprocessor"></span><span class="preprocessor">#define DEFLATE_MAGIC_2 0x8b</span></div> <div class="line"><a name="l00055"></a><span class="lineno"> 55</span> <span class="preprocessor"></span></div> <div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="structhtp__decompressor__t.html"> 56</a></span> <span class="keyword">struct </span><a class="code" href="structhtp__decompressor__t.html">htp_decompressor_t</a> {</div> <div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="structhtp__decompressor__t.html#a53fe4f7a73937c77a2fa1f6be79a57f4"> 57</a></span>  <a class="code" href="htp__core_8h.html#ab8a71422665c0773654b9b4d96f01e31">htp_status_t</a> (*<a class="code" href="structhtp__decompressor__t.html#a53fe4f7a73937c77a2fa1f6be79a57f4">decompress</a>)(<a class="code" href="structhtp__decompressor__t.html">htp_decompressor_t</a> *, <a class="code" href="structhtp__tx__data__t.html">htp_tx_data_t</a> *);</div> <div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="structhtp__decompressor__t.html#ad3046ebb97adb46ded21e4e6ed527afa"> 58</a></span>  <a class="code" href="htp__core_8h.html#ab8a71422665c0773654b9b4d96f01e31">htp_status_t</a> (*<a class="code" href="structhtp__decompressor__t.html#ad3046ebb97adb46ded21e4e6ed527afa">callback</a>)(<a class="code" href="structhtp__tx__data__t.html">htp_tx_data_t</a> *);</div> <div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="structhtp__decompressor__t.html#a7d98d14adde9a6bab556567891082d6e"> 59</a></span>  void (*<a class="code" href="structhtp__decompressor__t.html#a7d98d14adde9a6bab556567891082d6e">destroy</a>)(<a class="code" href="structhtp__decompressor__t.html">htp_decompressor_t</a> *);</div> <div class="line"><a name="l00060"></a><span class="lineno"> 60</span> };</div> <div class="line"><a name="l00061"></a><span class="lineno"> 61</span> </div> <div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="structhtp__decompressor__gzip__t.html"> 62</a></span> <span class="keyword">struct </span><a class="code" href="structhtp__decompressor__gzip__t.html">htp_decompressor_gzip_t</a> {</div> <div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="structhtp__decompressor__gzip__t.html#a5f287949bbff40f77e8719b91e3f7cd2"> 63</a></span>  <a class="code" href="structhtp__decompressor__t.html">htp_decompressor_t</a> <a class="code" href="structhtp__decompressor__gzip__t.html#a5f287949bbff40f77e8719b91e3f7cd2">super</a>;</div> <div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <span class="preprocessor"> #if 0</span></div> <div class="line"><a name="l00065"></a><span class="lineno"> 65</span> <span class="preprocessor"></span> <span class="keywordtype">int</span> initialized;</div> <div class="line"><a name="l00066"></a><span class="lineno"> 66</span> <span class="preprocessor"> #endif</span></div> <div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="structhtp__decompressor__gzip__t.html#af42f2bb3f12d6ca3d3c51d95a541e8ce"> 67</a></span> <span class="preprocessor"></span> <span class="keywordtype">int</span> <a class="code" href="structhtp__decompressor__gzip__t.html#af42f2bb3f12d6ca3d3c51d95a541e8ce">zlib_initialized</a>;</div> <div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="structhtp__decompressor__gzip__t.html#aa930aefda566c997c966db39e3db5905"> 68</a></span>  uint8_t <a class="code" href="structhtp__decompressor__gzip__t.html#aa930aefda566c997c966db39e3db5905">header</a>[10];</div> <div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="structhtp__decompressor__gzip__t.html#a536439f4a2b44046c6bcc28dd9566593"> 69</a></span>  uint8_t <a class="code" href="structhtp__decompressor__gzip__t.html#a536439f4a2b44046c6bcc28dd9566593">header_len</a>;</div> <div class="line"><a name="l00070"></a><span class="lineno"><a class="line" href="structhtp__decompressor__gzip__t.html#a5ebe4343b8763690208283f070c5804f"> 70</a></span>  z_stream <a class="code" href="structhtp__decompressor__gzip__t.html#a5ebe4343b8763690208283f070c5804f">stream</a>;</div> <div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="structhtp__decompressor__gzip__t.html#aecaf5f756039f1c1ae695a14670e7947"> 71</a></span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *<a class="code" href="structhtp__decompressor__gzip__t.html#aecaf5f756039f1c1ae695a14670e7947">buffer</a>;</div> <div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="structhtp__decompressor__gzip__t.html#a2e9f37d94c40d914e6aa818b0ad0d1e5"> 72</a></span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="structhtp__decompressor__gzip__t.html#a2e9f37d94c40d914e6aa818b0ad0d1e5">crc</a>; </div> <div class="line"><a name="l00073"></a><span class="lineno"> 73</span> };</div> <div class="line"><a name="l00074"></a><span class="lineno"> 74</span> </div> <div class="line"><a name="l00075"></a><span class="lineno"> 75</span> <a class="code" href="structhtp__decompressor__t.html">htp_decompressor_t</a> *<a class="code" href="htp__decompressors_8h.html#aaa977d514f6a12044d2d754d6e767471">htp_gzip_decompressor_create</a>(<a class="code" href="structhtp__connp__t.html">htp_connp_t</a> *connp, <span class="keyword">enum</span> <a class="code" href="htp__core_8h.html#a54dd952f0e7a73095282e445b39fcc66">htp_content_encoding_t</a> format);</div> <div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div> <div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="preprocessor">#ifdef __cplusplus</span></div> <div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="preprocessor"></span>}</div> <div class="line"><a name="l00079"></a><span class="lineno"> 79</span> <span class="preprocessor">#endif</span></div> <div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="preprocessor"></span></div> <div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <span class="preprocessor">#endif </span><span class="comment">/* _HTP_DECOMPRESSORS_H */</span><span class="preprocessor"></span></div> <div class="line"><a name="l00082"></a><span class="lineno"> 82</span> <span class="preprocessor"></span></div> <div class="ttc" id="structhtp__decompressor__t_html_ad3046ebb97adb46ded21e4e6ed527afa"><div class="ttname"><a href="structhtp__decompressor__t.html#ad3046ebb97adb46ded21e4e6ed527afa">htp_decompressor_t::callback</a></div><div class="ttdeci">htp_status_t(* callback)(htp_tx_data_t *)</div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:58</div></div> <div class="ttc" id="htp__decompressors_8h_html_aaa977d514f6a12044d2d754d6e767471"><div class="ttname"><a href="htp__decompressors_8h.html#aaa977d514f6a12044d2d754d6e767471">htp_gzip_decompressor_create</a></div><div class="ttdeci">htp_decompressor_t * htp_gzip_decompressor_create(htp_connp_t *connp, enum htp_content_encoding_t format)</div><div class="ttdef"><b>Definition:</b> htp_decompressors.c:213</div></div> <div class="ttc" id="structhtp__decompressor__gzip__t_html_aa930aefda566c997c966db39e3db5905"><div class="ttname"><a href="structhtp__decompressor__gzip__t.html#aa930aefda566c997c966db39e3db5905">htp_decompressor_gzip_t::header</a></div><div class="ttdeci">uint8_t header[10]</div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:68</div></div> <div class="ttc" id="htp__core_8h_html_a54dd952f0e7a73095282e445b39fcc66"><div class="ttname"><a href="htp__core_8h.html#a54dd952f0e7a73095282e445b39fcc66">htp_content_encoding_t</a></div><div class="ttdeci">htp_content_encoding_t</div><div class="ttdef"><b>Definition:</b> htp_core.h:143</div></div> <div class="ttc" id="structhtp__decompressor__gzip__t_html_a2e9f37d94c40d914e6aa818b0ad0d1e5"><div class="ttname"><a href="structhtp__decompressor__gzip__t.html#a2e9f37d94c40d914e6aa818b0ad0d1e5">htp_decompressor_gzip_t::crc</a></div><div class="ttdeci">unsigned long crc</div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:72</div></div> <div class="ttc" id="structhtp__decompressor__gzip__t_html_a5f287949bbff40f77e8719b91e3f7cd2"><div class="ttname"><a href="structhtp__decompressor__gzip__t.html#a5f287949bbff40f77e8719b91e3f7cd2">htp_decompressor_gzip_t::super</a></div><div class="ttdeci">htp_decompressor_t super</div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:63</div></div> <div class="ttc" id="structhtp__decompressor__t_html_a53fe4f7a73937c77a2fa1f6be79a57f4"><div class="ttname"><a href="structhtp__decompressor__t.html#a53fe4f7a73937c77a2fa1f6be79a57f4">htp_decompressor_t::decompress</a></div><div class="ttdeci">htp_status_t(* decompress)(htp_decompressor_t *, htp_tx_data_t *)</div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:57</div></div> <div class="ttc" id="structhtp__decompressor__gzip__t_html_a536439f4a2b44046c6bcc28dd9566593"><div class="ttname"><a href="structhtp__decompressor__gzip__t.html#a536439f4a2b44046c6bcc28dd9566593">htp_decompressor_gzip_t::header_len</a></div><div class="ttdeci">uint8_t header_len</div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:69</div></div> <div class="ttc" id="structhtp__decompressor__gzip__t_html"><div class="ttname"><a href="structhtp__decompressor__gzip__t.html">htp_decompressor_gzip_t</a></div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:62</div></div> <div class="ttc" id="htp__core_8h_html_ab8a71422665c0773654b9b4d96f01e31"><div class="ttname"><a href="htp__core_8h.html#ab8a71422665c0773654b9b4d96f01e31">htp_status_t</a></div><div class="ttdeci">int htp_status_t</div><div class="ttdef"><b>Definition:</b> htp_core.h:46</div></div> <div class="ttc" id="structhtp__decompressor__gzip__t_html_aecaf5f756039f1c1ae695a14670e7947"><div class="ttname"><a href="structhtp__decompressor__gzip__t.html#aecaf5f756039f1c1ae695a14670e7947">htp_decompressor_gzip_t::buffer</a></div><div class="ttdeci">unsigned char * buffer</div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:71</div></div> <div class="ttc" id="structhtp__connp__t_html"><div class="ttname"><a href="structhtp__connp__t.html">htp_connp_t</a></div><div class="ttdef"><b>Definition:</b> htp_connection_parser_private.h:51</div></div> <div class="ttc" id="structhtp__decompressor__gzip__t_html_af42f2bb3f12d6ca3d3c51d95a541e8ce"><div class="ttname"><a href="structhtp__decompressor__gzip__t.html#af42f2bb3f12d6ca3d3c51d95a541e8ce">htp_decompressor_gzip_t::zlib_initialized</a></div><div class="ttdeci">int zlib_initialized</div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:67</div></div> <div class="ttc" id="structhtp__decompressor__gzip__t_html_a5ebe4343b8763690208283f070c5804f"><div class="ttname"><a href="structhtp__decompressor__gzip__t.html#a5ebe4343b8763690208283f070c5804f">htp_decompressor_gzip_t::stream</a></div><div class="ttdeci">z_stream stream</div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:70</div></div> <div class="ttc" id="structhtp__decompressor__t_html"><div class="ttname"><a href="structhtp__decompressor__t.html">htp_decompressor_t</a></div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:56</div></div> <div class="ttc" id="structhtp__tx__data__t_html"><div class="ttname"><a href="structhtp__tx__data__t.html">htp_tx_data_t</a></div><div class="ttdef"><b>Definition:</b> htp.h:542</div></div> <div class="ttc" id="structhtp__decompressor__t_html_a7d98d14adde9a6bab556567891082d6e"><div class="ttname"><a href="structhtp__decompressor__t.html#a7d98d14adde9a6bab556567891082d6e">htp_decompressor_t::destroy</a></div><div class="ttdeci">void(* destroy)(htp_decompressor_t *)</div><div class="ttdef"><b>Definition:</b> htp_decompressors.h:59</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.6 </small></address> </body> </html>