GCC Code Coverage Report


Directory: libs/http_proto/include/boost/http_proto/
File: boost/http_proto/codec/impl/deflate_service.ipp
Date: 2023-01-09 16:11:13
Exec Total Coverage
Lines: 10 13 76.9%
Functions: 3 5 60.0%
Branches: 1 2 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2021 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/CPPAlliance/http_proto
8 //
9
10 #ifndef BOOST_HTTP_PROTO_CODEC_IMPL_DEFLATE_SERVICE_IPP
11 #define BOOST_HTTP_PROTO_CODEC_IMPL_DEFLATE_SERVICE_IPP
12
13 #include <boost/http_proto/codec/deflate_service.hpp>
14 #include <boost/http_proto/context.hpp>
15 #include <boost/http_proto/codec/codecs.hpp>
16 #include <boost/http_proto/codec/decoder.hpp>
17 #include <boost/http_proto/codec/encoder.hpp>
18
19 #if 0
20 #include <boost/beast/zlib/deflate_stream.hpp>
21 #include <boost/beast/zlib/inflate_stream.hpp>
22 #endif
23
24 namespace boost {
25 namespace http_proto {
26
27 namespace detail {
28
29 class deflate_decoder_service_impl
30 : public service
31 , public decoder_type
32 {
33 public:
34 explicit
35 1 deflate_decoder_service_impl(
36 context& ctx)
37 1 {
38
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 ctx.codecs().add_decoder(
39 1 "deflate", *this);
40 1 }
41
42 class decoder_impl
43 : public decoder
44 {
45 #if 0
46 beast::zlib::inflate_stream is_;
47 #endif
48
49 public:
50 void
51 exchange(
52 buffers& b,
53 error_code& ec)
54 {
55 (void)b;
56 (void)ec;
57 #if 0
58 beast::zlib::z_params zs;
59 zs.next_in = b.input;
60 zs.avail_in = b.input_avail;
61 zs.total_in = 0;
62 zs.next_out = b.output;
63 zs.avail_out = b.output_avail;
64 zs.total_out = 0;
65
66 is_.write(zs,
67 beast::zlib::Flush::none,
68 ec);
69
70 b.input = static_cast<
71 char const*>(zs.next_in);
72 b.input_avail = zs.avail_in;
73 b.input_used = zs.total_in;
74 b.output = static_cast<
75 char*>(zs.next_out);
76 b.output_avail = zs.avail_out;
77 b.output_used = zs.total_out;
78 #endif
79 }
80 };
81
82 std::unique_ptr<decoder>
83 make_decoder() override
84 {
85 return std::unique_ptr<decoder>(
86 new decoder_impl());
87 }
88 };
89
90 //------------------------------------------------
91
92 class deflate_encoder_service_impl
93 : public service
94 , public encoder_type
95 {
96 public:
97 explicit
98 deflate_encoder_service_impl(
99 context& ctx)
100 {
101 ctx.codecs().add_encoder(
102 "deflate", *this);
103 }
104
105 class encoder_impl
106 : public encoder
107 {
108 #if 0
109 beast::zlib::deflate_stream is_;
110 #endif
111
112 public:
113 void
114 exchange(
115 buffers& b,
116 error_code& ec)
117 {
118 (void)b;
119 (void)ec;
120 }
121 };
122
123 std::unique_ptr<encoder>
124 make_encoder() override
125 {
126 return std::unique_ptr<encoder>(
127 new encoder_impl());
128 }
129 };
130
131 } // detail
132
133 //------------------------------------------------
134
135 void
136 1 install_deflate_encoder(
137 context& ctx)
138 {
139 (void)ctx;
140 1 }
141
142 void
143 1 install_deflate_decoder(
144 context& ctx)
145 {
146 ctx.make_service<
147 1 detail::deflate_decoder_service_impl>();
148 1 }
149
150 } // http_proto
151 } // boost
152
153 #endif
154