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

            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 <ip/IPEndpoint.h>
      14              : 
      15              : // include to get typedefs for forward_list
      16              : #include "someip/ProvidedService.h"
      17              : #include "someip/ServiceQuery.h"
      18              : 
      19              : namespace someip
      20              : {
      21              : class IServiceAnnouncer;
      22              : class QueryManager;
      23              : 
      24              : class IServiceRegistry
      25              : {
      26              : public:
      27              :     enum class SubscriptionResult : uint8_t
      28              :     {
      29              :         SUBSCRIBE_OK,
      30              :         SUBSCRIBE_OK_MULTICAST,
      31              :         SUBSCRIBE_ERROR,
      32              :         UNSUBSCRIBE_OK,
      33              :         UNSUBSCRIBE_ERROR
      34              :     };
      35              : 
      36              :     enum class ProvidedServiceResult : uint8_t
      37              :     {
      38              :         STATUS_OK,
      39              :         SERVICE_UNKNOWN,
      40              :         WRONG_MAJOR_VERSION
      41              :     };
      42              : 
      43          122 :     virtual ~IServiceRegistry() = default;
      44              : 
      45              :     virtual void init()     = 0;
      46              :     virtual void shutdown() = 0;
      47              : 
      48              :     /**
      49              :      * Pure virtual function that handles registering provided services.
      50              :      */
      51              :     virtual bool registerProvidedService(ProvidedService& service) = 0;
      52              : 
      53              :     /**
      54              :      * Pure virtual function that handles unregistering provided services.
      55              :      */
      56              :     virtual void unregisterProvidedService(ProvidedService& service) = 0;
      57              : 
      58              :     /**
      59              :      * Pure virtual function that handles registering service queries.
      60              :      */
      61              :     virtual bool registerServiceQuery(ServiceQuery& query) = 0;
      62              : 
      63              :     /**
      64              :      * Pure virtual function that handles unregistering service queries.
      65              :      */
      66              :     virtual void unregisterServiceQuery(ServiceQuery& query) = 0;
      67              : 
      68              :     /**
      69              :      * Pure virtual function that returns QueryManager if possible.
      70              :      */
      71              :     virtual QueryManager const* getQueryManager() const = 0;
      72              : 
      73              :     /**
      74              :      * Pure virtual function that returns instance ID of given service.
      75              :      */
      76              :     virtual instance_id::type getInstanceId(
      77              :         service_id::type serviceId,
      78              :         major_version::type majorVersion,
      79              :         ::ip::IPAddress const& ipAddress,
      80              :         uint16_t port,
      81              :         bool remoteProvider = true) const
      82              :         = 0;
      83              : 
      84              :     /**
      85              :      * Pure virtual function that handles behaviour when receiving an offer.
      86              :      */
      87              :     virtual void
      88              :     offerReceived(ServiceDescription const& receivedService, ::ip::IPAddress const& sourceAddress)
      89              :         = 0;
      90              : 
      91              :     /**
      92              :      * Pure virtual function that handles behaviour when receiving a subscribe.
      93              :      */
      94              :     virtual SubscriptionResult subscribeReceived(
      95              :         service_id::type serviceId,
      96              :         instance_id::type instanceId,
      97              :         major_version::type majorVersion,
      98              :         eventgroup_id::type eventGroup,
      99              :         ttl::type ttl,
     100              :         ::ip::IPAddress const& ipAddress,
     101              :         uint16_t port,
     102              :         uint8_t proto)
     103              :         = 0;
     104              : 
     105              :     /**
     106              :      * Pure virtual function that handles behaviour when receiving a subscribe Ack.
     107              :      */
     108              :     virtual void subscribeAckReceived(
     109              :         service_id::type serviceId,
     110              :         instance_id::type instanceId,
     111              :         eventgroup_id::type eventGroup,
     112              :         major_version::type majorVersion,
     113              :         ::ip::IPEndpoint const& multicastEndpoint,
     114              :         ::ip::IPAddress const& sourceAddress)
     115              :         = 0;
     116              : 
     117              :     /**
     118              :      * Pure virtual function that handles behaviour when receiving a subscribe Nack.
     119              :      */
     120              :     virtual void subscribeNackReceived(
     121              :         service_id::type serviceId,
     122              :         instance_id::type instanceId,
     123              :         eventgroup_id::type eventGroup,
     124              :         major_version::type majorVersion,
     125              :         ::ip::IPAddress const& sourceAddress)
     126              :         = 0;
     127              : 
     128              :     /**
     129              :      * Pure virtual function that removes subscriptions in case of reboot.
     130              :      */
     131              :     virtual void rebootDetected(::ip::IPAddress const& ipAddress) = 0;
     132              : 
     133              :     /**
     134              :      * Pure virtual function that states if service of interest is available.
     135              :      */
     136              :     virtual bool interestedInService(
     137              :         service_id::type serviceId,
     138              :         instance_id::type instanceId,
     139              :         major_version::type majorVersion) const
     140              :         = 0;
     141              : 
     142              :     /**
     143              :      * Pure virtual function that identifies a possible eventgroup port.
     144              :      */
     145              :     virtual bool isEventgroupPort(
     146              :         service_id::type serviceId,
     147              :         instance_id::type instanceId,
     148              :         major_version::type majorVersion,
     149              :         uint16_t port) const
     150              :         = 0;
     151              : 
     152              :     /**
     153              :      * Pure virtual function that returns current number of subscriptions.
     154              :      */
     155              :     virtual uint16_t getCurrentNumberOfSubscriptions() const = 0;
     156              : 
     157              :     /**
     158              :      * Pure virtual function that returns maximum number of subscriptions.
     159              :      */
     160              :     virtual uint16_t getMaximumNumberOfSubscriptions() const = 0;
     161              : 
     162              :     /**
     163              :      * Pure virtual function that returns current number of provided services.
     164              :      */
     165              :     virtual uint16_t getCurrentNumberOfProvidedServices() const = 0;
     166              : 
     167              :     /**
     168              :      * Pure virtual function that returns maximum number of provided services.
     169              :      */
     170              :     virtual uint16_t getMaximumNumberOfProvidedServices() const = 0;
     171              : 
     172              :     /**
     173              :      * Pure virtual function that returns current number of remote services.
     174              :      */
     175              :     virtual uint16_t getCurrentNumberOfRemoteServices() const = 0;
     176              : 
     177              :     /**
     178              :      * Pure virtual function that returns maximum number of remote services.
     179              :      */
     180              :     virtual uint16_t getMaximumNumberOfRemoteServices() const = 0;
     181              : };
     182              : 
     183              : } // namespace someip
        

Generated by: LCOV version 2.0-1