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-06-18 08:29:03 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            9 : DatagramPacket::DatagramPacket(
      18            9 :     uint8_t const data[], uint16_t const length, ::ip::IPAddress const address, uint16_t const port)
      19            9 : : _endpoint(::ip::IPEndpoint(address, port)), _data(data), _length(length)
      20            9 : {}
      21              : 
      22           79 : DatagramPacket::DatagramPacket(
      23           79 :     uint8_t const data[], uint16_t const length, ::ip::IPEndpoint const& endpoint)
      24           79 : : _endpoint(endpoint), _data(data), _length(length)
      25           79 : {}
      26              : 
      27            4 : bool DatagramPacket::operator==(DatagramPacket const& other) const
      28              : {
      29            4 :     if (_endpoint == other._endpoint)
      30              :     {
      31            3 :         if (_length == other._length)
      32              :         {
      33            2 :             return ::memcmp(_data, other._data, static_cast<size_t>(_length)) == 0;
      34              :         }
      35              :     }
      36            2 :     return false;
      37              : }
      38              : 
      39              : } // namespace udp
        

Generated by: LCOV version 2.0-1