ct_ds_objinfo

Description

Retrieve information associated with a directory object.

Syntax

CS_RETCODE ct_ds_objinfo(ds_object, action, infotype, number, buffer,
                                                buflen, outlen)
 
CS_DS_OBJECT          *ds_object;
CS_INT                          action;
CS_INT                          infotype;
CS_INT                          number;
CS_VOID                       *buffer;
CS_INT                          buflen;
CS_INT                         *outlen;

Parameters

ds_object

A pointer to a CS_DS_OBJECT structure. An application receives a directory object pointer as an input parameter to its directory callback.

action

Must be CS_GET.

infotype

The type of information to retrieve into *buffer. For a description of the available types, see Table 3-22.

number

When infotype is CS_DS_ATTRIBUTE or CS_DS_ATTRVALS, number specifies the number of the attribute to retrieve. Attribute numbers start at 1.

For other values of infotype, pass number as CS_UNUSED.

buffer

The address of the buffer that holds the requested information. Table 3-22 lists the *buffer datatypes for values of infotype.

buflen

The length of *buffer, in bytes.

outlen

If this argument is supplied, *outlen is set to the length of the value returned in *buffer. This argument is optional and can be passed as NULL.

Returns

ct_ds_objinfo returns the following values:

Return value:

Meaning

CS_SUCCEED

The routine completed successfully

CS_FAIL

The routine failed

Examples

Example 1

For an explanation of the steps in this example, see Chapter 9, “Using Directory Services,” in the Open Client Client-Library/C Programmer's Guide.

Usage

The following table summarizes ct_ds_objinfo call syntax when action is CS_GET:

Table 3-22: Summary of ct_ds_objinfo parameters

infotype value

number value

*buffer datatype

Value written to *buffer

CS_DS_CLASSOID

CS_UNUSED

CS_OID structure

The OID of the directory object class.

CS_DS_DIST_NAME

CS_UNUSED

CS_CHAR array

Fully qualified (distinguished) directory name of the object, to 512 bytes.

The output name is null-terminated.

If outlen is not NULL, Client-Library puts the number of bytes written to *buffer (not including the null-terminator) in *outlen.

CS_DS_NUMATTR

CS_UNUSED

CS_INT variable

Number of attributes associated with the object.

CS_DS_ATTRIBUTE

A positive integer

CS_ATTRIBUTE structure.

A CS_ATTRIBUTE structure that contains metadata for the attribute specified by the value of number.

See “Retrieving object attributes and attribute values” for a description of the CS_ATTRVALUE and CS_ATTRIBUTE data structures.

CS_DS_ATTRVALS

A positive integer

An array of CS_ATTRVALUE unions. The array must be long enough for the number of values indicated by the CS_ATTRIBUTE structure.

The values of the attribute specified by the value of number.

See “Retrieving object attributes and attribute values” for a description of the CS_ATTRVALUE and CS_ATTRIBUTE data structures.


Structure of directory objects


Retrieving the object class


Retrieving the fully qualified entry name


Retrieving object attributes and attribute values

CS_ATTRIBUTE structure

The CS_ATTRIBUTE structure is used with ct_ds_objinfo to describe the attributes of a directory object.

typedef struct
 {
     CS_OID  attr_type;
     CS_INT  attr_syntax;
     CS_INT  attr_numvals;
 } CS_ATTRIBUTE;

where:

CS_ATTRVALUE union

Attribute values are returned to the application in a CS_ATTRVALUE union. This union contains a members for each possible data type needed to represent attribute values. The declaration looks like this:

typedef union _cs_attrvalue
 {
         CS_STRING       value_string;
         CS_BOOL         value_boolean;
         CS_INT          value_enumeration;
         CS_INT          value_integer;
         CS_TRANADDR     value_tranaddr;
         CS_OID          value_oid;
 } CS_ATTRVALUE;

Attribute values are retrieved by ct_ds_objinfo into an array of CS_ATTRVALUE unions. The array size should match the attr_numvals field of the CS_ATTRIBUTE structure. The value should be taken as the union member designated by the attr_syntax field of the CS_ATTRIBUTE structure. Table 3-23 shows the correspondence between attribute syntax specifiers and the members of CS_ATTRVALUE.

Table 3-23: Syntax specifiers for the CS_ATTRVALUE union

Attribute syntax specifier

Union member

CS_ATTR_SYNTAX_STRING

value_string

String values are represented by a CS_STRING structure, which is described under String values below.

CS_ATTR_SYNTAX_BOOLEAN

value_boolean

Boolean values are represented as CS_BOOL.

CS_ATTR_SYNTAX_ENUMERATION

value_enumeration

Enumerated values are represented as CS_INT.

CS_ATTR_SYNTAX_INTEGER

value_integer

Integer values are represented as CS_INT.

CS_ATTR_SYNTAX_TRANADDR

value_tranaddr

Transport addresses are represented as a CS_TRANADDR structure, which is described under Transport address values below.

CS_ATTR_SYNTAX_OID

value_oid

OID values are represented as CS_OID structure, which is explained on page §.

String values

The CS_STRING structure is defined as follows:

typedef struct _cs_string
 {
         CS_INT  str_length;
         CS_CHAR str_buffer[CS_MAX_DS_STRING];
 } CS_STRING;

The contents of str_buffer are null-terminated. str_length does not count the null-terminator in the length.

Transport address values

Transport addresses are encoded in a Sybase-specific format within the CS_TRANADDR structure shown below.

typedef struct _cs_tranaddr
 {
         CS_INT      addr_accesstype;
         CS_STRING   addr_trantype;
         CS_STRING   addr_tranaddress;
 } CS_TRANADDR;

See also

ct_ds_lookup, ct_ds_dropobj, “Directory services”, “Server directory object”