1 /** @file
2 
3   Http1Transaction.h - The Transaction class for Http1*
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22  */
23 
24 #pragma once
25 
26 #include "../ProxyTransaction.h"
27 
28 class Continuation;
29 
30 class Http1Transaction : public ProxyTransaction
31 {
32 public:
33   using super_type = ProxyTransaction;
34 
Http1Transaction()35   Http1Transaction() {}
36 
37   ////////////////////
38   // Methods
39   void release(IOBufferReader *r) override;
40   void destroy() override; // todo make ~Http1Transaction()
41 
42   // Implement VConnection interface.
43   VIO *do_io_read(Continuation *c, int64_t nbytes = INT64_MAX, MIOBuffer *buf = nullptr) override;
44   VIO *do_io_write(Continuation *c = nullptr, int64_t nbytes = INT64_MAX, IOBufferReader *buf = nullptr,
45                    bool owner = false) override;
46   void do_io_close(int lerrno = -1) override;
47   void do_io_shutdown(ShutdownHowTo_t howto) override;
48   void reenable(VIO *vio) override;
49 
50   bool allow_half_open() const override;
51   void set_active_timeout(ink_hrtime timeout_in) override;
52   void set_inactivity_timeout(ink_hrtime timeout_in) override;
53   void cancel_inactivity_timeout() override;
54   void transaction_done() override;
55   int get_transaction_id() const override;
56   void increment_client_transactions_stat() override;
57   void decrement_client_transactions_stat() override;
58 
59   void set_reader(IOBufferReader *reader);
60 
61   ////////////////////
62   // Variables
63 
64 protected:
65   bool outbound_transparent{false};
66 };
67 
68 //////////////////////////////////
69 // INLINE
70 
71 inline void
set_reader(IOBufferReader * reader)72 Http1Transaction::set_reader(IOBufferReader *reader)
73 {
74   _reader = reader;
75 }
76