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 49 SNMP Interface */
10
11
#include "
squid.h
"
12
#include "
ipc/Messages.h
"
13
#include "
ipc/TypedMsgHdr.h
"
14
#include "
snmp/Request.h
"
15
16
Snmp::Request::Request
(
const
int
aRequestorId,
const
Ipc::RequestId
aRequestId,
17
const
Pdu
& aPdu,
const
Session
& aSession,
18
int
aFd,
const
Ip::Address
& anAddress):
19
Ipc
::
Request
(aRequestorId, aRequestId),
20
pdu(aPdu), session(aSession), fd(aFd), address(anAddress)
21
{
22
}
23
24
Snmp::Request::Request
(
const
Ipc::TypedMsgHdr
&msg)
25
{
26
msg.
checkType
(
Ipc::mtSnmpRequest
);
27
msg.
getPod
(requestorId);
28
msg.
getPod
(requestId);
29
pdu.unpack(msg);
30
session.unpack(msg);
31
msg.
getPod
(address);
32
33
// Requests from strands have FDs. Requests from Coordinator do not.
34
fd = msg.
hasFd
() ? msg.
getFd
() : -1;
35
}
36
37
void
38
Snmp::Request::pack
(
Ipc::TypedMsgHdr
& msg)
const
39
{
40
msg.
setType
(
Ipc::mtSnmpRequest
);
41
msg.
putPod
(requestorId);
42
msg.
putPod
(requestId);
43
pdu.pack(msg);
44
session.pack(msg);
45
msg.
putPod
(address);
46
47
// Requests sent to Coordinator have FDs. Requests sent to strands do not.
48
if
(fd >= 0)
49
msg.
putFd
(fd);
50
}
51
52
Ipc::Request::Pointer
53
Snmp::Request::clone
()
const
54
{
55
return
new
Request
(*
this
);
56
}
57
TypedMsgHdr.h
Ip::Address
Definition
Address.h:43
Ipc::RequestId
Definition
RequestId.h:23
Ipc::Request::Request
Request()=default
recipient's constructor
Ipc::TypedMsgHdr
struct msghdr with a known type, fixed-size I/O and control buffers
Definition
TypedMsgHdr.h:35
Ipc::TypedMsgHdr::getFd
int getFd() const
returns stored descriptor
Definition
TypedMsgHdr.cc:217
Ipc::TypedMsgHdr::putFd
void putFd(int aFd)
stores descriptor
Definition
TypedMsgHdr.cc:196
Ipc::TypedMsgHdr::getPod
void getPod(Pod &pod) const
load POD
Definition
TypedMsgHdr.h:118
Ipc::TypedMsgHdr::hasFd
bool hasFd() const
whether the message has a descriptor stored
Definition
TypedMsgHdr.cc:187
Ipc::TypedMsgHdr::checkType
void checkType(int aType) const
Definition
TypedMsgHdr.cc:94
Ipc::TypedMsgHdr::putPod
void putPod(const Pod &pod)
store POD
Definition
TypedMsgHdr.h:126
Ipc::TypedMsgHdr::setType
void setType(int aType)
sets message type; use MessageType enum
Definition
TypedMsgHdr.cc:100
RefCount< Request >
Snmp::Pdu
Definition
Pdu.h:24
Snmp::Request
SNMP request.
Definition
Request.h:25
Snmp::Request::clone
Pointer clone() const override
returns a copy of this
Definition
Request.cc:53
Snmp::Request::pack
void pack(Ipc::TypedMsgHdr &msg) const override
prepare for sendmsg()
Definition
Request.cc:38
Snmp::Session
snmp_session wrapper add pack/unpack feature
Definition
Session.h:23
Messages.h
Ipc
Definition
IpcIoFile.h:24
Ipc::mtSnmpRequest
@ mtSnmpRequest
Definition
Messages.h:39
Request.h
squid.h
squid
src
snmp
Request.cc
Generated by
1.9.8