Line data Source code
1 : /* 2 : * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. 3 : * Copyright Contributors to the OpenSDN project 4 : */ 5 : 6 : #ifndef vnsw_agent_bridge_route_audit_ksync_h 7 : #define vnsw_agent_bridge_route_audit_ksync_h 8 : 9 : #include <string> 10 : #include <net/mac_address.h> 11 : #include <boost/asio.hpp> 12 : #include <boost/bind/bind.hpp> 13 : 14 : #include <ksync/ksync_entry.h> 15 : #include <ksync/ksync_object.h> 16 : #include <ksync/ksync_netlink.h> 17 : #include <vrouter/ksync/agent_ksync_types.h> 18 : #include <vrouter/ksync/ksync_flow_memory.h> 19 : 20 : using namespace boost::placeholders; 21 : 22 : class BridgeRouteAuditKSyncObject; 23 : class KSync; 24 : 25 : class BridgeRouteAuditKSyncEntry : public KSyncNetlinkEntry { 26 : public: 27 : BridgeRouteAuditKSyncEntry(BridgeRouteAuditKSyncObject *obj, 28 : uint32_t vrf_id, const MacAddress &mac); 29 : BridgeRouteAuditKSyncEntry(BridgeRouteAuditKSyncObject* obj, 30 : const BridgeRouteAuditKSyncEntry *entry); 31 : virtual ~BridgeRouteAuditKSyncEntry(); 32 : 33 : int EncodeDelete(char *buf, int buf_len); 34 : KSyncObject *GetObject() const; 35 : virtual bool Sync(); 36 : virtual KSyncEntry *UnresolvedReference(); 37 : void FillObjectLog(sandesh_op::type type, KSyncRouteInfo &info) const; 38 : 39 : std::string ToString() const; 40 : bool IsLess(const KSyncEntry &rhs) const; 41 : int AddMsg(char *buf, int buf_len); 42 : int ChangeMsg(char *buf, int buf_len); 43 : int DeleteMsg(char *buf, int buf_len); 44 : 45 : private: 46 : BridgeRouteAuditKSyncObject *ksync_obj_; 47 : uint32_t vrf_id_; 48 : MacAddress mac_; 49 : DISALLOW_COPY_AND_ASSIGN(BridgeRouteAuditKSyncEntry); 50 : }; 51 : 52 : class BridgeRouteAuditKSyncObject : public KSyncObject { 53 : public: 54 : BridgeRouteAuditKSyncObject(KSync *ksync); 55 : virtual ~BridgeRouteAuditKSyncObject(); 56 : 57 : KSyncEntry *Alloc(const KSyncEntry *key, uint32_t index); 58 0 : KSync *ksync() const { return ksync_; } 59 : 60 : private: 61 : KSync *ksync_; 62 : DISALLOW_COPY_AND_ASSIGN(BridgeRouteAuditKSyncObject); 63 : }; 64 : 65 : #endif // vnsw_agent_bridge_route_audit_ksync_h