Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
rpc_server.h
1#ifndef RPC_SERVER_H
2#define RPC_SERVER_H
3
4#include <functional>
5#include <map>
6#include <set>
7#include <stdint.h>
8#include <vector>
9#include "./someip_rpc_message.h"
10
11namespace ara
12{
13 namespace com
14 {
15 namespace someip
16 {
19 namespace rpc
20 {
23 {
24 public:
27 std::function<bool(const std::vector<uint8_t> &, std::vector<uint8_t> &)>;
28
29 private:
30 const uint8_t mProtocolVersion;
31 const uint8_t mInterfaceVersion;
32 std::set<uint16_t> mServices;
33 std::map<uint32_t, HandlerType> mHandlers;
34
35 SomeIpReturnCode validate(
36 const SomeIpRpcMessage &request) const;
37
38 void getResponsePayload(
39 const SomeIpRpcMessage &request,
40 SomeIpReturnCode returnCode,
41 const std::vector<uint8_t>& rpcPayload,
42 std::vector<uint8_t> &payload) const;
43
44 void getResponsePayload(
45 const SomeIpRpcMessage &request,
46 SomeIpReturnCode returnCode,
47 std::vector<uint8_t> &payload) const;
48
49 protected:
54 uint8_t protocolVersion, uint8_t interfaceVersion) noexcept;
55
62 const std::vector<uint8_t> &requestPayload,
63 std::vector<uint8_t> &responsePayload) const;
64
65 public:
66 RpcServer() = delete;
67 RpcServer(const RpcServer &) = delete;
68
73 void SetHandler(
74 uint16_t serviceId, uint16_t methodId, HandlerType handler);
75
76 virtual ~RpcServer() noexcept = default;
77 };
78 }
79 }
80 }
81}
82
83#endif
SOME/IP RPC server.
Definition: rpc_server.h:23
bool TryInvokeHandler(const std::vector< uint8_t > &requestPayload, std::vector< uint8_t > &responsePayload) const
Try to invoke corresponding request handler at a message reception.
Definition: rpc_server.cpp:72
void SetHandler(uint16_t serviceId, uint16_t methodId, HandlerType handler)
Set a RPC request handler.
Definition: rpc_server.cpp:126
std::function< bool(const std::vector< uint8_t > &, std::vector< uint8_t > &)> HandlerType
SOME/IP RPC request handler type.
Definition: rpc_server.h:27
SOME/IP remote procedure call message.
Definition: someip_rpc_message.h:16