OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
forwarding_class_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"
7 
9  KForwardingClassResp *obj, const std::string &resp_ctx,
10  vr_fc_map_req &req, int id) : KState(resp_ctx, obj) {
11  std::vector<int16_t> l;
12  l.push_back(id);
13  req.set_fmr_id(l);
14  if (id >= 0) {
15  req.set_h_op(sandesh_op::GET);
16  } else {
17  req.set_h_op(sandesh_op::DUMP);
18  l.clear(); l.push_back(-1);
19  req.set_fmr_id(l);
20  req.set_fmr_marker(-1);
21  }
22 }
23 
25  vr_fc_map_req req;
26  req.set_h_op(sandesh_op::DUMP);
27  int16_t id = boost::any_cast<int16_t>(more_context_);
28  req.set_fmr_marker(id);
29  EncodeAndSend(req);
30 }
31 
33  KForwardingClassResp *resp = static_cast<KForwardingClassResp *>(response_object_);
34  if (resp) {
35  if (MoreData()) {
36  SendResponse();
38  } else {
39  resp->set_context(response_context_);
40  resp->Response();
41  more_context_ = boost::any();
42  }
43  }
44 }
45 
47  KForwardingClassResp *resp = static_cast<KForwardingClassResp *>(response_object_);
48  resp->set_context(response_context_);
49  resp->set_more(true);
50  resp->Response();
51  response_object_ = new KForwardingClassResp();
52 }
std::string response_context_
Definition: kstate.h:63
Definition: kstate.h:24
boost::any more_context_
Definition: kstate.h:66
Sandesh * response_object_
Definition: kstate.h:64
ForwardingClassKState(KForwardingClassResp *obj, const std::string &resp_ctx, vr_fc_map_req &req, int id)
bool MoreData() const
Definition: kstate.cc:29
void EncodeAndSend(Sandesh &encoder)
Definition: kstate.cc:63