LCOV - code coverage report
Current view: top level - libs/bsw/cpp2ethernet/src/udp - DatagramPacket.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 13 13
Test Date: 2026-10-23 12:52:11 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /********************************************************************************
       2              :  * Copyright (c) 2025 Accenture
       3              :  *
       4              :  * This program and the accompanying materials are made available under the
       5              :  * terms of the Apache License Version 2.0 which is available at
       6              :  * https://www.apache.org/licenses/LICENSE-2.0
       7              :  *
       8              :  * SPDX-License-Identifier: Apache-2.0
       9              :  ********************************************************************************/
      10              : 
      11              : #include "udp/DatagramPacket.h"
      12              : 
      13              : #include <cstring>
      14              : 
      15              : namespace udp
      16              : {
      17           10 : DatagramPacket::DatagramPacket(
      18              :     uint8_t const* const data,
      19              :     uint16_t const length,
      20              :     ::ip::IPAddress const address,
      21           10 :     uint16_t const port)
      22           10 : : _endpoint(::ip::IPEndpoint(address, port)), _data(data), _length(length)
      23           10 : {}
      24              : 
      25           85 : DatagramPacket::DatagramPacket(
      26           85 :     uint8_t const* const data, uint16_t const length, ::ip::IPEndpoint const& endpoint)
      27           85 : : _endpoint(endpoint), _data(data), _length(length)
      28           85 : {}
      29              : 
      30            4 : bool DatagramPacket::operator==(DatagramPacket const& other) const
      31              : {
      32            4 :     if (_endpoint == other._endpoint)
      33              :     {
      34            3 :         if (_length == other._length)
      35              :         {
      36            2 :             return ::memcmp(_data, other._data, static_cast<size_t>(_length)) == 0;
      37              :         }
      38              :     }
      39            2 :     return false;
      40              : }
      41              : 
      42              : } // namespace udp
        

Generated by: LCOV version 2.0-1