LCOV - code coverage report
Current view: top level - src/net - UDPSocket.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 4 4 100.0 %
Date: 2025-04-27 01:14:20 Functions: 1 1 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            : ** Copyright (C) 2022 CERN
       3                 :            : **
       4                 :            : ** This software is provided 'as-is', without any express or implied
       5                 :            : ** warranty.  In no event will the authors be held liable for any damages
       6                 :            : ** arising from the use of this software.
       7                 :            : **
       8                 :            : ** Permission is granted to anyone to use this software for any purpose,
       9                 :            : ** including commercial applications, and to alter it and redistribute it
      10                 :            : ** freely, subject to the following restrictions:
      11                 :            : **
      12                 :            : ** 1. The origin of this software must not be misrepresented; you must not
      13                 :            : **    claim that you wrote the original software. If you use this software
      14                 :            : **    in a product, an acknowledgment in the product documentation would be
      15                 :            : **    appreciated but is not required.
      16                 :            : ** 2. Altered source versions must be plainly marked as such, and must not be
      17                 :            : **    misrepresented as being the original software.
      18                 :            : ** 3. This notice may not be removed or altered from any source distribution.
      19                 :            : **
      20                 :            : ** Created on: 2022-12-20T16:22:21
      21                 :            : ** Author: Sylvain Fargier <sylvain.fargier@cern.ch>
      22                 :            : */
      23                 :            : 
      24                 :            : #include "UDPSocket.hpp"
      25                 :            : 
      26                 :            : #include <algorithm>
      27                 :            : #include <chrono>
      28                 :            : #include <cstring>
      29                 :            : #include <thread>
      30                 :            : 
      31                 :            : #include <arpa/inet.h>
      32                 :            : #include <logger/Logger.hpp>
      33                 :            : #include <netinet/in.h>
      34                 :            : #include <poll.h>
      35                 :            : #include <sys/socket.h>
      36                 :            : #include <unistd.h>
      37                 :            : 
      38                 :            : #include "../Exception.hpp"
      39                 :            : 
      40                 :            : namespace ccut {
      41                 :            : namespace net {
      42                 :            : 
      43                 :          8 : int UDPSocket::makeSocket(bool ipv6)
      44                 :            : {
      45                 :          8 :     if (ipv6)
      46                 :          2 :         return socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
      47                 :            :     else
      48                 :          6 :         return socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
      49                 :            : }
      50                 :            : 
      51                 :            : } // namespace net
      52                 :            : } // namespace ccut

Generated by: LCOV version 1.14