Squid Web Cache master
Loading...
Searching...
No Matches
Request.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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
19Mgr::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
43void
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
#define Must(condition)
int requestorId
kidId of the requestor; used for response destination
Definition Request.h:37
Request()=default
recipient's constructor
struct msghdr with a known type, fixed-size I/O and control buffers
Definition TypedMsgHdr.h:35
int getFd() const
returns stored descriptor
void putFd(int aFd)
stores descriptor
void getPod(Pod &pod) const
load POD
void checkType(int aType) const
void putPod(const Pod &pod)
store POD
void setType(int aType)
sets message type; use MessageType enum
Cache Manager Action parameters extracted from the user request.
cache manager request
Definition Request.h:24
Pointer clone() const override
returns a copy of this
Definition Request.cc:55
void pack(Ipc::TypedMsgHdr &msg) const override
prepare for sendmsg()
Definition Request.cc:44
@ mtCacheMgrRequest
Definition Messages.h:35