Reply.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 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  void parseResponseKeys();
68 
70  const MemBuf &emptyBuf() const;
71 
74 };
75 
76 } // namespace Helper
77 
78 std::ostream &operator <<(std::ostream &os, const Helper::Reply &r);
79 
80 #endif /* _SQUID_SRC_HELPER_REPLY_H */
81 
Reply()
Creates a NULL reply.
Definition: Reply.cc:19
ResultCode
enumeration value for the helper response &#39;result&#39; field.
Definition: ResultCode.h:16
Helper::ResultCode result
The helper response &#39;result&#39; field.
Definition: Reply.h:59
NotePairs notes
Definition: Reply.h:62
Reply(Helper::ResultCode res)
Definition: Reply.h:37
void finalize()
Definition: Reply.cc:38
void parseResponseKeys()
Definition: Reply.cc:155
bool accumulate(const char *buf, size_t len)
Definition: Reply.cc:25
int isNull() const
Definition: MemBuf.cc:148
const MemBuf & other() const
Definition: Reply.h:42
MemBuf other_
the remainder of the line
Definition: Reply.h:73
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
void const char * buf
Definition: stub_helper.cc:16
Reply & operator=(const Helper::Reply &r)
helper protocol primitives
Definition: ChildConfig.h:12
a (temporary) lock on a (stateful) helper channel
Definition: ReservationId.h:18
Definition: MemBuf.h:23
std::ostream & operator<<(std::ostream &os, const Helper::Reply &r)
Definition: Reply.cc:196
Helper::ReservationId reservationId
The stateful replies should include the reservation ID.
Definition: Reply.h:65
const MemBuf & emptyBuf() const
Return an empty MemBuf.
Definition: Reply.cc:187

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors