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"
15#include "helper/ResultCode.h"
16#include "MemBuf.h"
17#include "Notes.h"
18
19#include <ostream>
20
21namespace Helper
22{
23
29class Reply
30{
31private:
32 // copy are prohibited for now
35
36public:
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
57public:
60
61 // list of key=value pairs the helper produced
63
66private:
67 static void CheckReceivedKey(const SBuf &, const SBuf &);
68
69 void parseResponseKeys();
70
72 const MemBuf &emptyBuf() const;
73
76};
77
78std::ostream &operator <<(std::ostream &, const Reply &);
79
80} // namespace Helper
81
82#endif /* _SQUID_SRC_HELPER_REPLY_H */
83
Reply & operator=(const Helper::Reply &r)
const MemBuf & emptyBuf() const
Return an empty MemBuf.
Definition: Reply.cc:244
NotePairs notes
Definition: Reply.h:62
Helper::ResultCode result
The helper response 'result' field.
Definition: Reply.h:59
Reply()
Creates a NULL reply.
Definition: Reply.cc:20
const MemBuf & other() const
Definition: Reply.h:42
static void CheckReceivedKey(const SBuf &, const SBuf &)
warns admin about problematic key=value pairs
Definition: Reply.cc:157
Reply(const Helper::Reply &r)
Helper::ReservationId reservationId
The stateful replies should include the reservation ID.
Definition: Reply.h:65
void finalize()
Definition: Reply.cc:39
bool accumulate(const char *buf, size_t len)
Definition: Reply.cc:26
Reply(Helper::ResultCode res)
Definition: Reply.h:37
MemBuf other_
the remainder of the line
Definition: Reply.h:75
void parseResponseKeys()
Definition: Reply.cc:208
a (temporary) lock on a (stateful) helper channel
Definition: ReservationId.h:18
Definition: MemBuf.h:24
int isNull() const
Definition: MemBuf.cc:145
Definition: SBuf.h:94
helper protocol primitives
Definition: helper.h:39
ResultCode
enumeration value for the helper response 'result' field.
Definition: ResultCode.h:16
std::ostream & operator<<(std::ostream &, const Reply &)
Definition: Reply.cc:253

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors