OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
qos_config_kstate.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include "kstate.h"
6 #include "qos_config_kstate.h"
7 
8 QosConfigKState::QosConfigKState(KQosConfigResp *obj, const std::string &resp_ctx,
9  vr_qos_map_req &req, int id) : KState(resp_ctx, obj) {
10  req.set_qmr_id(id);
11  if (id >= 0) {
12  req.set_h_op(sandesh_op::GET);
13  } else {
14  req.set_h_op(sandesh_op::DUMP);
15  req.set_qmr_marker(-1);
16  }
17 }
18 
20  vr_qos_map_req req;
21  req.set_h_op(sandesh_op::DUMP);
22  req.set_qmr_id(0);
23  uint16_t id = boost::any_cast<uint16_t>(more_context_);
24  req.set_qmr_marker(id);
25  EncodeAndSend(req);
26 }
27 
29  KQosConfigResp *resp = static_cast<KQosConfigResp *>(response_object_);
30  if (resp) {
31  if (MoreData()) {
32  SendResponse();
34  } else {
35  resp->set_context(response_context_);
36  resp->Response();
37  more_context_ = boost::any();
38  }
39  }
40 }
41 
43  KQosConfigResp *resp = static_cast<KQosConfigResp *>(response_object_);
44  resp->set_context(response_context_);
45  resp->set_more(true);
46  resp->Response();
47  response_object_ = new KQosConfigResp();
48 }
std::string response_context_
Definition: kstate.h:63
virtual void Handler()
virtual void SendNextRequest()
Definition: kstate.h:24
boost::any more_context_
Definition: kstate.h:66
QosConfigKState(KQosConfigResp *obj, const std::string &resp_ctx, vr_qos_map_req &req, int id)
Sandesh * response_object_
Definition: kstate.h:64
virtual void SendResponse()
bool MoreData() const
Definition: kstate.cc:29
void EncodeAndSend(Sandesh &encoder)
Definition: kstate.cc:63