Request.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2021 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 16 Cache Manager API */
10 
11 #include "squid.h"
12 #include "base/TextException.h"
13 #include "comm/Connection.h"
14 #include "ipc/Messages.h"
15 #include "ipc/TypedMsgHdr.h"
16 #include "mgr/ActionParams.h"
17 #include "mgr/Request.h"
18 
19 Mgr::Request::Request(const int aRequestorId,
20  const Ipc::RequestId aRequestId,
21  const Comm::ConnectionPointer &aConn,
22  const ActionParams &aParams):
23  Ipc::Request(aRequestorId, aRequestId),
24  conn(aConn),
25  params(aParams)
26 {
27  Must(requestorId > 0);
28 }
29 
31 {
33  msg.getPod(requestorId);
34  msg.getPod(requestId);
35  params = ActionParams(msg);
36 
37  conn = new Comm::Connection;
38  conn->fd = msg.getFd();
39  // For now we just have the FD.
40  // Address and connectio details wil be pulled/imported by the component later
41 }
42 
43 void
45 {
47  msg.putPod(requestorId);
48  msg.putPod(requestId);
49  params.pack(msg);
50 
51  msg.putFd(conn->fd);
52 }
53 
56 {
57  return new Request(*this);
58 }
59 
void setType(int aType)
sets message type; use MessageType enum
Definition: TypedMsgHdr.cc:100
void checkType(int aType) const
Definition: TypedMsgHdr.cc:94
virtual void pack(Ipc::TypedMsgHdr &msg) const
prepare for sendmsg()
Definition: Request.cc:44
Request()=default
recipient's constructor
void putPod(const Pod &pod)
store POD
Definition: TypedMsgHdr.h:127
@ mtCacheMgrRequest
Definition: Messages.h:35
int requestorId
kidId of the requestor; used for response destination
Definition: Request.h:37
cache manager request
Definition: Request.h:23
int conn
the current server connection FD
Definition: Transport.cc:26
SSL Connection
Definition: Session.h:45
int getFd() const
returns stored descriptor
Definition: TypedMsgHdr.cc:217
Cache Manager Action parameters extracted from the user request.
Definition: ActionParams.h:24
#define Must(condition)
Like assert() but throws an exception instead of aborting the process.
Definition: TextException.h:73
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:33
void putFd(int aFd)
stores descriptor
Definition: TypedMsgHdr.cc:196
void getPod(Pod &pod) const
load POD
Definition: TypedMsgHdr.h:116
virtual Pointer clone() const
returns a copy of this
Definition: Request.cc:55
Definition: IpcIoFile.h:24

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors