Response.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 "base/TextException.h"
13 #include "ipc/Messages.h"
14 #include "ipc/TypedMsgHdr.h"
15 #include "snmp/Response.h"
16 
17 std::ostream& Snmp::operator << (std::ostream& os, const Response& response)
18 {
19  os << "response: {requestId: " << response.requestId << '}';
20  return os;
21 }
22 
23 Snmp::Response::Response(unsigned int aRequestId):
24  Ipc::Response(aRequestId), pdu()
25 {
26 }
27 
29  Ipc::Response(response.requestId), pdu(response.pdu)
30 {
31 }
32 
34  Ipc::Response(0)
35 {
37  msg.getPod(requestId);
38  pdu.unpack(msg);
39 }
40 
41 void
43 {
45  msg.putPod(requestId);
46  pdu.pack(msg);
47 }
48 
51 {
52  return new Response(*this);
53 }
54 
virtual void pack(Ipc::TypedMsgHdr &msg) const
prepare for sendmsg()
Definition: Response.cc:42
void getPod(Pod &pod) const
load POD
Definition: TypedMsgHdr.h:50
unsigned int requestId
ID of request we are responding to.
Definition: Response.h:38
void putPod(const Pod &pod)
store POD
Definition: TypedMsgHdr.h:52
Response(unsigned int aRequestId)
Definition: Response.cc:23
void unpack(const Ipc::TypedMsgHdr &msg)
restore struct from the message
Definition: Pdu.cc:190
std::ostream & operator<<(std::ostream &os, const Response &response)
Definition: Response.cc:17
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:31
void checkType(int aType) const
throws if stored type is not aType
Definition: TypedMsgHdr.cc:84
Pdu pdu
SNMP protocol data unit.
Definition: Response.h:36
virtual Ipc::Response::Pointer clone() const
returns a copy of this
Definition: Response.cc:50
void setType(int aType)
sets message type; use MessageType enum
Definition: TypedMsgHdr.cc:90

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors