Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

Resource Profiles

Communicate with the RPS. More...

Enumerations

enum  macs_profile_type {
  MACS_TYPE_INT = 0, MACS_TYPE_FLOAT = 1, MACS_TYPE_CHAR = 2, MACS_TYPE_BLOB = 3,
  MACS_TYPE_LINK = 4, MACS_TYPE_RES = 5, MACS_TYPE_AUTO = 6
}

Functions

char ** macs_list_prof (macs_session *sess, char *meth, char *id, macs_profile_type type)
 Expose the keys in this resource's profile.

void * macs_get_prof (macs_session *sess, char *meth, char *rid, char *nsid, macs_profile_type *type, long int *siz)
 Fetch a profile element.

int macs_set_prof (macs_session *sess, const char *meth, char *rid, char *nsid, macs_profile_type type, const void *val, long int siz)
 Add or modify a profile element.


Detailed Description

Communicate with the RPS.

Todo:
Possibly include some utility functions? Like
 char *macs_prof_type2str(macs_profile_type) 
The functions in Resource Profiles deal with getting and setting profile information. Because access to profile information is generally protected, a MACS session pointer is used to authorize access to the requested profile item(s). In some situations, a session need not be logged-in to access some profile items.

There are two ways to refer to a resource: by path and by id. These are both strings, however they have different semantics, described elsewhere. See the rmc module for ways to convert between them.


Enumeration Type Documentation

enum macs_profile_type
 

Profile value types.

Enumeration values:
MACS_TYPE_INT  Integer
MACS_TYPE_FLOAT  Double-precision floating-point
MACS_TYPE_CHAR  String
MACS_TYPE_BLOB  Binary
MACS_TYPE_LINK  A link to another resource id (as string)
MACS_TYPE_RES  Another resource id (as string)
MACS_TYPE_AUTO  The unspecified "automatic" type -- used only to query


Function Documentation

char** macs_list_prof macs_session   sess,
char *    meth,
char *    id,
macs_profile_type    type
 

Expose the keys in this resource's profile.

Parameters:
sess A MACS session
meth The profile method. If NULL, uses a default.
id The id of the resource whose keys to query.
type The type of values whose keys to return. If MACS_TYPE_AUTO, returns keys of all values.
Returns:
A NULL-terminated array of strings. The strings and the array should be free'd. The strings are name-space ids to be be used as keys for fetching profile elements. Returns NULL on error (e.g., if the session is not logged in.)
The returned list may be empty if the given session has no READ access to the given resource.
Examples:
sample.c.

void* macs_get_prof macs_session   sess,
char *    meth,
char *    rid,
char *    nsid,
macs_profile_type   type,
long int *    siz
 

Fetch a profile element.

Parameters:
sess A MACS session
meth The profile method. If NULL, uses a default.
rid The id of the resource whose profile item we're fetching.
nsid The id of the name-space of the profile item we're fetching.
type A pointer to the type of profile value to fetch. If NULL, returns the value of the current type, which is the last type to be used at this name-space for this resource. On successful return, contains the type actually returned, one of MACS_TYPE_INT, MACS_TYPE_FLOAT, MACS_TYPE_CHAR, MACS_TYPE_BLOB, MACS_TYPE_LINK or MACS_TYPE_RES
siz On successful return, contains the length of the profile value, or -1 if the type returned is MACS_TYPE_INT or MACS_TYPE_FLOAT
Returns:
NULL on failure, or a pointer to the element's value. Should be free()'d. Returns NULL on error (e.g., if the session is not logged in.)
The return value should be cast to the appropriate type as follows:
  • MACS_TYPE_INT -> (int *)
  • MACS_TYPE_FLOAT -> (double *)
  • MACS_TYPE_CHAR, MACS_TYPE_LINK and MACS_TYPE_RES -> (char *)
  • MACS_TYPE_BLOB -> (void *)
Examples:
sample.c.

int macs_set_prof macs_session   sess,
const char *    meth,
char *    rid,
char *    nsid,
macs_profile_type    type,
const void *    val,
long int    siz
 

Add or modify a profile element.

Parameters:
sess A MACS session
meth The profile method. If NULL uses a default.
rid See macs_get_prof()
nsid See macs_get_prof()
type See macs_get_prof()
val The value to put.
siz The size of the value in bytes.
Returns:
1 on success, 0 on failure (e.g., if the session is not logged in.)


Generated on Fri Aug 8 09:53:44 2003 for MACS Client C API by doxygen1.3-rc3