Request.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2022 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 /* DEBUG: section 54 Interprocess Communication */
10 
11 #ifndef SQUID_IPC_REQUEST_H
12 #define SQUID_IPC_REQUEST_H
13 
14 #include "base/RefCount.h"
15 #include "base/TypeTraits.h"
16 #include "ipc/RequestId.h"
17 
18 namespace Ipc
19 {
20 
21 // TODO: Request and Response ought to have their own un/pack() methods instead
22 // of duplicating their functionality in derived classes. To avoid dependency
23 // loops between libipc and libmgr/libsnmp, fixing that requires extracting
24 // src/ipc/Coordinator and its friends into a new src/coordinator/ library.
25 
27 class Request: public RefCountable, public Interface
28 {
29 public:
31 
32 public:
33  virtual void pack(TypedMsgHdr& msg) const = 0;
34  virtual Pointer clone() const = 0;
35 
36 public:
37  int requestorId = 0;
39 
40 protected:
42  Request(const int aRequestorId, const RequestId aRequestId):
43  requestorId(aRequestorId),
44  requestId(aRequestId)
45  {
46  }
47 
49  Request() = default;
50 };
51 
52 } // namespace Ipc
53 
54 #endif /* SQUID_IPC_REQUEST_H */
55 
RequestId requestId
matches the request[or] with the response
Definition: Request.h:38
virtual Pointer clone() const =0
returns a copy of this
Request()=default
recipient's constructor
RefCount< Request > Pointer
Definition: Request.h:30
convenience base for any class with pure virtual method(s)
Definition: TypeTraits.h:17
int requestorId
kidId of the requestor; used for response destination
Definition: Request.h:37
Request(const int aRequestorId, const RequestId aRequestId)
sender's constructor
Definition: Request.h:42
virtual void pack(TypedMsgHdr &msg) const =0
prepare for sendmsg()
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:33
IPC request.
Definition: Request.h:28
Definition: IpcIoFile.h:24

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors