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