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