LCOV - code coverage report
Current view: top level - vnsw/agent/kstate - mirror_kstate.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 0 39 0.0 %
Date: 2026-08-03 02:19:58 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #include "kstate.h"
       6             : #include "mirror_kstate.h"
       7             : #include "vr_mirror.h"
       8             : 
       9             : using namespace std;
      10             : 
      11           0 : MirrorKState::MirrorKState(KMirrorResp *obj, const std::string &resp_ctx,
      12           0 :     vr_mirror_req &req, int id): KState(resp_ctx, obj) {
      13             : 
      14           0 :     req.set_mirr_index(id);
      15           0 :     if (id >= 0) {
      16           0 :         req.set_h_op(sandesh_op::GET);
      17             :     } else {
      18           0 :         req.set_h_op(sandesh_op::DUMP);
      19           0 :         req.set_mirr_marker(-1);
      20             :     }
      21           0 : }
      22             : 
      23           0 : void MirrorKState::SendNextRequest() {
      24           0 :     vr_mirror_req req;
      25             : 
      26           0 :     req.set_mirr_index(0);
      27           0 :     req.set_h_op(sandesh_op::DUMP);
      28           0 :     int32_t idx = boost::any_cast<int32_t>(more_context_);
      29           0 :     req.set_mirr_marker(idx);
      30           0 :     EncodeAndSend(req);
      31           0 : }
      32             : 
      33           0 : void MirrorKState::Handler() {
      34           0 :     KMirrorResp *resp = static_cast<KMirrorResp *>(response_object_);
      35           0 :     if (resp) {
      36           0 :         if (MoreData()) {
      37             :             /* There are more nexthops in Kernel. We need to query them from
      38             :              * Kernel and send it to Sandesh.
      39             :              */
      40           0 :             SendResponse();
      41           0 :             SendNextRequest();
      42             :         } else {
      43           0 :             resp->set_context(response_context_);
      44           0 :             resp->Response();
      45           0 :             more_context_ = boost::any();
      46             :         }
      47             :     }
      48           0 : }
      49             : 
      50           0 : void MirrorKState::SendResponse() {
      51             : 
      52           0 :     KMirrorResp *resp = static_cast<KMirrorResp *>(response_object_);
      53           0 :     resp->set_context(response_context_);
      54           0 :     resp->set_more(true);
      55           0 :     resp->Response();
      56             : 
      57           0 :     response_object_ = new KMirrorResp();
      58           0 : }
      59             : 
      60           0 : const string MirrorKState::FlagsToString(int flags) const {
      61           0 :     if (flags == 0) {
      62           0 :         return "NIL";
      63             :     }
      64           0 :     if (flags & VR_MIRROR_FLAG_MARKED_DELETE) {
      65           0 :         return "MARKED_DELETE";
      66             :     }
      67           0 :     return "INVALID";
      68             : }

Generated by: LCOV version 1.14