Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef __VNSW_AGENT_QOS_QUEUE_KSYNC_H__ 6 : #define __VNSW_AGENT_QOS_QUEUE_KSYNC_H__ 7 : 8 : #include <db/db_entry.h> 9 : #include <db/db_table.h> 10 : #include <db/db_table_partition.h> 11 : #include <ksync/ksync_entry.h> 12 : #include <ksync/ksync_object.h> 13 : #include <ksync/ksync_netlink.h> 14 : #include "oper/qos_queue.h" 15 : 16 : class KSync; 17 : class QosQueueKSyncObject; 18 : 19 : class QosQueueKSyncEntry : public KSyncNetlinkDBEntry { 20 : public: 21 : QosQueueKSyncEntry(QosQueueKSyncObject *obj, const QosQueueKSyncEntry *entry); 22 : QosQueueKSyncEntry(QosQueueKSyncObject *obj, const QosQueue *qos_queue); 23 : QosQueueKSyncEntry(QosQueueKSyncObject *obj, uint32_t qos_queue); 24 : virtual ~QosQueueKSyncEntry(); 25 : 26 : KSyncDBObject *GetObject() const; 27 : virtual bool IsLess(const KSyncEntry &rhs) const; 28 : virtual std::string ToString() const; 29 : virtual KSyncEntry *UnresolvedReference(); 30 : virtual bool Sync(DBEntry *e); 31 : virtual int AddMsg(char *buf, int buf_len); 32 : virtual int ChangeMsg(char *buf, int buf_len); 33 : virtual int DeleteMsg(char *buf, int buf_len); 34 0 : uint32_t id() const { return id_;} 35 : private: 36 : int Encode(sandesh_op::type op, char *buf, int buf_len); 37 : KSyncDBObject *ksync_obj_; 38 : uint32_t id_; 39 : DISALLOW_COPY_AND_ASSIGN(QosQueueKSyncEntry); 40 : }; 41 : 42 : class QosQueueKSyncObject : public KSyncDBObject { 43 : public: 44 : QosQueueKSyncObject(KSync *ksync); 45 : virtual ~QosQueueKSyncObject(); 46 0 : KSync *ksync() const { return ksync_; } 47 : virtual KSyncEntry *Alloc(const KSyncEntry *entry, uint32_t id); 48 : virtual KSyncEntry *DBToKSyncEntry(const DBEntry *e); 49 : void RegisterDBClients(); 50 : private: 51 : KSync *ksync_; 52 : DISALLOW_COPY_AND_ASSIGN(QosQueueKSyncObject); 53 : }; 54 : #endif