|
Pin
|
Modules | |
| PLUGIN | |
Namespaces | |
| namespace | remote |
| namespace | pinrt::rscschema |
Classes | |
| struct | remote::Rpc_buffer_wrapper |
| struct | RPC_message_schema |
| struct | RPC_arg |
Macros | |
| #define | IS_RPC_EXEC_ERROR(ret) IS_PINOS_SYSCALL_ERROR(ret) |
| #define | RPCID_INVALID (t_rpc_id)(0xFFFFFFFF) |
| #define | RPCID_MIN (t_rpc_id)(2048) |
| #define | RPCID_MAX (t_rpc_id)(RPCID_INVALID - 1025) |
| #define | RPCID_RESERVED_LOW_RANGE_START (t_rpc_id)(0x00000000) |
| #define | RPCID_RESERVED_LOW_RANGE_END (t_rpc_id)(RPCID_MIN - 1) |
| #define | RPCID_RESERVED_HIGH_RANGE_START (t_rpc_id)(RPCID_MAX + 1) |
| #define | RPCID_RESERVED_HIGH_RANGE_END (t_rpc_id)(RPCID_INVALID - 1) |
| #define | RPCID_IS_VALID(rpcId) ((rpcId) >= RPCID_MIN && (rpcId) <= RPCID_MAX) |
| #define | RPCID_IS_RESERVED_LOW(rpcId) ((rpcId) >= RPCID_RESERVED_LOW_RANGE_START && (rpcId) <= RPCID_RESERVED_LOW_RANGE_END) |
| #define | RPCID_IS_RESERVED_HIGH(rpcId) ((rpcId) >= RPCID_RESERVED_HIGH_RANGE_START && (rpcId) <= RPCID_RESERVED_HIGH_RANGE_END) |
| #define | RPCID_IS_RESERVED(rpcId) (RPCID_IS_RESERVED_LOW(rpcId) || RPCID_IS_RESERVED_HIGH(rpcId)) |
| #define | RSC_RPC_MESSAGE_SCHEMA(rpcId, argCount, ...) |
| #define | MAKE_ARG_SCHEMA(rpcType, size) (t_rpc_arg_schema)(((uint32_t)rpcType & 0x000000FFU) | (((uint32_t)size & 0x00001FFF) << 16)) |
| #define | ARG_SCHEMA_TYPE(argSchema) ((E_rpc_arg_type)(argSchema & 0x000000FFU)) |
| #define | ARG_SCHEMA_SIZE(argSchema) ((size_t)((argSchema >> 16) & 0x00001FFFU)) |
| #define | MAX_RSC_RPC_SCHEMA_ARGS 32 |
| #define | RSC_RPC_DATA_OFFSET 48 |
Typedefs | |
| typedef enum E_rpc_arg_type | E_rpc_arg_type |
| typedef enum E_rpc_arg_flags | E_rpc_arg_flags |
| typedef uint32_t | t_rpc_id |
| typedef uint8_t | t_arg_count |
| typedef uint32_t | t_rpc_arg_schema |
| typedef struct RPC_message_schema | t_rpc_message_schema |
| typedef struct RPC_arg | t_rpc_arg |
Enumerations | |
| enum | E_pin_rpc_flags { PinRpcFlagsNone , PinRpcFlagsNoResponseRequired , PinRpcFlagsCanBlockIndefinitely } |
| enum | E_rpc_arg_type { RpcBoolean = 0 , RpcInt , RpcUInt , RpcChar , RpcFloat , RpcBuffer , RpcOOBRef , RpcRecord , RpcArray , RpcNil , RpcVoid = RpcNil , RpcPaddingNoEncode } |
| enum | E_rpc_arg_flags { RpcArgFlagsNone = 0x0 , RpcArgFlagsDataEmpty = (1 << 0) } |
Functions | |
| t_syscall_ret | PIN_DoRPC (t_rpc_message_schema const *rpcSchema, t_rpc_arg *rpcArgs, E_pin_rpc_flags flags=PinRpcFlagsNone) noexcept |
| size_t | PIN_CalculateSafeRPCDataSize (t_rpc_message_schema const *rpcSchema) noexcept |
| Rpc_buffer_wrapper | remote::rpc_buffer (void *mem, size_t size, E_rpc_arg_flags flags=RpcArgFlagsNone) noexcept |
| Rpc_buffer_wrapper | remote::rpc_buffer (const void *mem, size_t size) noexcept |
| template<t_rpc_message_schema const & SCHEMA, typename RetType , E_pin_rpc_flags Flags = PinRpcFlagsNone, typename... Args> | |
| pinrt::std::enable_if_t< details::Rpc_arg_type_traits< RetType >::is_void, bool > | remote::do_rpc (Args &&... args) noexcept |
| template<t_rpc_message_schema const & SCHEMA, typename RetType , E_pin_rpc_flags Flags = PinRpcFlagsNone, typename... Args> | |
| pinrt::std::enable_if_t< !details::Rpc_arg_type_traits< RetType >::is_void, bool > | remote::do_rpc (RetType &retValue, Args &&... args) noexcept |
Remote Procedure Call APIs can be used by Pintools to execute RPCs implemented by a pind RPC plugin.
An example of using the remote APIs can be find in ManualExamples/buffer_offload.cpp
| #define IS_RPC_EXEC_ERROR | ( | ret | ) | IS_PINOS_SYSCALL_ERROR(ret) |
Check if ret is an error.
Client side interface to pind RPC plugins.
See Executing Remote Procedures section in Pin User Manual
This macro should be used to check if PIN_DoRPC() succeeded or not.
| #define MAKE_ARG_SCHEMA | ( | rpcType, | |
| size | |||
| ) | (t_rpc_arg_schema)(((uint32_t)rpcType & 0x000000FFU) | (((uint32_t)size & 0x00001FFF) << 16)) |
Helper macro for creating t_rpc_arg_schema.
| rpcType | The type of the argument (E_rpc_arg_type) |
| size | The size of the argument in bytes (for RpcRecord this is the number of members which can be at most 4096) |
| #define RPCID_INVALID (t_rpc_id)(0xFFFFFFFF) |
Indicates an Invalid RPC Id.
This RPC Id is used internally
| #define RPCID_MAX (t_rpc_id)(RPCID_INVALID - 1025) |
The largest valid RPC Id available for Pintool developers.
RPC Ids greater than RPCID_MAX are reserved for Pin
| #define RPCID_MIN (t_rpc_id)(2048) |
The smallest RPC Id available for Pintool developers.
RPC Ids less than RPCID_MIN are reserved for Pin
| #define RSC_RPC_MESSAGE_SCHEMA | ( | rpcId, | |
| argCount, | |||
| ... | |||
| ) |
Helper macro for creating a t_rpc_message_schema.
| typedef enum E_rpc_arg_type E_rpc_arg_type |
The type of RSC RPC argument.
This is the type we wish to encode from/decode to not the type inside the RSC RPC Message. For instance RpcInt might be encoded as int4, int12, varint, int4_neg, int12_neg or varint_neg
| enum E_pin_rpc_flags |
RPC flags.
| enum E_rpc_arg_flags |
Bitwise flags affecting the encoding of RPC arguments.
| enum E_rpc_arg_type |
The type of RSC RPC argument.
This is the type we wish to encode from/decode to not the type inside the RSC RPC Message. For instance RpcInt might be encoded as int4, int12, varint, int4_neg, int12_neg or varint_neg
|
inlinenoexcept |
Execute an RPC (Remote Procedure Call).
This function is a convenience wrapper around PIN_DoRPC(). See PIN_DoRPC() for details.
| SCHEMA | The schema of the RPC to use. Since this is a template argument the schema must be fully initialized at compile time. Current implementation does not check the arguments against the schema at compile time. This may change in the future. |
| RetType | The type of the return value of the RPC - The type must be void for this overload. When using this overload the type is not automatically deduced and do_rpc() should be called as do_rpc<SCHEMA, void>(...). |
| Flags | Flags modifying the behavior of the RPC. If the value is set to PinRpcFlagsNoResponseRequired then no response is expected from the server. If the value is set to PinRpcFlagsCanBlockIndefinitely then the RPC can block indefinitely waiting for a response. If the value is set to PinRpcFlagsNone then the RPC will wait for a response with some "reasonable" internal timeout. |
| Args | Type of arguments - pack automatically deduced |
| [in,out] | args | RPC arguments |
|
inlinenoexcept |
Execute an RPC (Remote Procedure Call).
This function is a convenience wrapper around PIN_DoRPC(). See PIN_DoRPC() for details.
| SCHEMA | The schema of the RPC to use. Since this is a template argument the schema must be fully initialized at compile time. Current implementation does not check the arguments against the schema at compile time. This may change in the future. |
| RetType | The type of the return value of the RPC - automatically deduced If RetType is Rpc_buffer_wrapper then the size member must be 0 or big enough to hold the return value. Please not that if size is 0 then we assume the buffer contains enough space for the return value. |
| Flags | Flags modifying the behavior of the RPC. If the value is set to PinRpcFlagsCanBlockIndefinitely then the RPC can block indefinitely waiting for a response. If the value is set to PinRpcFlagsNone then the RPC will wait for a response with some "reasonable" internal timeout. PinRpcFlagsNoResponseRequired cannot be used with non-void return types RPCs. |
| Args | Type of arguments - pack automatically deduced |
| [out] | retValue | An argument receiving the return value of the RPC |
| [in,out] | args | RPC arguments |
|
inlinenoexcept |
Calculate the size available for data given a message schema.
An RSC/RPC message can be of a maximum size of 64KB. However the actual size available for data in a message is 64KB - RSC_RPC_DATA_OFFSET - (size of argument encoding metadata). This function calculates the maximum possible size that the argument encoding metadata will take and returns a safe estimate to the size in bytes actually available for encoding.
| [in] | rpcSchema | The message schema for which to calculate the metadata overhead |
|
inlinenoexcept |
Execute an RPC (Remote Procedure Call).
The remote procedure is implemented by a plugin that is loaded by pind, the Pin server. The plugin must be installed prior starting pin with a Pintool that uses this function. For more information see Installing and Loading pind Plugins. If the plugin was not properly installed or loaded the call will fail. The return value of this function reflects the status of the remote execution. The return value of the remote function is written to the last arg in rpcArgs.
See Executing Remote Procedures section in Pin User Manual
| [in] | rpcSchema | The schema describing the remote procedure. Both the Pintool and the pind RPC plugin should use the same schema. The schema is used both to verify the arguments before calling the RPC, and is also used to verify the response to the RPC. The maximum arguments for an RPC schema accepted by this function is 15. |
| [in,out] | rpcArgs | An array of args to pass to the remote procedure. The args may be [in], [out] or [inout] arguments. The length of the array must be equal to the count of the message arguments as described by rpcSchema + one entry for the return value of the RPC. So the length of this array must be at least 1, even if the return argument type is RpcVoid or RpcNil. The return value of the remote procedure is written to the last argument in the array. Arguments are checked against rpcSchema. |
| [in] | flags | Flags modifying the behavior of the RPC. |
|
inlinenoexcept |
Wrap a buffer to be used as an argument to an RPC.
| [in] | mem | The buffer memory |
| [in] | size | The size of the buffer in bytes. If the size is 0 then no data is copied to the RPC request. |
|
inlinenoexcept |
Wrap a buffer to be used as an argument to an RPC.
| [in,out] | mem | The buffer memory |
| [in] | size | The size of the buffer in bytes. If size is 0 then no data will be copied into the RPC request. |
| [in] | flags | Flags modifying the behaviour of the argument encoding. If this is set to E_rpc_arg_flags::RpcArgFlagsDataEmpty then no data will be sent to the RPC, however the RPC can fill the buffer on return. This behaviour is just a performance optimization so if the buffer is intended to be filled by the RPC and the contents are not valid until the RPC returns, then there is no point in copying the initial content to the RPC request. |