LCOV - code coverage report
Current view: top level - ksync - ksync_netlink.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 0 69 0.0 %
Date: 2026-06-22 02:21:21 Functions: 0 6 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 <sys/types.h>
       6             : #include <sys/socket.h>
       7             : #if defined(__linux__)
       8             : #include <linux/netlink.h>
       9             : #include <linux/rtnetlink.h>
      10             : #include <linux/sockios.h>
      11             : #endif
      12             : 
      13             : #include <boost/bind/bind.hpp>
      14             : 
      15             : #include <base/logging.h>
      16             : #include <db/db.h>
      17             : #include <db/db_entry.h>
      18             : #include <db/db_table.h>
      19             : #include <db/db_table_partition.h>
      20             : 
      21             : #include <sandesh/sandesh_trace.h>
      22             : 
      23             : #include "ksync_index.h"
      24             : #include "ksync_entry.h"
      25             : #include "ksync_object.h"
      26             : #include "ksync_sock.h"
      27             : #include "ksync_types.h"
      28             : #include "ksync_netlink.h"
      29             : 
      30             : using namespace boost::placeholders;
      31             : 
      32             : ///////////////////////////////////////////////////////////////////////////////
      33             : // KSyncNetlinkEntry routines
      34             : ///////////////////////////////////////////////////////////////////////////////
      35           0 : bool KSyncNetlinkEntry::Add() {
      36           0 :     Sync();
      37           0 :     int len = MsgLen();
      38           0 :     char *msg = (char *)malloc(len);
      39           0 :     int  msg_len = AddMsg(msg, len);
      40           0 :     assert(msg_len <= len);
      41           0 :     if (msg_len == 0) {
      42           0 :         free(msg);
      43           0 :         return true;
      44             :     }
      45           0 :     KSyncSock   *sock = KSyncSock::Get(0);
      46           0 :     sock->SendAsync(this, msg_len, msg, KSyncEntry::ADD_ACK);
      47           0 :     return false;
      48             : }
      49             : 
      50           0 : bool KSyncNetlinkEntry::Change() {
      51           0 :     if (Sync() == false) {
      52           0 :         return true;
      53             :     }
      54             : 
      55           0 :     int len = MsgLen();
      56           0 :     char *msg = (char *)malloc(len);
      57           0 :     int  msg_len = ChangeMsg(msg, len);
      58           0 :     assert(msg_len <= len);
      59           0 :     if (msg_len == 0) {
      60           0 :         free(msg);
      61           0 :         return true;
      62             :     }
      63           0 :     KSyncSock   *sock = KSyncSock::Get(0);
      64           0 :     sock->SendAsync(this, msg_len, msg, KSyncEntry::CHANGE_ACK);
      65           0 :     return false;
      66             : }
      67             : 
      68           0 : bool KSyncNetlinkEntry::Delete() {
      69           0 :     int len = MsgLen();
      70           0 :     char *msg = (char *)malloc(len);
      71           0 :     int  msg_len = DeleteMsg(msg, len);
      72           0 :     assert(msg_len <= len);
      73           0 :     if (msg_len == 0) {
      74           0 :         free(msg);
      75           0 :         return true;
      76             :     }
      77           0 :     KSyncSock   *sock = KSyncSock::Get(0);
      78           0 :     sock->SendAsync(this, msg_len, msg, KSyncEntry::DEL_ACK);
      79           0 :     return false;
      80             : }
      81             : 
      82             : ///////////////////////////////////////////////////////////////////////////////
      83             : // KSyncNetlinkDBEntry routines
      84             : ///////////////////////////////////////////////////////////////////////////////
      85           0 : bool KSyncNetlinkDBEntry::Add() {
      86           0 :     int len = MsgLen();
      87           0 :     char *msg = (char *)malloc(len);
      88           0 :     int  msg_len = AddMsg(msg, len);
      89           0 :     assert(msg_len <= len);
      90           0 :     if (msg_len == 0) {
      91           0 :         free(msg);
      92           0 :         return true;
      93             :     }
      94           0 :     KSyncSock   *sock = KSyncSock::Get(0);
      95           0 :     sock->SendAsync(this, msg_len, msg, KSyncEntry::ADD_ACK);
      96           0 :     return false;
      97             : }
      98             : 
      99           0 : bool KSyncNetlinkDBEntry::Change() {
     100           0 :     int len = MsgLen();
     101           0 :     char *msg = (char *)malloc(len);
     102           0 :     int  msg_len = ChangeMsg(msg, len);
     103           0 :     assert(msg_len <= len);
     104           0 :     if (msg_len == 0) {
     105           0 :         free(msg);
     106           0 :         return true;
     107             :     }
     108           0 :     KSyncSock   *sock = KSyncSock::Get(0);
     109           0 :     sock->SendAsync(this, msg_len, msg, KSyncEntry::CHANGE_ACK);
     110           0 :     return false;
     111             : }
     112             : 
     113           0 : bool KSyncNetlinkDBEntry::Delete() {
     114           0 :     int len = MsgLen();
     115           0 :     char *msg = (char *)malloc(len);
     116           0 :     int  msg_len = DeleteMsg(msg, len);
     117           0 :     assert(msg_len <= len);
     118           0 :     if (msg_len == 0) {
     119           0 :         free(msg);
     120           0 :         return true;
     121             :     }
     122           0 :     KSyncSock   *sock = KSyncSock::Get(0);
     123           0 :     sock->SendAsync(this, msg_len, msg, KSyncEntry::DEL_ACK);
     124           0 :     return false;
     125             : }

Generated by: LCOV version 1.14