OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ksync_agent_sandesh.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include "vrouter/ksync/agent_ksync_types.h"
6 #include "ksync_agent_sandesh.h"
7 #include "ksync_init.h"
8 
9 
10 AgentKsyncSandesh::AgentKsyncSandesh(const std::string &context):
11  context_(context), name_("") {
13 }
14 
16  Alloc();
18 }
19 
21  InterfaceKSyncObject *ksyncobj =
22  static_cast<InterfaceKSyncObject *>(AgentGetKsyncObject());
23  KSyncEntry *entry = NULL;
24 
25  SetResp();
26  entry = ksyncobj->Next(NULL);
27  while (entry != NULL) {
28  UpdateResp(entry);
29  entry = ksyncobj->Next(entry);
30  }
31  resp_->Response();
32 }
33 
34 
36  sandesh->DoKsyncSandeshInternal(sandesh);
37  return;
38 }
39 
43 
44 AgentKsyncIntfSandesh::AgentKsyncIntfSandesh(const std::string &context) :
45  AgentKsyncSandesh(context){
46 }
47 
49  InterfaceKSyncEntry *intf = static_cast< InterfaceKSyncEntry *>(entry);
50  return intf->KSyncEntrySandesh(resp_);
51 }
52 
54  return agent_->ksync()->interface_ksync_obj();
55 }
56 
58  resp_ = new KSyncItfResp();
59 }
60 
64 
66  AgentKsyncSandesh(context){
67 }
68 
70  NHKSyncEntry *nh_list = static_cast< NHKSyncEntry *>(entry);
71  return nh_list->KSyncEntrySandesh(resp_);
72 }
73 
75  return agent_->ksync()->nh_ksync_obj();
76 }
77 
79  resp_ = new KSyncNhListResp();
80 }
81 
KSyncDBObject * AgentGetKsyncObject()
static Agent * GetInstance()
Definition: agent.h:436
KSyncEntry * Next(const KSyncEntry *entry) const
SandeshResponse * resp_
bool KSyncEntrySandesh(Sandesh *resp)
virtual void Alloc()=0
AgentKsyncNhListSandesh(const std::string &context)
bool KSyncEntrySandesh(Sandesh *resp)
void DoKsyncSandesh(AgentKsyncSandeshPtr sandesh)
virtual void Response()
Definition: p/sandesh.h:502
virtual KSyncDBObject * AgentGetKsyncObject()=0
NHKSyncObject * nh_ksync_obj() const
Definition: ksync_init.h:43
KSync * ksync() const
Definition: agent.cc:901
class boost::shared_ptr< AgentKsyncSandesh > AgentKsyncSandeshPtr
void DoKsyncSandeshInternal(AgentKsyncSandeshPtr sandesh)
void set_context(std::string context)
Definition: p/sandesh.h:310
bool UpdateResp(KSyncEntry *entry)
bool UpdateResp(KSyncEntry *entry)
KSyncDBObject * AgentGetKsyncObject()
virtual bool UpdateResp(KSyncEntry *entry)=0
AgentKsyncIntfSandesh(const std::string &context)
AgentKsyncSandesh(const std::string &context)
InterfaceKSyncObject * interface_ksync_obj() const
Definition: ksync_init.h:46