RSA BSAFE Micro Edition Suite

Streamlined security for mobile and embedded devices

Search  Print

r_res.h File Reference

This file provides defines, structures and function prototypes used in the manipulation of resource lists found in library context objects.

#include "r_com.h"
#include "r_modid.h"

Go to the source code of this file.

Defines

#define R_RES_LIST_FLAG_STATIC
 Indicates that the resource list item has been statically declared.

#define R_RES_LIST_FLAG_COPY
 Indicates that the resource list item is a dynamically allocated copy.

#define R_RES_LIST_FLAG_READ_ONLY
 Indicates that the resource list item is read-only.

#define R_RES_END_OF_LIST
 The mandatory marker indicating the end of a resource list.

#define R_RES_END_OF_LIST_READ_ONLY
 The mandatory marker indicating the end of a resource list. More...


Typedefs

typedef struct r_res_item_st R_RES_ITEM
 The resource item. More...

typedef R_RES_ITEM R_RES_LIST
 The resource list. More...

typedef int R_RES_FLAG
 Indicates the type of the resource flag. More...


Functions

int R_CDECL R_RES_LIST_set_resource (R_RES_LIST *res_list, int mod_id, int impl_id, int sub_id, R_RES_FLAG flag, int res_type, void *data)
 Sets resource data into a resource item in the resource list. More...

int R_CDECL R_RES_LIST_get_resource (R_RES_LIST *res_list, int mod_id, int imp_id, int sub_id, R_RES_FLAG flag, int res_type, void **data)
 Retrieves resource data from a resource item in the resource list. More...

int R_CDECL R_RES_LIST_get_item (R_RES_LIST *res_list, int mod_id, int imp_id, int sub_id, R_RES_FLAG flag, R_RES_ITEM **data, R_RES_LIST **next)
 Retrieves an item from the resource list. More...

int R_CDECL R_RES_LIST_set_item (R_RES_LIST **res_list, int action, R_RES_ITEM *item)
 Adds a resource item into or removes a resource item from the resource list. More...

int R_CDECL R_RES_LIST_get_num_entries (R_RES_LIST *res_list, int *count)
 Calculates the number of entries/items in the resource list. More...

int R_CDECL R_RES_LIST_check_writable (R_RES_LIST *res_list)
 Checks that the resource list is able to be written to. More...

int R_CDECL R_RES_LIST_set_writable (R_RES_LIST *res_list, int flag)
 Makes the resource list writable and sets flags. More...

int R_CDECL R_RES_LIST_lib_finish (R_RES_LIST *res_list, R_RES_ITEM *item, void **imp_data)
 Disposes of the resource list if the list is a copy. More...

int R_CDECL R_RES_LIST_free (R_RES_LIST *res_list)
 Disposes of the resource list if it is a copy. More...

int R_CDECL R_RES_LIST_join (R_RES_LIST **new_list, R_RES_LIST *append_list)
 Appends one resource list onto the end of another. More...

int R_CDECL R_RES_LIST_dup (R_RES_LIST **new_list, R_RES_LIST *res_list)
 Duplicates the items of one resource list on to the end of another. More...


Function Documentation

int R_CDECL R_RES_LIST_check_writable R_RES_LIST   res_list ;
 

Checks that the resource list is able to be written to.

Parameters:
res_list [In] The resource list.
Returns:
R_ERROR_NONE indicates that the list is writable.
R_ERROR_INVALID_STATE indicates the list is not writable.
note.gif
When the resource item R_RES_END_OF_LIST is used the list is writable. When R_RES_END_OF_LIST_READ_ONLY is used the list is not writable.
See also:
R_RES_LIST_set_writable().

int R_CDECL R_RES_LIST_dup R_RES_LIST **    new_list,
R_RES_LIST   res_list
;
 

Duplicates the items of one resource list on to the end of another.

Parameters:
new_list [In, Out] A resource list.
res_list [In] The resource list to duplicate.
Returns:
R_ERROR_NONE indicates success.
See Identifiers for valid values.
note.gif
The resource list may have to be reallocated.

int R_CDECL R_RES_LIST_free R_RES_LIST   res_list ;
 

Disposes of the resource list if it is a copy.

Parameters:
res_list [In] The resource list.
Returns:
R_ERROR_NONE indicates success.

int R_CDECL R_RES_LIST_get_item R_RES_LIST   res_list,
int    mod_id,
int    imp_id,
int    sub_id,
R_RES_FLAG    flag,
R_RES_ITEM **    data,
R_RES_LIST **    next
;
 

Retrieves an item from the resource list. The search begins at the first element in the resource list. The first item found that matches the criteria specified is returned in data. If an item is found then the next item in the resource list is returned in next. Otherwise the next item is NULL.

Parameters:
res_list [In] The resource list.
mod_id [In] The resource module identifier.
imp_id [In] The resource implementation identifier.
sub_id [In] The resource sub-identifier.
flag [In] The resource flag.
data [In] A resource list item.
next [In] A pointer to a resource list item.
Returns:
R_ERROR_NONE indicates success.
See Identifiers for valid values.
note.gif
The resource item must have the module identifier, implementation identifier and flag that exactly match those passed in. It must also have the sub-identifer bits set as specified in the sub-id (that is, more bits may be set in the resource item's sub-identifer but not fewer.)
The identifiers R_RES_MOD_ID_ANY, R_RES_IMPL_ID_ANY and R_RES_FLAG_ANY match any identifier for that field.
See also:
R_RES_LIST_set_item().

int R_CDECL R_RES_LIST_get_num_entries R_RES_LIST   res_list,
int *    count
;
 

Calculates the number of entries/items in the resource list.

Parameters:
res_list [In] The resource list.
count [Out] The count of resource items.
Returns:
R_ERROR_NONE indicates success.

int R_CDECL R_RES_LIST_get_resource R_RES_LIST   res_list,
int    mod_id,
int    imp_id,
int    sub_id,
R_RES_FLAG    flag,
int    res_type,
void **    data
;
 

Retrieves resource data from a resource item in the resource list. The resource item from which the data is retrieved is the first in the resource list that matches the module identifier, implementation identifier, sub-identifier and flags.

Parameters:
res_list [In] The resource list.
mod_id [In] The resource module identifier.
imp_id [In] The resource implementation identifier.
sub_id [In] The resource sub-identifier.
flag [In] The resource flag.
res_type [In] The type of resource data. One of:
  • R_RES_TYPE_DATA
  • R_RES_TYPE_FINISH
  • R_RES_TYPE_METHS
  • R_RES_TYPE_START.
  • data [Out] The data retrieved.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    note.gif
    The resource item must have the module identifier, implementation identifier and flag that exactly match those passed in. It must also have sub-identifer bits set as specified in the sub-id (that is, more bits may be set in the resource item's sub-identifer but not fewer.)
    See also:
    R_RES_LIST_set_resource() and R_RES_LIST_get_item().

    int R_CDECL R_RES_LIST_join R_RES_LIST **    list,
    R_RES_LIST   append_list
    ;
     

    Appends one resource list onto the end of another.

    Parameters:
    list [In, Out] A resource list.
    append_list [In] The resource list to attach to the end of list.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    note.gif
    The resource list may have to be reallocated.

    int R_CDECL R_RES_LIST_lib_finish R_RES_LIST   res_list,
    R_RES_ITEM   item,
    void **    imp_data
    ;
     

    Disposes of the resource list if the list is a copy.

    Parameters:
    res_list [In] The resource list.
    item [In] A resource list item.
    imp_data [In] The implementation data of the item.
    Returns:
    R_ERROR_NONE indicates success.
    note.gif
    This function is used in a resource list as the finish function of the last resource list entry to ensure the list is freed.

    int R_CDECL R_RES_LIST_set_item R_RES_LIST **    res_list,
    int    action,
    R_RES_ITEM   item
    ;
     

    Adds a resource item into or removes a resource item from the resource list. When adding an item it may be put on the front or the back of the list, or it may replace an existing item.

    Parameters:
    res_list [In, Out] The resource list.
    action [In] The action to use to when manipulating the list. One of:
  • R_RES_LIST_ACTION_APPEND
  • R_RES_LIST_ACTION_REMOVE
  • R_RES_LIST_ACTION_REPLACE
  • R_RES_LIST_ACTION_PREPEND.
  • item [In] A resource item.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    note.gif
    A new list will be created unless the action is to remove or replace The new resource list is a copy of an original.
    The resource list must be writable in order to be able use this function with it. The standard end of list item indicates that the list is writable: R_RES_END_OF_LIST.
    See also:
    R_RES_LIST_get_item() and R_RES_LIST_check_writable().

    int R_CDECL R_RES_LIST_set_resource R_RES_LIST   res_list,
    int    mod_id,
    int    impl_id,
    int    sub_id,
    R_RES_FLAG    flag,
    int    res_type,
    void *    data
    ;
     

    Sets resource data into a resource item in the resource list. The resource item modified is the first in the resource list that matches the module identifier, implementation identifier, sub-identifier and flags.

    Parameters:
    res_list [In] The resource list.
    mod_id [In] The resource module identifier.
    impl_id [In] The resource implementation identifier.
    sub_id [In] The resource sub-identifier.
    flag [In] The resource flag.
    res_type [In] The type of resource data. One of:
  • R_RES_TYPE_DATA
  • R_RES_TYPE_FINISH
  • R_RES_TYPE_METHS
  • R_RES_TYPE_START.
  • data [In] The data to put into the resource item.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    note.gif
    The resource item must have the module identifier, implementation identifier and flag that exactly match those passed in. It must also have sub-identifier bits set as specified in the sub-id (that is, more bits may be set in the resource item's sub-identifer but not fewer.)
    The resource list must be writable in order to be able use this function with it. The standard end of list item indicates that the list is writable: R_RES_END_OF_LIST.
    See also:
    R_RES_LIST_get_resource(), R_RES_LIST_get_item() and R_RES_LIST_check_writable().

    int R_CDECL R_RES_LIST_set_writable R_RES_LIST   res_list,
    int    flag
    ;
     

    Makes the resource list writable and sets flags.

    Parameters:
    res_list [In] The resource list.
    flag [In] The resource flags.
    Returns:
    R_ERROR_NONE indicates success.
    note.gif
    The last resource item in the list is modified. This item is the end-of-list entry.
    See also:
    R_RES_LIST_check_writable().


    Copyright (c) 1999-2005 RSA Security Inc. All rights reserved. 072-001001-2100-001-000 - 2.1