LCOV - code coverage report
Current view: top level - bfd - bfd_client.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 18 21 85.7 %
Date: 2026-06-18 01:51:13 Functions: 7 9 77.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : #include <boost/asio.hpp>
       5             : #include <boost/bind/bind.hpp>
       6             : #include <boost/function.hpp>
       7             : #include <boost/scoped_ptr.hpp>
       8             : #include <boost/random.hpp>
       9             : #include <set>
      10             : 
      11             : #include "base/logging.h"
      12             : #include "bfd/bfd_client.h"
      13             : #include "bfd/bfd_common.h"
      14             : #include "bfd/bfd_connection.h"
      15             : #include "bfd/bfd_server.h"
      16             : #include "bfd/bfd_session.h"
      17             : 
      18             : using namespace BFD;
      19             : using boost::bind;
      20             : using std::make_pair;
      21             : using std::pair;
      22             : using namespace boost::placeholders;
      23             : 
      24          18 : Client::Client(Connection *cm, ClientId id) : id_(id), cm_(cm) {
      25          18 : }
      26             : 
      27          18 : Client::~Client() {
      28             :     // DeleteClientSessions();
      29          18 : }
      30             : 
      31           0 : void Client::DeleteClientSessions() {
      32           0 :     cm_->GetServer()->DeleteClientSessions();
      33           0 : }
      34             : 
      35       11243 : Session *Client::GetSession(const SessionKey &key) const {
      36       11243 :     return cm_->GetServer()->SessionByKey(key);
      37             : }
      38             : 
      39       11243 : bool Client::Up(const SessionKey &key) const {
      40       11243 :     Session *session = GetSession(key);
      41       11243 :     return session && session->Up();
      42             : }
      43             : 
      44          28 : void Client::AddSession(const SessionKey &key, const SessionConfig &config) {
      45          28 :     cm_->GetServer()->AddSession(key, config, bind(&Client::Notify, this, _1,
      46             :                                                       _2));
      47          28 : }
      48             : 
      49          25 : void Client::DeleteSession(const SessionKey &key) {
      50          25 :     cm_->GetServer()->DeleteSession(key);
      51          25 : }
      52             : 
      53          75 : void Client::Notify(const SessionKey &key, const BFD::BFDState &new_state) {
      54          75 :     cm_->NotifyStateChange(key, new_state == kUp);
      55          75 : }

Generated by: LCOV version 1.14