LCOV - code coverage report
Current view: top level - libs/bsw/cpp2someip/include/someip - IRpcHandler.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-09-11 12:05:06 Functions: 66.7 % 3 2

            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              : #pragma once
      12              : 
      13              : #include "someip/SomeIpMessage.h"
      14              : 
      15              : #include <ip/IPEndpoint.h>
      16              : 
      17              : #include <cstdint>
      18              : 
      19              : namespace someip
      20              : {
      21              : class IEventReceiver;
      22              : class NetworkChannel;
      23              : 
      24              : class IRpcHandler
      25              : {
      26              : protected:
      27           49 :     IRpcHandler() = default;
      28              : 
      29              : public:
      30              :     enum class ErrorCode : uint8_t
      31              :     {
      32              :         RPC_HANDLER_OK,
      33              :         RPC_HANDLER_ERROR,
      34              :         RPC_HANDLER_UNKNOWN_SERVICE,
      35              :         RPC_HANDLER_UNKNOWN_METHOD,
      36              :         RPC_HANDLER_WRONG_INTERFACE_VERSION,
      37              :         RPC_HANDLER_MALFORMED_MESSAGE,
      38              :         RPC_HANDLER_WRONG_MESSAGE_TYPE,
      39              :         RPC_HANDLER_WRONG_MESSAGE_TYPE_REQUEST_RESPONSE,
      40              :         RPC_HANDLER_WRONG_MESSAGE_TYPE_FIRE_AND_FORGET,
      41              :         RPC_HANDLER_NOT_RESPONSIBLE
      42              :     };
      43              : 
      44              :     IRpcHandler(IRpcHandler const&)            = delete;
      45              :     IRpcHandler& operator=(IRpcHandler const&) = delete;
      46              : 
      47           49 :     virtual ~IRpcHandler() = default;
      48              : 
      49              :     /**
      50              :      * Pure virtual function that is responsible for handling RPC messages.
      51              :      */
      52              :     virtual IRpcHandler::ErrorCode
      53              :     handleMessage(NetworkChannel const& channel, SomeIpMessage const& message)
      54              :         = 0;
      55              : 
      56              :     /**
      57              :      * Pure virtual function that is responsible for handling requests.
      58              :      */
      59              :     virtual ErrorCode handleRequest(
      60              :         SomeIpMessage const& message,
      61              :         ::ip::IPEndpoint const& sourceAddress,
      62              :         uint16_t localPort,
      63              :         uint8_t proto)
      64              :         = 0;
      65              : 
      66              :     /**
      67              :      * Pure virtual function that is responsible for handling responses.
      68              :      */
      69              :     virtual ErrorCode handleResponse(
      70              :         SomeIpMessage const& message, ::ip::IPEndpoint const& sourceAddress, uint16_t localPort)
      71              :         = 0;
      72              : 
      73              :     /**
      74              :      * Pure virtual function that is responsible for handling notifications.
      75              :      */
      76              :     virtual void handleNotification(
      77              :         SomeIpMessage const& message, ::ip::IPEndpoint const& sourceAddress, uint16_t localPort)
      78              :         = 0;
      79              : 
      80              :     /**
      81              :      * Pure virtual function that is responsible for handling errors.
      82              :      */
      83              :     virtual ErrorCode
      84              :     handleError(SomeIpMessage const& message, ::ip::IPEndpoint const& sourceAddress)
      85              :         = 0;
      86              : 
      87              :     /**
      88              :      * Pure virtual function that sets EventReceiver.
      89              :      */
      90              :     virtual void setEventReceiver(IEventReceiver& eventReceiver) = 0;
      91              : 
      92              :     /**
      93              :      * Pure virtual function that removes EventReceiver.
      94              :      */
      95              :     virtual void removeEventReceiver() = 0;
      96              : };
      97              : 
      98              : } // namespace someip
        

Generated by: LCOV version 2.0-1