LCOV - code coverage report
Current view: top level - libs/bsw/cpp2someip/src - ITpTransceiver.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 18 18
Test Date: 2026-09-11 12:05:06 Functions: 100.0 % 4 4

            Line data    Source code
       1              : /********************************************************************************
       2              :  * Copyright (c) 2026 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 "someip/ITpTransceiver.h"
      12              : 
      13              : #include "someip/SomeIpConstants.h"
      14              : 
      15              : namespace someip
      16              : {
      17              : // static
      18           17 : bool ITpTransceiver::isOutgoingTpMessage(proto::type const proto, uint32_t const length)
      19              : {
      20           17 :     if (proto::SD_L4_PROTO_UDP != proto)
      21              :     {
      22            1 :         return false;
      23              :     }
      24              : 
      25           16 :     return (length > UDP_PACKET_MAX_SIZE);
      26              : }
      27              : 
      28              : // static
      29            7 : bool ITpTransceiver::isIncomingTpMessage(
      30              :     proto::type const proto, SomeIpMessage::MessageType const type)
      31              : {
      32            7 :     if (proto::SD_L4_PROTO_UDP != proto)
      33              :     {
      34            2 :         return false;
      35              :     }
      36              : 
      37              :     return (
      38            5 :         (static_cast<uint8_t>(type) & static_cast<uint8_t>(TP_MESSAGE_TYPE_BIT_MASK))
      39            5 :         == static_cast<uint8_t>(TP_MESSAGE_TYPE_BIT_MASK));
      40              : }
      41              : 
      42              : // static
      43           38 : uint32_t ITpTransceiver::serializeTpHeader(TpHeader const& input)
      44              : {
      45           38 :     uint32_t const offset = static_cast<uint32_t>(input.payloadOffset & 0xFFFFFFF0U);
      46           38 :     uint32_t const flags
      47           38 :         = input.hasMoreSegments ? static_cast<uint32_t>(1U) : static_cast<uint32_t>(0U);
      48              : 
      49           38 :     return (offset | flags);
      50              : }
      51              : 
      52              : // static
      53           24 : void ITpTransceiver::parseTpHeader(uint32_t const input, TpHeader& output)
      54              : {
      55           24 :     output.payloadOffset   = static_cast<size_t>(input & 0xFFFFFFF0U);
      56           24 :     output.hasMoreSegments = static_cast<bool>(input & 0x00000001U);
      57           24 : }
      58              : 
      59              : } // namespace someip
        

Generated by: LCOV version 2.0-1