Reply.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_SRC_HELPER_REPLY_H
10 #define SQUID_SRC_HELPER_REPLY_H
11 
12 #include "base/CbcPointer.h"
13 #include "helper/forward.h"
14 #include "helper/ReservationId.h"
15 #include "helper/ResultCode.h"
16 #include "MemBuf.h"
17 #include "Notes.h"
18 
19 #include <ostream>
20 
21 namespace Helper
22 {
23 
29 class Reply
30 {
31 private:
32  // copy are prohibited for now
33  Reply(const Helper::Reply &r);
34  Reply &operator =(const Helper::Reply &r);
35 
36 public:
37  explicit Reply(Helper::ResultCode res) : result(res), notes() {}
38 
40  Reply();
41 
42  const MemBuf &other() const {return other_.isNull() ? emptyBuf() : other_;};
43 
51  // XXX: buf should be const but we may need strwordtok() and rfc1738_unescape()
52  //void parse(char *buf, size_t len);
53  void finalize();
54 
55  bool accumulate(const char *buf, size_t len);
56 
57 public:
60 
61  // list of key=value pairs the helper produced
63 
66 private:
67  static void CheckReceivedKey(const SBuf &, const SBuf &);
68 
69  void parseResponseKeys();
70 
72  const MemBuf &emptyBuf() const;
73 
76 };
77 
78 std::ostream &operator <<(std::ostream &, const Reply &);
79 
80 } // namespace Helper
81 
82 #endif /* SQUID_SRC_HELPER_REPLY_H */
83 
Reply()
Creates a NULL reply.
Definition: Reply.cc:22
static void CheckReceivedKey(const SBuf &, const SBuf &)
warns admin about problematic key=value pairs
Definition: Reply.cc:159
const MemBuf & emptyBuf() const
Return an empty MemBuf.
Definition: Reply.cc:246
Definition: SBuf.h:93
std::ostream & operator<<(std::ostream &, const Reply &)
Definition: Reply.cc:255
int isNull() const
Definition: MemBuf.cc:145
const MemBuf & other() const
Definition: Reply.h:42
Reply(Helper::ResultCode res)
Definition: Reply.h:37
bool accumulate(const char *buf, size_t len)
Definition: Reply.cc:28
Helper::ResultCode result
The helper response 'result' field.
Definition: Reply.h:59
Definition: MemBuf.h:23
ResultCode
enumeration value for the helper response 'result' field.
Definition: ResultCode.h:16
NotePairs notes
Definition: Reply.h:62
void parseResponseKeys()
Definition: Reply.cc:210
MemBuf other_
the remainder of the line
Definition: Reply.h:75
a (temporary) lock on a (stateful) helper channel
Definition: ReservationId.h:17
helper protocol primitives
Definition: ChildConfig.h:12
void finalize()
Definition: Reply.cc:41
Helper::ReservationId reservationId
The stateful replies should include the reservation ID.
Definition: Reply.h:65
Reply & operator=(const Helper::Reply &r)

 

Introduction

Documentation

Support

Miscellaneous