|
librpc
|
#include <rpc/object.h>

Go to the source code of this file.
Typedefs | |
| typedef struct rpct_type * | rpct_type_t |
| typedef struct rpct_typei * | rpct_typei_t |
| typedef struct rpct_member * | rpct_member_t |
| typedef struct rpct_interface * | rpct_interface_t |
| typedef struct rpct_argument * | rpct_argument_t |
| typedef struct rpct_if_member * | rpct_if_member_t |
| typedef bool(^ | rpct_type_applier_t) (rpct_type_t) |
| typedef bool(^ | rpct_member_applier_t) (rpct_member_t) |
| typedef bool(^ | rpct_interface_applier_t) (rpct_interface_t) |
| typedef bool(^ | rpct_if_member_applier_t) (rpct_if_member_t) |
Enumerations | |
| enum | rpct_class_t { RPC_TYPING_STRUCT, RPC_TYPING_UNION, RPC_TYPING_ENUM, RPC_TYPING_TYPEDEF, RPC_TYPING_CONTAINER, RPC_TYPING_BUILTIN } |
| #define RPCT_IF_MEMBER_APPLIER | ( | _fn, | |
| _arg | |||
| ) |
| #define RPCT_INTERFACE_APPLIER | ( | _fn, | |
| _arg | |||
| ) |
| #define RPCT_MEMBER_APPLIER | ( | _fn, | |
| _arg | |||
| ) |
| #define RPCT_TYPE_APPLIER | ( | _fn, | |
| _arg | |||
| ) |
| typedef struct rpct_argument* rpct_argument_t |
| typedef bool(^ rpct_if_member_applier_t) (rpct_if_member_t) |
Block type used as a callback in rpct_if_member_apply.
| typedef struct rpct_if_member* rpct_if_member_t |
| typedef bool(^ rpct_interface_applier_t) (rpct_interface_t) |
Block type used as a callback in rpct_interface_apply.
| typedef struct rpct_interface* rpct_interface_t |
| typedef bool(^ rpct_member_applier_t) (rpct_member_t) |
Block type used as a callback in rpct_members_apply.
| typedef struct rpct_member* rpct_member_t |
| typedef bool(^ rpct_type_applier_t) (rpct_type_t) |
Block type used as a callback in rpct_types_apply.
| typedef struct rpct_type* rpct_type_t |
Represents a type, as defined in the interface definition file.
rpct_type_t represents a defined type, that is - an unspecialized type. Unspecialized means that if a type has any generic variables (eg. Type<A, B>), A and B are type placeholders.
Examples of unspecialized types:
| typedef struct rpct_typei* rpct_typei_t |
Represents a specialized type.
rpct_typei_t represents a specialized type, that is - a possibly generic type with its generic variables specialized with actual types.
One special case here is a partially specialized type. A partially specialized type may be present as a structure member, union branch or typedef body. "partially" means that some of the type variables might be specialized, but some others might not.
Examples of specialized types:
Examples of partially specialized types:
| enum rpct_class_t |
| void rpct_allow_idl_download | ( | rpc_context_t | context | ) |
| const char* rpct_argument_get_description | ( | rpct_argument_t | arg | ) |
Returns description string associated with the argument.
| arg | Argument handle |
| const char* rpct_argument_get_name | ( | rpct_argument_t | arg | ) |
Returns name associated with the argument.
| arg | Argument handle |
| rpct_typei_t rpct_argument_get_typei | ( | rpct_argument_t | arg | ) |
Returns type instance of the argument.
| arg | Argument handle |
| rpc_object_t rpct_deserialize | ( | rpc_object_t | object | ) |
| int rpct_download_idl | ( | rpc_connection_t | conn | ) |
XXX
| conn | Connection handle |
| rpct_if_member_t rpct_find_if_member | ( | const char * | interface, |
| const char * | member | ||
| ) |
Finds the member member of interface interface.
| interface | Interface name |
| member | Member name |
| rpct_interface_t rpct_find_interface | ( | const char * | name | ) |
Finds interface name.
| name | Interface name |
| void rpct_free | ( | void | ) |
Cleans up all the state associated with RPC type system.
| rpct_type_t rpct_get_type | ( | const char * | name | ) |
Looks up type by name.
| name | Type name |
| rpct_typei_t rpct_get_typei | ( | rpc_object_t | instance | ) |
Returns type instance handle associated with an object.
| instance | RPC object instance |
| rpc_object_t rpct_get_value | ( | rpc_object_t | instance | ) |
| instance |
| bool rpct_if_member_apply | ( | rpct_interface_t | iface, |
| rpct_if_member_applier_t | applier | ||
| ) |
Iterates over members of an interface.
| applier | Callback function |
true if iteration was terminated, otherwise false | const char* rpct_if_member_get_description | ( | rpct_if_member_t | member | ) |
Returns the interface member description.
| member | Interface member handle |
| const char* rpct_if_member_get_name | ( | rpct_if_member_t | member | ) |
Returns the interface member name.
| member | Interface member handle |
| enum rpc_if_member_type rpct_if_member_get_type | ( | rpct_if_member_t | member | ) |
Returns the interface member type.
| member | Interface member handle |
| int rpct_init | ( | bool | load_system_types | ) |
Initializes RPC type system
| bool rpct_interface_apply | ( | rpct_interface_applier_t | applier | ) |
Iterates over the defined functions.
| applier |
true if iteration was terminated, otherwise false | const char* rpct_interface_get_description | ( | rpct_interface_t | iface | ) |
Returns the interface description.
| iface | Interface handle |
NULL | const char* rpct_interface_get_name | ( | rpct_interface_t | iface | ) |
Returns the interface name.
| iface | Interface handle |
| const char* rpct_interface_get_origin | ( | rpct_interface_t | iface | ) |
Returns the place where interface was defined.
Returned string is in form file.yaml:line_number
| iface | Interface handle |
| int rpct_load_types | ( | const char * | path | ) |
Loads type information from an interface definition file.
| path | Path of the IDL file |
| int rpct_load_types_cached | ( | void | ) |
Loads type information from files previously loaded by rpct_read_idl.
| int rpct_load_types_dir | ( | const char * | path | ) |
| path |
| int rpct_load_types_stream | ( | int | fd | ) |
Loads type information from an interface definition stream.
File descriptor is closed once all definitions have been read from it or error happened.
| fd | IDL stream file descriptor |
| const char* rpct_member_get_description | ( | rpct_member_t | member | ) |
Returns the description of a member.
| member | Member handle |
| const char* rpct_member_get_name | ( | rpct_member_t | member | ) |
Returns the name of a member.
| member | Member handle |
| rpct_typei_t rpct_member_get_typei | ( | rpct_member_t | member | ) |
Returns the type of a member.
This functions returns NULL for enum members, because they're untyped.
| member | Member handle |
| bool rpct_members_apply | ( | rpct_type_t | type, |
| rpct_member_applier_t | applier | ||
| ) |
Iterates over the members of a given type.
| type | |
| applier |
true if iteration was terminated, otherwise false | rpct_argument_t rpct_method_get_argument | ( | rpct_if_member_t | method, |
| int | index | ||
| ) |
Returns argument handle for n-th argument of a function.
| func | Function handle |
| index | Argument index |
| int rpct_method_get_arguments_count | ( | rpct_if_member_t | method | ) |
Returns number of arguments a function takes.
| method | Method handle |
| rpct_typei_t rpct_method_get_return_type | ( | rpct_if_member_t | method | ) |
Returns the type instance handle representing return type of a function.
| method | Method handle |
| rpc_object_t rpct_new | ( | const char * | decl, |
| rpc_object_t | object | ||
| ) |
Creates a new object of the specified type.
| decl | Type declaration |
| object | Contents |
| rpct_typei_t rpct_new_typei | ( | const char * | decl | ) |
Creates a new type instance from provided declaration.
| decl | Type declaration |
| rpc_object_t rpct_newi | ( | rpct_typei_t | typei, |
| rpc_object_t | object | ||
| ) |
Creates a new object of the specified type.
| typei | Type instance handle |
| object | Contents |
| rpc_object_t rpct_post_call_hook | ( | void * | cookie, |
| rpc_object_t | args | ||
| ) |
| rpc_object_t rpct_pre_call_hook | ( | void * | cookie, |
| rpc_object_t | args | ||
| ) |
| rpct_typei_t rpct_property_get_type | ( | rpct_if_member_t | prop | ) |
Returns type instance of the property.
| prop | Property handle |
| int rpct_read_file | ( | const char * | path | ) |
Reads IDL file without parsing it. rpct_load_types must be called on the same path again to load the associated types.
| path | Path to the IDL file |
| int rpct_read_idl | ( | const char * | name, |
| rpc_object_t | idl | ||
| ) |
Reads IDL object without parsing it. rpct_load_types must be called on the same name again to load the associated types.
| name | Name of the IDL blob |
| idl | IDL blob contents |
| rpc_object_t rpct_serialize | ( | rpc_object_t | object | ) |
Serializes object hierarchy preserving type information.
| object | Object to serialize |
| rpc_object_t rpct_set_typei | ( | rpct_typei_t | typei, |
| rpc_object_t | object | ||
| ) |
Binds specified type to an existing object.
| typei | Type instance handle |
| object | Object to be typed |
| void rpct_set_value | ( | rpc_object_t | object, |
| const char * | value | ||
| ) |
| object | |
| value |
| rpct_class_t rpct_type_get_class | ( | rpct_type_t | type | ) |
Returns the type class.
| type | Type handle |
| rpct_typei_t rpct_type_get_definition | ( | rpct_type_t | type | ) |
Returns the type definition (underlying type).
This function returns the underlying type definition of a typedef. Returns NULL for other type classes.
| type | Type handle |
| const char* rpct_type_get_description | ( | rpct_type_t | type | ) |
Returns the type description, as read from interface definition file.
| type | Type handle |
| const char* rpct_type_get_generic_var | ( | rpct_type_t | type, |
| int | index | ||
| ) |
Returns name of n-th generic variable.
Returns NULL if index is out of the bounds.
| type | Type handle |
| index | Generic variable index |
| int rpct_type_get_generic_vars_count | ( | rpct_type_t | type | ) |
Returns a number of generic variables a type defines.
| type | Type handle |
| rpct_member_t rpct_type_get_member | ( | rpct_type_t | type, |
| const char * | name | ||
| ) |
Looks up type member by name.
| type | Type handle |
| name | Member name |
| const char* rpct_type_get_module | ( | rpct_type_t | type | ) |
Returns the module name type belongs to.
| type | Type handle |
| const char* rpct_type_get_name | ( | rpct_type_t | type | ) |
Returns the type name.
| type | Type handle |
| const char* rpct_type_get_origin | ( | rpct_type_t | iface | ) |
Returns the place where type was defined.
Returned string is in form file.yaml:line_number
| iface | Interface handle |
| rpct_type_t rpct_type_get_parent | ( | rpct_type_t | type | ) |
Returns the type "parent" in the inheritance chain.
| type | Type handle |
| const char* rpct_typei_get_canonical_form | ( | rpct_typei_t | typei | ) |
Returns the type declaration string ("canonical form").
| typei | Type instance handle |
| rpct_typei_t rpct_typei_get_generic_var | ( | rpct_typei_t | typei, |
| const char * | name | ||
| ) |
Returns the type instance passed as a generic variable to the typei.
| typei | Type instance handle |
| name | Generic variable name |
NULL | rpct_typei_t rpct_typei_get_member_type | ( | rpct_typei_t | typei, |
| rpct_member_t | member | ||
| ) |
Returns type instance handler of a structure or union member.
| typei | Type instance handle |
| member | Member handle |
| bool rpct_typei_get_proxy | ( | rpct_typei_t | typei | ) |
| typei |
| const char* rpct_typei_get_proxy_variable | ( | rpct_typei_t | typei | ) |
| typei |
| rpct_type_t rpct_typei_get_type | ( | rpct_typei_t | typei | ) |
Returns base type of a type instance typei.
| typei | Type instance handle |
| bool rpct_typei_is_compatible | ( | rpct_typei_t | decl, |
| rpct_typei_t | type | ||
| ) |
Returns true if decl and type are compatible types.
| decl | First type |
| type | Second type |
true if compatible, otherwise false | void rpct_typei_release | ( | rpct_typei_t | typei | ) |
Decrements reference count of a type instance handle.
If the reference count reaches 0, type instance handle is freed.
| typei | Type instance handle |
| rpct_typei_t rpct_typei_retain | ( | rpct_typei_t | typei | ) |
Increments reference count of a type instance handle.
| typei | Type instance handle |
| bool rpct_types_apply | ( | rpct_type_applier_t | applier | ) |
Iterates over the defined types.
| applier |
true if iteration was terminated, otherwise false | bool rpct_validate | ( | rpct_typei_t | typei, |
| rpc_object_t | obj, | ||
| rpc_object_t * | errors | ||
| ) |
Validates object against given type instance.
| typei | |
| obj | |
| errors |
| bool rpct_validate_args | ( | struct rpct_if_member * | func, |
| rpc_object_t | args, | ||
| rpc_object_t * | errors | ||
| ) |
Validates set of arguments for a given function.
| func | |
| args | |
| errors |
| bool rpct_validate_return | ( | struct rpct_if_member * | func, |
| rpc_object_t | result, | ||
| rpc_object_t * | errors | ||
| ) |
Validates a return value from a given function.
| func | |
| result | |
| errors |
1.8.13