Request.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 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(int aRequestorId, unsigned int aRequestId, const Comm::ConnectionPointer &aConn,
20  const ActionParams &aParams):
21  Ipc::Request(aRequestorId, aRequestId),
22  conn(aConn),
23  params(aParams)
24 {
25  Must(requestorId > 0);
26 }
27 
29  Ipc::Request(request.requestorId, request.requestId),
30  conn(request.conn), params(request.params)
31 {
32 }
33 
35  Ipc::Request(0, 0)
36 {
38  msg.getPod(requestorId);
39  msg.getPod(requestId);
40  params = ActionParams(msg);
41 
42  conn = new Comm::Connection;
43  conn->fd = msg.getFd();
44  // For now we just have the FD.
45  // Address and connectio details wil be pulled/imported by the component later
46 }
47 
48 void
50 {
52  msg.putPod(requestorId);
53  msg.putPod(requestId);
54  params.pack(msg);
55 
56  msg.putFd(conn->fd);
57 }
58 
61 {
62  return new Request(*this);
63 }
64 
cache manager request
Definition: Request.h:22
Request(int aRequestorId, unsigned int aRequestId, const Comm::ConnectionPointer &aConn, const ActionParams &aParams)
Definition: Request.cc:19
void getPod(Pod &pod) const
load POD
Definition: TypedMsgHdr.h:50
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
void putPod(const Pod &pod)
store POD
Definition: TypedMsgHdr.h:52
int conn
the current server connection FD
Definition: Transport.cc:26
Cache Manager Action parameters extracted from the user request.
Definition: ActionParams.h:23
ActionParams params
action name and parameters
Definition: Request.h:39
virtual Pointer clone() const
returns a copy of this
Definition: Request.cc:60
unsigned int requestId
unique for sender; matches request w/ response
Definition: Request.h:39
int requestorId
kidId of the requestor; used for response destination
Definition: Request.h:38
virtual void pack(Ipc::TypedMsgHdr &msg) const
prepare for sendmsg()
Definition: Request.cc:49
#define Must(cond)
Definition: TextException.h:89
Comm::ConnectionPointer conn
HTTP client connection descriptor.
Definition: Request.h:37
void putFd(int aFd)
stores descriptor
Definition: TypedMsgHdr.cc:186
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
int getFd() const
returns stored descriptor
Definition: TypedMsgHdr.cc:207
void setType(int aType)
sets message type; use MessageType enum
Definition: TypedMsgHdr.cc:90

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors