Remote Administration Daemon Developer Guide

Exit Print View

Updated: July 2014
 
 

Entry Points

All entry points take a pointer to the object instance and a pointer to the internal structure for the method or attribute. The object instance pointer is essential for distinguishing different objects that implement the same interface. The internal structure pointer is theoretically useful for sharing the same implementation across multiple methods or attributes, but isn't used and may be removed.

Additionally, all entry reports return a conerr_t. If the access is successful, they should return CE_OK. If the access fails due to a system error, they should return CE_SYSTEM. If the access fails due to an expected error which should be noted in the API definition, they should return CE_OBJECT. If an expected error occurs and an error payload is defined, it may be set in *error. The caller will unref the error object when it is done with it.

  • A method entry point has the type meth_invoke_f:

    typedef conerr_t (meth_invoke_f)(rad_instance_t *inst, adr_method_t *meth,
        adr_data_t **result, adr_data_t **args, int count, adr_data_t **error);

    args is an array of count arguments.

    Upon successful return, *result should contain the return value of the method, if any.

    The entry point for a method named METHOD in interface INTERFACE is named interface_INTERFACE_invoke_METHOD.

  • An attribute read entry point has the type attr_read_f:

    typedef conerr_t (attr_read_f)(rad_instance_t *inst, adr_attribute_t *attr, 
    adr_data_t **value, adr_data_t **error);

    Upon successful return, *value should contain the value of the attribute, if any.

    The read entry point for an attribute named ATTR in interface INTERFACE is named interface_INTERFACE_read_ATTR.

  • An attribute write entry point has the type attr_write_f:

    typedef conerr_t (attr_write_f)(rad_instance_t *inst, adr_attribute_t *attr,
        adr_data_t *newvalue, adr_data_t **error);

    newvalue points to the new value. If the attribute is nullable, newvalue can be NULL.

    The write entry point for an attribute named ATTR in interface INTERFACE is named interface_INTERFACE_write_ATTR.

rad explicitly checks the types of all arguments passed to methods and all values written to attributes. Stub implementations can assume that all data provided is of the correct type. Stub implementations are responsible for returning valid data. Returning invalid data results in an undefined behavior.