NASD Programmer's Documentation
Adding RPCs

To add a new RPC to the NASD drive, you must first define marshalled types for the arguments and results of the RPC. The type definitions themselves should be placed in include/nasd/nasd_drive_types.idl. Your new types should have types with names like nasd_p_new_operation_args_t and nasd_p_new_operation_res_t.

Each argument structure should have a nasd_security_param_t as its first field, and a nasd_capability_args_t as its second. The last field of the argument structure should be a nasd_digest_nonce_t.

Each result structure should have a nasd_status_t as the first field, to represent the results of the operation, and a nasd_digest_nonce_t as the last field. For example, let's look at the get attributes operation. The arguments and results are defined as


/* GETATTR - query attribute information about an object */
typedef struct nasd_p_getattr_dr_args_s {
  nasd_security_param_t   in_security_param;
  nasd_capability_args_t  in_capability_args;
  nasd_identifier_t       in_identifier;
  nasd_partnum_t          in_partnum;
  nasd_byte_t             pad[6];
  nasd_digest_nonce_t     in_digest;
} nasd_p_getattr_dr_args_t;
const long NASD_P_GETATTR_DR_ARGS_MAX = NASD_SECURITY_PARAM_SZ + NASD_CAPABILITY_ARGS_SZ + 8 + 2 + 6 + NASD_DIGEST_NONCE_SZ;
typedef nasd_byte_t nasd_p_getattr_dr_args_otw_t[NASD_P_GETATTR_DR_ARGS_MAX];

typedef struct nasd_p_getattr_dr_res_s {
  nasd_status_t       nasd_status;
  nasd_byte_t         pad[4];
  nasd_attribute_t    out_attribute;
  nasd_digest_nonce_t out_digest;
} nasd_p_getattr_dr_res_t;
const long NASD_P_GETATTR_DR_RES_MAX = 4 + 4 + NASD_ATTRIBUTE_SIZE + NASD_DIGEST_NONCE_SZ;
typedef nasd_byte_t nasd_p_getattr_dr_res_otw_t[NASD_P_GETATTR_DR_RES_MAX];
Next, add the RPC stub itself to include/nasd/nasd_pdrive.idl. For the get attribute operation, this looks like:

/* GETATTR - query attribute information about an object */
void nasd_p_getattr_otw_dr
(
  [in]   handle_t                       binding_handle,
  [in]   nasd_p_getattr_dr_args_otw_t   in_args,
  [out]  nasd_p_getattr_dr_res_otw_t    out_res,
  [out]  error_status_t                *op_status
);

An appropriate wrapper function for this RPC must be prototyped in include/nasd/nasd_pdrive_client.h and defined in client/nasd_pdrive_switch.c. It is beyond the scope of this document to detail the steps involved in doing so, as they involve understanding each transport mechanism supported by NASD. Readers are recommended to read and copy code that they find in relevant files.
<--- ---> ^<br>|<br>|
Adding marshalled types Adding control objects NASD Programmer's Documentation