OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
qos_queue_ksync.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include <base/logging.h>
6 #include <ksync/ksync_index.h>
7 #include <ksync/ksync_entry.h>
8 #include <ksync/ksync_object.h>
9 #include <ksync/ksync_netlink.h>
10 #include <ksync/ksync_sock.h>
13 
15  const QosQueueKSyncEntry *qos_queue):
16  KSyncNetlinkDBEntry(), ksync_obj_(obj), id_(qos_queue->id()) {
17 }
18 
20  const QosQueue *qos_queue):
21  KSyncNetlinkDBEntry(), ksync_obj_(obj), id_(qos_queue->id()) {
22 }
23 
25  uint32_t id):
26  KSyncNetlinkDBEntry(), ksync_obj_(obj), id_(id) {
27 }
28 
30 }
31 
33  return ksync_obj_;
34 }
35 
36 bool QosQueueKSyncEntry::IsLess(const KSyncEntry &rhs) const {
37  const QosQueueKSyncEntry &entry = static_cast<const QosQueueKSyncEntry &>(rhs);
38  return id_ < entry.id_;
39 }
40 
41 std::string QosQueueKSyncEntry::ToString() const {
42 
43  std::stringstream s;
44  s << "Qos Queue id " << id_;
45  return s.str();
46 }
47 
49  return false;
50 }
51 
52 int QosQueueKSyncEntry::Encode(sandesh_op::type op, char *buf, int buf_len) {
53  return 0;
54 }
55 
56 int QosQueueKSyncEntry::AddMsg(char *buf, int buf_len) {
57  return Encode(sandesh_op::ADD, buf, buf_len);
58 }
59 
60 int QosQueueKSyncEntry::ChangeMsg(char *buf, int buf_len) {
61  return Encode(sandesh_op::ADD, buf, buf_len);
62 }
63 
64 int QosQueueKSyncEntry::DeleteMsg(char *buf, int buf_len) {
65  return Encode(sandesh_op::DEL, buf, buf_len);
66 }
67 
69  return NULL;
70 }
71 
73  KSyncDBObject("KSync Qos Queue Object"), ksync_(ksync) {
74 }
75 
77 
78 }
79 
82 }
83 
85 QosQueueKSyncObject::Alloc(const KSyncEntry *e, uint32_t index) {
86  const QosQueueKSyncEntry *entry = static_cast<const QosQueueKSyncEntry *>(e);
87  QosQueueKSyncEntry *new_entry = new QosQueueKSyncEntry(this, entry);
88  return static_cast<KSyncEntry *>(new_entry);
89 }
90 
92  const QosQueue *qos_queue = static_cast<const QosQueue *>(e);
93  QosQueueKSyncEntry *entry = new QosQueueKSyncEntry(this, qos_queue);
94  return static_cast<KSyncEntry *>(entry);
95 }
void RegisterDb(DBTableBase *table)
Agent * agent() const
Definition: ksync_init.h:39
virtual bool IsLess(const KSyncEntry &rhs) const
virtual ~QosQueueKSyncObject()
virtual ~QosQueueKSyncEntry()
QosQueueTable * qos_queue_table() const
Definition: agent.h:562
virtual int ChangeMsg(char *buf, int buf_len)
QosQueueKSyncObject(KSync *ksync)
KSyncDBObject * ksync_obj_
uint8_t type
Definition: load_balance.h:109
virtual int AddMsg(char *buf, int buf_len)
virtual KSyncEntry * UnresolvedReference()
virtual std::string ToString() const
QosQueueKSyncEntry(QosQueueKSyncObject *obj, const QosQueueKSyncEntry *entry)
int Encode(sandesh_op::type op, char *buf, int buf_len)
virtual int DeleteMsg(char *buf, int buf_len)
virtual bool Sync(DBEntry *e)
KSyncDBObject * GetObject() const
virtual KSyncEntry * DBToKSyncEntry(const DBEntry *e)
virtual KSyncEntry * Alloc(const KSyncEntry *entry, uint32_t id)