Line data Source code
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> 11 : #include <vrouter/ksync/ksync_init.h> 12 : #include "vrouter/ksync/qos_queue_ksync.h" 13 : 14 0 : QosQueueKSyncEntry::QosQueueKSyncEntry(QosQueueKSyncObject *obj, 15 0 : const QosQueueKSyncEntry *qos_queue): 16 0 : KSyncNetlinkDBEntry(), ksync_obj_(obj), id_(qos_queue->id()) { 17 0 : } 18 : 19 0 : QosQueueKSyncEntry::QosQueueKSyncEntry(QosQueueKSyncObject *obj, 20 0 : const QosQueue *qos_queue): 21 0 : KSyncNetlinkDBEntry(), ksync_obj_(obj), id_(qos_queue->id()) { 22 0 : } 23 : 24 0 : QosQueueKSyncEntry::QosQueueKSyncEntry(QosQueueKSyncObject *obj, 25 0 : uint32_t id): 26 0 : KSyncNetlinkDBEntry(), ksync_obj_(obj), id_(id) { 27 0 : } 28 : 29 0 : QosQueueKSyncEntry::~QosQueueKSyncEntry() { 30 0 : } 31 : 32 0 : KSyncDBObject *QosQueueKSyncEntry::GetObject() const { 33 0 : return ksync_obj_; 34 : } 35 : 36 0 : bool QosQueueKSyncEntry::IsLess(const KSyncEntry &rhs) const { 37 0 : const QosQueueKSyncEntry &entry = static_cast<const QosQueueKSyncEntry &>(rhs); 38 0 : return id_ < entry.id_; 39 : } 40 : 41 0 : std::string QosQueueKSyncEntry::ToString() const { 42 : 43 0 : std::stringstream s; 44 0 : s << "Qos Queue id " << id_; 45 0 : return s.str(); 46 0 : } 47 : 48 0 : bool QosQueueKSyncEntry::Sync(DBEntry *e) { 49 0 : return false; 50 : } 51 : 52 0 : int QosQueueKSyncEntry::Encode(sandesh_op::type op, char *buf, int buf_len) { 53 0 : return 0; 54 : } 55 : 56 0 : int QosQueueKSyncEntry::AddMsg(char *buf, int buf_len) { 57 0 : return Encode(sandesh_op::ADD, buf, buf_len); 58 : } 59 : 60 0 : int QosQueueKSyncEntry::ChangeMsg(char *buf, int buf_len) { 61 0 : return Encode(sandesh_op::ADD, buf, buf_len); 62 : } 63 : 64 0 : int QosQueueKSyncEntry::DeleteMsg(char *buf, int buf_len) { 65 0 : return Encode(sandesh_op::DEL, buf, buf_len); 66 : } 67 : 68 0 : KSyncEntry *QosQueueKSyncEntry::UnresolvedReference() { 69 0 : return NULL; 70 : } 71 : 72 3 : QosQueueKSyncObject::QosQueueKSyncObject(KSync *ksync): 73 3 : KSyncDBObject("KSync Qos Queue Object"), ksync_(ksync) { 74 3 : } 75 : 76 6 : QosQueueKSyncObject::~QosQueueKSyncObject() { 77 : 78 6 : } 79 : 80 0 : void QosQueueKSyncObject::RegisterDBClients() { 81 0 : RegisterDb(ksync_->agent()->qos_queue_table()); 82 0 : } 83 : 84 : KSyncEntry* 85 0 : QosQueueKSyncObject::Alloc(const KSyncEntry *e, uint32_t index) { 86 0 : const QosQueueKSyncEntry *entry = static_cast<const QosQueueKSyncEntry *>(e); 87 0 : QosQueueKSyncEntry *new_entry = new QosQueueKSyncEntry(this, entry); 88 0 : return static_cast<KSyncEntry *>(new_entry); 89 : } 90 : 91 0 : KSyncEntry *QosQueueKSyncObject::DBToKSyncEntry(const DBEntry *e) { 92 0 : const QosQueue *qos_queue = static_cast<const QosQueue *>(e); 93 0 : QosQueueKSyncEntry *entry = new QosQueueKSyncEntry(this, qos_queue); 94 0 : return static_cast<KSyncEntry *>(entry); 95 : }