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

Generated by: LCOV version 1.14