Extend RPC parameters
The RPC model is extended to include parameters for identifying
an RPC interface instance at an endpoint and another for
identifying the parameter encoding. The interface ID parameter
allows multiple service interfaces to be co-located. The encoding
parameter allows clients to use different parameter serialization
schemes and to specify the format in each RPC request.
Signed-off-by: julhal01 <julian.hall@arm.com>
Change-Id: I201b3417dc0e9f655113b9931db3494e41f1d74b
diff --git a/components/rpc/common/endpoint/call_ep.h b/components/rpc/common/endpoint/rpc_interface.h
similarity index 65%
rename from components/rpc/common/endpoint/call_ep.h
rename to components/rpc/common/endpoint/rpc_interface.h
index 1b5d03d..44e5783 100644
--- a/components/rpc/common/endpoint/call_ep.h
+++ b/components/rpc/common/endpoint/rpc_interface.h
@@ -1,11 +1,11 @@
/*
- * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#ifndef CALL_EP_H
-#define CALL_EP_H
+#ifndef RPC_INTERFACE_H
+#define RPC_INTERFACE_H
#include <stddef.h>
#include <stdint.h>
@@ -51,16 +51,6 @@
return v;
}
-/** \brief Serializer for handling call parameters
- *
- * An abstract serializer pointer, used for attaching a concrete
- * serializer to a call request for serializing/deserializing call
- * parameters. The strategy for selecting an appropriate serializer
- * could be hard-coded or dynamic, based on a content type identifier
- * carried by a concrete rpc.
- */
-typedef const void* call_param_serializer_ptr;
-
/** \brief Call request
*
* A call request object represents a request from a client that will
@@ -68,9 +58,10 @@
*/
struct call_req {
uint32_t caller_id;
+ uint32_t interface_id;
uint32_t opcode;
+ uint32_t encoding;
int opstatus;
- call_param_serializer_ptr serializer;
struct call_param_buf req_buf;
struct call_param_buf resp_buf;
};
@@ -80,11 +71,21 @@
return req->caller_id;
}
+static inline uint32_t call_req_get_interface_id(const struct call_req *req)
+{
+ return req->interface_id;
+}
+
static inline uint32_t call_req_get_opcode(const struct call_req *req)
{
return req->opcode;
}
+static inline uint32_t call_req_get_encoding(const struct call_req *req)
+{
+ return req->encoding;
+}
+
static inline int call_req_get_opstatus(const struct call_req *req)
{
return req->opstatus;
@@ -95,11 +96,6 @@
req->opstatus = opstatus;
}
-static inline call_param_serializer_ptr call_req_get_serializer(const struct call_req *req)
-{
- return req->serializer;
-}
-
static inline struct call_param_buf *call_req_get_req_buf(struct call_req *req)
{
return &req->req_buf;
@@ -110,25 +106,25 @@
return &req->resp_buf;
}
-/** \brief Call endpoint
+/** \brief RPC interface
*
- * A generalized call endpoint. Provides a standard interface for a
+ * A generalized RPC interface. Provides a standard interface for a
* call endpoint that handles incoming call requests.
*/
-struct call_ep
+struct rpc_interface
{
void *context;
- rpc_status_t (*receive)(struct call_ep *ep, struct call_req *req);
+ rpc_status_t (*receive)(struct rpc_interface *iface, struct call_req *req);
};
-static inline rpc_status_t call_ep_receive(struct call_ep *ep,
+static inline rpc_status_t rpc_interface_receive(struct rpc_interface *iface,
struct call_req *req)
{
- return ep->receive(ep, req);
+ return iface->receive(iface, req);
}
#ifdef __cplusplus
}
#endif
-#endif /* CALL_EP_H */
+#endif /* RPC_INTERFACE_H */