]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/Response.cc
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
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.
9 /* DEBUG: section 16 Cache Manager API */
12 #include "base/TextException.h"
13 #include "CacheManager.h"
14 #include "ipc/Messages.h"
15 #include "ipc/TypedMsgHdr.h"
16 #include "mgr/ActionCreator.h"
17 #include "mgr/ActionProfile.h"
18 #include "mgr/Response.h"
20 Mgr::Response::Response(unsigned int aRequestId
, Action::Pointer anAction
):
21 Ipc::Response(aRequestId
), action(anAction
)
23 Must(!action
|| action
->name()); // if there is an action, it must be named
26 Mgr::Response::Response(const Response
& response
):
27 Ipc::Response(response
.requestId
), action(response
.action
)
31 Mgr::Response::Response(const Ipc::TypedMsgHdr
& msg
):
34 msg
.checkType(Ipc::mtCacheMgrResponse
);
35 msg
.getPod(requestId
);
38 if (msg
.hasMoreData()) {
40 msg
.getString(actionName
);
41 action
= CacheManager::GetInstance()->createNamedAction(actionName
.termedBuf());
48 Mgr::Response::pack(Ipc::TypedMsgHdr
& msg
) const
51 msg
.setType(Ipc::mtCacheMgrResponse
);
52 msg
.putPod(requestId
);
54 msg
.putString(action
->name());
59 Ipc::Response::Pointer
60 Mgr::Response::clone() const
62 return new Response(*this);
66 Mgr::Response::hasAction() const
68 return action
!= NULL
;
72 Mgr::Response::getAction() const