LCOV - code coverage report
Current view: top level - ksync - ksync_sock_user.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 122 199 61.3 %
Date: 2026-06-04 02:06:09 Functions: 41 74 55.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef ctrlplane_ksync_sock_user_h
       6             : #define ctrlplane_ksync_sock_user_h
       7             : 
       8             : #include <queue>
       9             : #include <mutex>
      10             : 
      11             : #include <boost/asio.hpp>
      12             : #include <boost/asio/buffer.hpp>
      13             : 
      14             : #include <boost/unordered_map.hpp>
      15             : #include "ksync_sock.h"
      16             : 
      17             : #include "nl_util.h"
      18             : #include "vr_types.h"
      19             : #include "vr_flow.h"
      20             : #include "vr_bridge.h"
      21             : 
      22             : using boost::asio::ip::udp;
      23             : 
      24             : class MockDumpHandlerBase;
      25             : 
      26             : class vrouter_ops_test : public vrouter_ops {
      27             : private:
      28             :     virtual void Process(SandeshContext *context);
      29             : };
      30             : 
      31             : class KSyncUserSockContext : public AgentSandeshContext {
      32             : public:
      33        3886 :     KSyncUserSockContext(uint32_t num) : seqno_(num) {}
      34        3886 :     virtual ~KSyncUserSockContext() {}
      35        3974 :     uint32_t GetSeqNum() { return seqno_; }
      36             :     virtual void IfMsgHandler(vr_interface_req *req);
      37             :     virtual void NHMsgHandler(vr_nexthop_req *req);
      38             :     virtual void RouteMsgHandler(vr_route_req *req);
      39             :     virtual void MplsMsgHandler(vr_mpls_req *req);
      40             :     virtual void MirrorMsgHandler(vr_mirror_req *req);
      41           0 :     virtual int VrResponseMsgHandler(vr_response *req) {return 0;};
      42             :     virtual void FlowMsgHandler(vr_flow_req *req);
      43             :     virtual void VrfAssignMsgHandler(vr_vrf_assign_req *req);
      44             :     virtual void VrfMsgHandler(vr_vrf_req *req);
      45             :     virtual void VrfStatsMsgHandler(vr_vrf_stats_req *req);
      46             :     virtual void DropStatsMsgHandler(vr_drop_stats_req *req);
      47             :     virtual void VxLanMsgHandler(vr_vxlan_req *req);
      48             :     virtual void QosConfigMsgHandler(vr_qos_map_req *req);
      49             :     virtual void ForwardingClassMsgHandler(vr_fc_map_req *req);
      50             :     virtual void VrouterOpsMsgHandler(vrouter_ops *req);
      51           0 :     virtual void Process() {}
      52             : private:
      53             :     uint32_t seqno_;
      54             : };
      55             : 
      56             : struct TestRouteCmp {
      57        7350 :     bool operator()(const vr_route_req &lhs, const vr_route_req &rhs) const {
      58        7350 :         if (lhs.get_rtr_family() != rhs.get_rtr_family()) {
      59        1914 :             return lhs.get_rtr_family() < rhs.get_rtr_family();
      60             :         }
      61        5436 :         if (lhs.get_rtr_vrf_id() != rhs.get_rtr_vrf_id()) {
      62        1669 :             return lhs.get_rtr_vrf_id() < rhs.get_rtr_vrf_id();
      63             :         }
      64        3767 :         if (lhs.get_rtr_family() == AF_BRIDGE) {
      65        2329 :             return lhs.get_rtr_mac() < rhs.get_rtr_mac();
      66             :         }
      67        1438 :         if (lhs.get_rtr_prefix_len() != rhs.get_rtr_prefix_len()) {
      68         308 :             return lhs.get_rtr_prefix_len() < rhs.get_rtr_prefix_len();
      69             :         }
      70        1130 :         return lhs.get_rtr_prefix() < rhs.get_rtr_prefix();
      71             :     }
      72             : };
      73             : 
      74             : struct TestVrfAssignCmp {
      75           0 :     bool operator() (const vr_vrf_assign_req &lhs, const vr_vrf_assign_req &rhs) const {
      76           0 :         if (lhs.get_var_vif_index() != rhs.get_var_vif_index()) {
      77           0 :             return lhs.get_var_vif_index() < rhs.get_var_vif_index();
      78             :         }
      79             : 
      80           0 :         return lhs.get_var_vlan_id() < rhs.get_var_vlan_id();
      81             :     }
      82             : };
      83             : 
      84             : //this class stores all netlink sandesh messages in a map
      85             : //used for unit testing or userspace datapath integration
      86             : class KSyncSockTypeMap : public KSyncSock {
      87             : public:
      88             :     enum KSyncSockEntryType {
      89             :         KSYNC_FLOW_ENTRY_TYPE = 0,
      90             :         KSYNC_MAX_ENTRY_TYPE
      91             :     };
      92             : 
      93           4 :     KSyncSockTypeMap(boost::asio::io_context &ios) : KSyncSock(), sock_(ios), ksync_error_() {
      94           2 :         block_msg_processing_ = false;
      95           2 :         is_incremental_index_ = false;
      96           2 :     }
      97           0 :     ~KSyncSockTypeMap() {
      98           0 :         assert(nh_map.size() == 0);
      99           0 :         assert(flow_map.size() == 0);
     100           0 :         assert(if_map.size() == 0);
     101           0 :         assert(rt_tree.size() == 0);
     102           0 :         assert(mpls_map.size() == 0);
     103           0 :         assert(mirror_map.size() == 0);
     104           0 :         assert(vrf_assign_tree.size() == 0);
     105           0 :         assert(vxlan_map.size() == 0);
     106           0 :         singleton_ = NULL;
     107           0 :     }
     108             : 
     109             :     typedef std::map<int, vr_nexthop_req> ksync_map_nh;
     110             :     ksync_map_nh nh_map;
     111             :     typedef boost::unordered_map<int, vr_flow_req> ksync_map_flow;
     112             :     ksync_map_flow flow_map;
     113             :     typedef std::map<int, vr_interface_req> ksync_map_if;
     114             :     ksync_map_if if_map;
     115             :     typedef std::set<vr_route_req, TestRouteCmp> ksync_rt_tree;
     116             :     ksync_rt_tree rt_tree;
     117             :     typedef std::map<int, vr_mpls_req> ksync_map_mpls;
     118             :     ksync_map_mpls mpls_map;
     119             :     typedef std::map<int, vr_mirror_req> ksync_map_mirror;
     120             :     ksync_map_mirror mirror_map;
     121             :     typedef std::set<vr_vrf_assign_req, TestVrfAssignCmp> ksync_vrf_assign_tree;
     122             :     ksync_vrf_assign_tree vrf_assign_tree;
     123             :     typedef std::map<int, vr_vrf_stats_req> ksync_map_vrf_stats;
     124             :     ksync_map_vrf_stats vrf_stats_map;
     125             :     vr_drop_stats_req drop_stats;
     126             :     vrouter_ops ksync_vrouter_ops;
     127             :     typedef std::map<int, vr_vxlan_req> ksync_map_vxlan;
     128             :     ksync_map_vxlan vxlan_map;
     129             :     typedef std::map<int, vr_vrf_req> ksync_map_vrf;
     130             :     ksync_map_vrf vrf_map;
     131             :     typedef std::queue<KSyncUserSockContext *> ksync_map_ctx_queue;
     132             :     ksync_map_ctx_queue ctx_queue_;
     133             :     std::mutex  ctx_queue_lock_;
     134             : 
     135             :     virtual uint32_t GetSeqno(char *data);
     136             :     virtual bool IsMoreData(char *data);
     137             :     virtual bool BulkDecoder(char *data, KSyncBulkSandeshContext *ctxt);
     138             :     virtual bool Decoder(char *data, AgentSandeshContext *ctxt);
     139             :     virtual bool Validate(char *data);
     140             :     virtual void AsyncReceive(boost::asio::mutable_buffers_1, HandlerCb);
     141             :     virtual void AsyncSendTo(KSyncBufferList *iovec, uint32_t seq_no,
     142             :                              HandlerCb cb);
     143             :     virtual std::size_t SendTo(KSyncBufferList *iovec, uint32_t seq_no);
     144             :     virtual void Receive(boost::asio::mutable_buffers_1);
     145             : 
     146             :     void PurgeTxBuffer();
     147             :     void ProcessSandesh(const uint8_t *, std::size_t, KSyncUserSockContext *);
     148           4 :     static void set_error_code(int code) { error_code_ = code; }
     149           2 :     static int error_code() { return error_code_; }
     150             :     static void SimulateResponse(uint32_t, int, int);
     151             :     static void SendNetlinkDoneMsg(uint32_t seq_num);
     152             :     static void IfDumpResponse(uint32_t);
     153             :     static void IfNetlinkMsgSend(uint32_t seq_num, ksync_map_if::const_iterator it);
     154             :     static void IfStatsUpdate(int, int, int, int, int, int, int);
     155             :     static void IfStatsSet(int, int, int, int, int, int, int);
     156             :     static void InterfaceAdd(int id, int flags = 0, int mac_size = 6);
     157             :     static void InterfaceDelete(int id);
     158             :     static void NHAdd(int id, int flags = 0);
     159             :     static void NHDelete(int id);
     160             :     static void MplsAdd(int id);
     161             :     static void MplsDelete(int id);
     162             :     static void MirrorAdd(int id);
     163             :     static void MirrorDelete(int id);
     164             :     static void RouteAdd(vr_route_req &req);
     165             :     static void RouteDelete(vr_route_req &req);
     166             :     static void VrfAssignAdd(vr_vrf_assign_req &req);
     167             :     static void VrfAssignDelete(vr_vrf_assign_req &req);
     168             :     static void VrfAdd(vr_vrf_req &req);
     169             :     static void VrfDelete(vr_vrf_req &req);
     170             :     static void VrfStatsAdd(int vrf_id);
     171             :     static void VrfStatsUpdate(int vrf_id, const vr_vrf_stats_req &req);
     172             :     static void VrfStatsDelete(int vrf_id);
     173             :     static void VxlanAdd(int id);
     174             :     static void VxlanDelete(int id);
     175             : 
     176             :     static void SetDropStats(const vr_drop_stats_req &req);
     177             :     static void SetVRouterOps(const vrouter_ops &req);
     178             :     static int IfCount();
     179             :     static int NHCount();
     180             :     static int MplsCount();
     181             :     static int RouteCount();
     182             :     static int VxLanCount();
     183       40080 :     static KSyncSockTypeMap *GetKSyncSockTypeMap() { return singleton_; };
     184             :     static void Init(boost::asio::io_context &ios);
     185             :     static void Shutdown();
     186             :     static vr_flow_entry *FlowMmapAlloc(int size);
     187             :     static void FlowMmapFree();
     188             :     static vr_flow_entry *GetFlowEntry(int idx);
     189             :     static void SetFlowEntry(vr_flow_req *req, bool set);
     190             :     static void IncrFlowStats(int idx, int pkts, int bytes);
     191             :     static void SetTcpFlag(int idx, uint32_t flags);
     192             :     static void SetOFlowStats(int idx, uint8_t pkts, uint16_t bytes);
     193             :     static void SetFlowTcpFlags(int idx, uint16_t flags);
     194             :     static void SetEvictedFlag(int idx);
     195             :     static void ResetEvictedFlag(int idx);
     196             :     static void FlowNatResponse(uint32_t seq_num, vr_flow_req *req, int code = 0);
     197             :     static void SetUnderlaySourcePort(int idx, int port);
     198             :     vr_bridge_entry* BridgeMmapAlloc(int size);
     199             :     void BridgeMmapFree();
     200             :     vr_bridge_entry* GetBridgeEntry(int idx);
     201             :     void SetBridgeEntry(uint32_t idx, vr_route_req *req, bool set);
     202             :     void UpdateBridgeEntryInactiveFlag(int idx, bool set);
     203             :     friend class MockDumpHandlerBase;
     204             :     friend class RouteDumpHandler;
     205             :     friend class VrfAssignDumpHandler;
     206             :     friend class VrfDumpHandler;
     207             :     void SetBlockMsgProcessing(bool enable);
     208        1987 :     bool IsBlockMsgProcessing() {
     209        1987 :         std::scoped_lock lock(ctx_queue_lock_);
     210        1987 :         return block_msg_processing_;
     211        1987 :     }
     212             : 
     213           8 :     void set_is_incremental_index(bool incremental) {
     214           8 :         is_incremental_index_ = incremental;
     215           8 :     }
     216             : 
     217          44 :     bool is_incremental_index() { return is_incremental_index_; }
     218             : 
     219           5 :     void SetKSyncError(KSyncSockEntryType type, int ksync_error) {
     220           5 :         ksync_error_[type] = ksync_error;
     221           5 :     }
     222             : 
     223         288 :     int GetKSyncError(KSyncSockEntryType type) {
     224         288 :         return ksync_error_[type];
     225             :     }
     226             : 
     227             :     // Add a response in nl_client into tx_buff_list_
     228             :     void AddNetlinkTxBuff(struct nl_client *cl);
     229             :     void InitNetlinkDoneMsg(struct nlmsghdr *nlh, uint32_t seq_num);
     230             :     void DisableReceiveQueue(bool disable);
     231             : private:
     232             :     void PurgeBlockedMsg();
     233             :     udp::socket sock_;
     234             :     udp::endpoint local_ep_;
     235             :     int ksync_error_[KSYNC_MAX_ENTRY_TYPE];
     236             :     bool block_msg_processing_;
     237             :     bool is_incremental_index_;
     238             :     static KSyncSockTypeMap *singleton_;
     239             :     static vr_flow_entry *flow_table_;
     240             :     vr_bridge_entry *bridge_table_;
     241             :     static int error_code_;
     242             :     // List of nl_client messages to be sent. In case of bulk message, all
     243             :     // responses are initially put into this list and finally NL_MULTI
     244             :     // netlink messages are sent
     245             :     std::vector<struct nl_client> tx_buff_list_;
     246             :     DISALLOW_COPY_AND_ASSIGN(KSyncSockTypeMap);
     247             : };
     248             : 
     249             : class MockDumpHandlerBase {
     250             : public:
     251           2 :     MockDumpHandlerBase() {}
     252           2 :     virtual ~MockDumpHandlerBase() {}
     253             :     void SendDumpResponse(uint32_t seq_num, Sandesh *);
     254             :     void SendGetResponse(uint32_t seq_num, int idx);
     255             :     virtual Sandesh* GetFirst(Sandesh *) = 0;
     256             :     virtual Sandesh* GetNext(Sandesh *) = 0;
     257             :     virtual Sandesh* Get(int idx) = 0;
     258             : };
     259             : 
     260             : class IfDumpHandler : public MockDumpHandlerBase {
     261             : public:
     262           0 :     IfDumpHandler() : MockDumpHandlerBase() {}
     263             :     virtual Sandesh* GetFirst(Sandesh *);
     264             :     virtual Sandesh* GetNext(Sandesh *);
     265             :     virtual Sandesh* Get(int idx);
     266             : private:
     267             :     vr_drop_stats_req drop_stats_req;
     268             : };
     269             : 
     270             : class NHDumpHandler : public MockDumpHandlerBase {
     271             : public:
     272           0 :     NHDumpHandler() : MockDumpHandlerBase() {}
     273             :     virtual Sandesh* GetFirst(Sandesh *);
     274             :     virtual Sandesh* GetNext(Sandesh *);
     275             :     virtual Sandesh* Get(int idx);
     276             : };
     277             : 
     278             : class MplsDumpHandler : public MockDumpHandlerBase {
     279             : public:
     280           0 :     MplsDumpHandler() : MockDumpHandlerBase() {}
     281             :     virtual Sandesh* GetFirst(Sandesh *);
     282             :     virtual Sandesh* GetNext(Sandesh *);
     283             :     virtual Sandesh* Get(int idx);
     284             : };
     285             : 
     286             : class MirrorDumpHandler : public MockDumpHandlerBase {
     287             : public:
     288           0 :     MirrorDumpHandler() : MockDumpHandlerBase() {}
     289             :     virtual Sandesh* GetFirst(Sandesh *);
     290             :     virtual Sandesh* GetNext(Sandesh *);
     291             :     virtual Sandesh* Get(int idx);
     292             : };
     293             : 
     294             : class RouteDumpHandler : public MockDumpHandlerBase {
     295             : public:
     296           0 :     RouteDumpHandler() : MockDumpHandlerBase() {}
     297             :     virtual Sandesh* GetFirst(Sandesh *);
     298             :     virtual Sandesh* GetNext(Sandesh *);
     299             :     /* GET operation is not supported for vrf assign */
     300           0 :     virtual Sandesh* Get(int idx) {
     301           0 :         return NULL;
     302             :     }
     303             : };
     304             : 
     305             : class VrfAssignDumpHandler : public MockDumpHandlerBase {
     306             : public:
     307           0 :     VrfAssignDumpHandler() : MockDumpHandlerBase() {}
     308             :     virtual Sandesh* GetFirst(Sandesh *);
     309             :     virtual Sandesh* GetNext(Sandesh *);
     310             :     /* GET operation is not supported for route */
     311           0 :     virtual Sandesh* Get(int idx) {
     312           0 :         return NULL;
     313             :     }
     314             : };
     315             : 
     316             : class VrfDumpHandler : public MockDumpHandlerBase {
     317             : public:
     318           0 :     VrfDumpHandler() : MockDumpHandlerBase() {}
     319             :     virtual Sandesh* GetFirst(Sandesh *);
     320             :     virtual Sandesh* GetNext(Sandesh *);
     321             :     virtual Sandesh* Get(int idx);
     322             : };
     323             : 
     324             : class VrfStatsDumpHandler : public MockDumpHandlerBase {
     325             : public:
     326           0 :     VrfStatsDumpHandler() : MockDumpHandlerBase() {}
     327             :     virtual Sandesh* GetFirst(Sandesh *);
     328             :     virtual Sandesh* GetNext(Sandesh *);
     329             :     virtual Sandesh* Get(int idx);
     330             : };
     331             : 
     332             : class VxLanDumpHandler : public MockDumpHandlerBase {
     333             : public:
     334           0 :     VxLanDumpHandler() : MockDumpHandlerBase() {}
     335             :     virtual Sandesh* GetFirst(Sandesh *);
     336             :     virtual Sandesh* GetNext(Sandesh *);
     337             :     virtual Sandesh* Get(int idx);
     338             : };
     339             : 
     340             : class DropStatsDumpHandler : public MockDumpHandlerBase {
     341             : public:
     342           0 :     DropStatsDumpHandler() : MockDumpHandlerBase() {}
     343           0 :     virtual Sandesh* GetFirst(Sandesh *) { return NULL; }
     344           0 :     virtual Sandesh* GetNext(Sandesh *) { return NULL; }
     345           0 :     virtual Sandesh* Get(int idx) {
     346           0 :         KSyncSockTypeMap *sock = KSyncSockTypeMap::GetKSyncSockTypeMap();
     347           0 :         return &sock->drop_stats;
     348             :     }
     349             : };
     350             : 
     351             : class VRouterOpsDumpHandler : public MockDumpHandlerBase {
     352             : public:
     353           2 :     VRouterOpsDumpHandler() : MockDumpHandlerBase() {}
     354           0 :     virtual Sandesh* GetFirst(Sandesh *) { return NULL;}
     355           0 :     virtual Sandesh* GetNext(Sandesh *) { return NULL;}
     356           2 :     virtual Sandesh* Get(int idx) {
     357           2 :         KSyncSockTypeMap *sock = KSyncSockTypeMap::GetKSyncSockTypeMap();
     358           2 :         return &sock->ksync_vrouter_ops;
     359             :     }
     360             : };
     361             : 
     362             : 
     363             : class KSyncUserSockIfContext : public KSyncUserSockContext {
     364             : public:
     365         115 :     KSyncUserSockIfContext(uint32_t seq_num, vr_interface_req *req) : KSyncUserSockContext(seq_num) {
     366         115 :         if (req) {
     367         115 :             req_ = new vr_interface_req(*req);
     368             :         } else {
     369           0 :             req_ = NULL;
     370             :         }
     371         115 :     }
     372         230 :     ~KSyncUserSockIfContext() {
     373         115 :         if (req_) {
     374         115 :             delete req_;
     375         115 :             req_ = NULL;
     376             :         }
     377         230 :     }
     378             : 
     379             :     virtual void Process();
     380             : private:
     381             :     vr_interface_req *req_;
     382             : };
     383             : 
     384             : class KSyncUserSockNHContext : public KSyncUserSockContext {
     385             : public:
     386         526 :     KSyncUserSockNHContext(uint32_t seq_num, vr_nexthop_req *req) : KSyncUserSockContext(seq_num) {
     387         526 :         if (req) {
     388         526 :             req_ = new vr_nexthop_req(*req);
     389             :         } else {
     390           0 :             req_ = NULL;
     391             :         }
     392         526 :     }
     393        1052 :     ~KSyncUserSockNHContext() {
     394         526 :         if (req_) {
     395         526 :             delete req_;
     396         526 :             req_ = NULL;
     397             :         }
     398        1052 :     }
     399             : 
     400             :     virtual void Process();
     401             : private:
     402             :     vr_nexthop_req *req_;
     403             : };
     404             : 
     405             : class KSyncUserSockMplsContext : public KSyncUserSockContext {
     406             : public:
     407         390 :     KSyncUserSockMplsContext(uint32_t seq_num, vr_mpls_req *req) : KSyncUserSockContext(seq_num) {
     408         390 :         if (req) {
     409         390 :             req_ = new vr_mpls_req(*req);
     410             :         } else {
     411           0 :             req_ = NULL;
     412             :         }
     413         390 :     }
     414         780 :     ~KSyncUserSockMplsContext() {
     415         390 :         if (req_) {
     416         390 :             delete req_;
     417         390 :             req_ = NULL;
     418             :         }
     419         780 :     }
     420             : 
     421             :     virtual void Process();
     422             : private:
     423             :     vr_mpls_req *req_;
     424             : };
     425             : 
     426             : class KSyncUserSockFlowContext : public KSyncUserSockContext {
     427             : public:
     428         144 :     KSyncUserSockFlowContext(uint32_t seq_num, vr_flow_req *req) : KSyncUserSockContext(seq_num) {
     429         144 :         if (req) {
     430         144 :             req_ = new vr_flow_req(*req);
     431             :         } else {
     432           0 :             req_ = NULL;
     433             :         }
     434         144 :     }
     435         288 :     ~KSyncUserSockFlowContext() {
     436         144 :         if (req_) {
     437         144 :             delete req_;
     438         144 :             req_ = NULL;
     439             :         }
     440         288 :     }
     441             : 
     442             :     virtual void Process();
     443             : private:
     444             :     vr_flow_req *req_;
     445             : };
     446             : 
     447             : class KSyncUserSockRouteContext : public KSyncUserSockContext {
     448             : public:
     449         728 :     KSyncUserSockRouteContext(uint32_t seq_num, vr_route_req *req) :
     450         728 :         KSyncUserSockContext(seq_num) {
     451         728 :         if (req) {
     452             :             /* For delete of AF_BRIDGE entries, we need rtr_index of
     453             :              * vr_route_req to find vr_bridge_entry and reset its flags. The
     454             :              * rtr_index is configured while doing add of AF_BRIDGE entry. When
     455             :              * delete of AF_BRIDGE arrives, we do lookup of vr_route_req from
     456             :              * our tree to figure out the rtr_index */
     457        1044 :             if ((req->get_h_op() == sandesh_op::DEL) &&
     458         316 :                 (req->get_rtr_family() == AF_BRIDGE)) {
     459         137 :                 KSyncSockTypeMap *sock = KSyncSockTypeMap::GetKSyncSockTypeMap();
     460             :                 KSyncSockTypeMap::ksync_rt_tree::iterator it =
     461         137 :                     sock->rt_tree.find(*req);
     462         137 :                 assert (it != sock->rt_tree.end());
     463         137 :                 const vr_route_req &tmp_req = *it;
     464         137 :                 req_ = new vr_route_req(tmp_req);
     465             :                 /* Change the operation to DELETE after picking request from
     466             :                  * our tree */
     467         137 :                 req_->set_h_op(sandesh_op::DEL);
     468             :             } else {
     469         591 :                 req_ = new vr_route_req(*req);
     470             :             }
     471             :         } else {
     472           0 :             req_ = NULL;
     473             :         }
     474         728 :     }
     475        1456 :     ~KSyncUserSockRouteContext() {
     476         728 :         if (req_) {
     477         728 :             delete req_;
     478         728 :             req_ = NULL;
     479             :         }
     480        1456 :     }
     481             : 
     482             :     virtual void Process();
     483             : private:
     484             :     vr_route_req *req_;
     485             : };
     486             : 
     487             : class KSyncUserSockVrfAssignContext : public KSyncUserSockContext {
     488             : public:
     489           0 :     KSyncUserSockVrfAssignContext(uint32_t seq_num, vr_vrf_assign_req *req) :
     490           0 :         KSyncUserSockContext(seq_num) {
     491           0 :         if (req) {
     492           0 :             req_ = new vr_vrf_assign_req(*req);
     493             :         } else {
     494           0 :             req_ = NULL;
     495             :         }
     496           0 :     }
     497           0 :     ~KSyncUserSockVrfAssignContext() {
     498           0 :         if (req_) {
     499           0 :             delete req_;
     500           0 :             req_ = NULL;
     501             :         }
     502           0 :     }
     503             : 
     504             :     virtual void Process();
     505             : private:
     506             :     vr_vrf_assign_req *req_;
     507             : };
     508             : 
     509             : class KSyncUserSockVrfContext : public KSyncUserSockContext {
     510             : public:
     511          48 :     KSyncUserSockVrfContext(uint32_t seq_num, vr_vrf_req *req) :
     512          48 :         KSyncUserSockContext(seq_num) {
     513          48 :         if (req) {
     514          48 :             req_ = new vr_vrf_req(*req);
     515             :         } else {
     516           0 :             req_ = NULL;
     517             :         }
     518          48 :     }
     519          96 :     ~KSyncUserSockVrfContext() {
     520          48 :         if (req_) {
     521          48 :             delete req_;
     522          48 :             req_ = NULL;
     523             :         }
     524          96 :     }
     525             : 
     526             :     virtual void Process();
     527             : private:
     528             :     vr_vrf_req *req_;
     529             : };
     530             : 
     531             : class KSyncUserSockVrfStatsContext : public KSyncUserSockContext {
     532             : public:
     533           0 :     KSyncUserSockVrfStatsContext(uint32_t seq_num, vr_vrf_stats_req *req) : KSyncUserSockContext(seq_num) {
     534           0 :         if (req) {
     535           0 :             req_ = new vr_vrf_stats_req(*req);
     536             :         } else {
     537           0 :             req_ = NULL;
     538             :         }
     539           0 :     }
     540           0 :     ~KSyncUserSockVrfStatsContext() {
     541           0 :         if (req_) {
     542           0 :             delete req_;
     543           0 :             req_ = NULL;
     544             :         }
     545           0 :     }
     546             : 
     547             :     virtual void Process();
     548             : private:
     549             :     vr_vrf_stats_req *req_;
     550             : };
     551             : 
     552             : class KSyncUserSockVxLanContext : public KSyncUserSockContext {
     553             : public:
     554          34 :     KSyncUserSockVxLanContext(uint32_t seq_num, vr_vxlan_req *req) : KSyncUserSockContext(seq_num) {
     555          34 :         if (req) {
     556          34 :             req_ = new vr_vxlan_req(*req);
     557             :         } else {
     558           0 :             req_ = NULL;
     559             :         }
     560          34 :     }
     561          68 :     ~KSyncUserSockVxLanContext() {
     562          34 :         if (req_) {
     563          34 :             delete req_;
     564          34 :             req_ = NULL;
     565             :         }
     566          68 :     }
     567             : 
     568             :     virtual void Process();
     569             : private:
     570             :     vr_vxlan_req *req_;
     571             : };
     572             : 
     573             : class KSyncUserSockDropStatsContext : public KSyncUserSockContext {
     574             : public:
     575           0 :     KSyncUserSockDropStatsContext(uint32_t seq_num, vr_drop_stats_req *req) : KSyncUserSockContext(seq_num) {
     576           0 :         if (req) {
     577           0 :             req_ = new vr_drop_stats_req(*req);
     578             :         } else {
     579           0 :             req_ = NULL;
     580             :         }
     581           0 :     }
     582           0 :     ~KSyncUserSockDropStatsContext() {
     583           0 :         if (req_) {
     584           0 :             delete req_;
     585           0 :             req_ = NULL;
     586             :         }
     587           0 :     }
     588             : 
     589             :     virtual void Process();
     590             : private:
     591             :     vr_drop_stats_req *req_;
     592             : };
     593             : 
     594             : class KSyncUserVrouterOpsContext : public KSyncUserSockContext {
     595             : public:
     596           2 :     KSyncUserVrouterOpsContext(uint32_t seq_num, vrouter_ops *req) :
     597           2 :         KSyncUserSockContext(seq_num) {
     598           2 :         if (req) {
     599           2 :             req_ = new vrouter_ops(*req);
     600             :         } else {
     601           0 :             req_ = NULL;
     602             :         }
     603           2 :     }
     604           4 :     ~KSyncUserVrouterOpsContext() {
     605           2 :         if (req_) {
     606           2 :             delete req_;
     607           2 :             req_ = NULL;
     608             :         }
     609           4 :     }
     610             : 
     611             :     virtual void Process();
     612             : private:
     613             :     vrouter_ops *req_;
     614             : };
     615             : 
     616             : 
     617             : #endif // ctrlplane_ksync_sock_user_h

Generated by: LCOV version 1.14