1 //-------------------------------------------------------------------------- 2 // Copyright (C) 2019-2021 Cisco and/or its affiliates. All rights reserved. 3 // 4 // This program is free software; you can redistribute it and/or modify it 5 // under the terms of the GNU General Public License Version 2 as published 6 // by the Free Software Foundation. You may not use, modify or distribute 7 // this program under any other version of the GNU General Public License. 8 // 9 // This program is distributed in the hope that it will be useful, but 10 // WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 // General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License along 15 // with this program; if not, write to the Free Software Foundation, Inc., 16 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 //-------------------------------------------------------------------------- 18 // http2_headers_frame.h author Katura Harvey <katharve@cisco.com> 19 20 #ifndef HTTP2_HEADERS_FRAME_H 21 #define HTTP2_HEADERS_FRAME_H 22 23 #include "http2_frame.h" 24 25 class Field; 26 class Http2HpackDecoder; 27 class Http2StartLine; 28 class Http2Frame; 29 class Http2Stream; 30 class HttpFlowData; 31 32 class Http2HeadersFrame : public Http2Frame 33 { 34 public: 35 void clear() override; 36 37 const Field& get_buf(unsigned id) override; get_xtradata_mask()38 uint32_t get_xtradata_mask() override { return xtradata_mask; } is_detection_required()39 bool is_detection_required() const override { return detection_required; } 40 41 #ifdef REG_TEST 42 void print_frame(FILE* output) override; 43 #endif 44 45 protected: 46 Http2HeadersFrame(const uint8_t* header_buffer, const uint32_t header_len, 47 const uint8_t* data_buffer, const uint32_t data_len, Http2FlowData* ssn_data, 48 HttpCommon::SourceId src_id, Http2Stream* stream); 49 bool decode_headers(Http2StartLine* start_line_generator, bool trailers); 50 void process_decoded_headers(HttpFlowData* http_flow, HttpCommon::SourceId hi_source_id); 51 uint8_t get_flags_mask() const override; 52 virtual bool in_error_state() const; 53 54 Field http1_header; // finalized headers to be passed to http_inspect 55 uint32_t xtradata_mask = 0; 56 bool detection_required = false; 57 Http2HpackDecoder* hpack_decoder; 58 uint8_t hpack_headers_offset = 0; 59 }; 60 #endif 61