Difference between revisions of "Samba4/LDB/Message"

m (Samba4/LDB/Message/API moved to Samba4/LDB/Message)
(Structures)
Line 34: Line 34:
  
 
An ldb_message represents all or part of a record. It can contain an arbitrary number of elements.
 
An ldb_message represents all or part of a record. It can contain an arbitrary number of elements.
 +
 +
= Methods =
 +
 +
== ldb_msg_new() ==
 +
 +
Create an empty message
 +
 +
Parameters:
 +
<li>mem_ctx - the memory context to create in. You can pass NULL to get the top level context, however the ldb context (from ldb_init()) may be a better choice
 +
 +
<pre>
 +
struct ldb_message *ldb_msg_new(TALLOC_CTX *mem_ctx);
 +
</pre>
 +
 +
== ldb_msg_find_element() ==
 +
 +
Find an element within an message
 +
 +
<pre>
 +
struct ldb_message_element *ldb_msg_find_element(const struct ldb_message *msg,
 +
const char *attr_name);
 +
</pre>
 +
 +
== ldb_val_equal_exact() ==
 +
 +
Compare two ldb_val values
 +
 +
Parameters:
 +
<li>v1 first ldb_val structure to be tested
 +
<li>v2 second ldb_val structure to be tested
 +
 +
Returns: 1 for a match, 0 if there is any difference
 +
 +
<pre>
 +
int ldb_val_equal_exact(const struct ldb_val *v1, const struct ldb_val *v2);
 +
</pre>

Revision as of 22:15, 11 November 2009

Structures

ldb_val

struct ldb_val {
    uint8_t *data; /*!< result data */
    size_t length; /*!< length of data */
};

ldb_message_element

struct ldb_message_element {
    unsigned int flags;
    const char *name;
    unsigned int num_values;
    struct ldb_val *values;
};

Results are given back as arrays of ldb_message_element.

ldb_message

struct ldb_message {
    struct ldb_dn *dn;
    unsigned int num_elements;
    struct ldb_message_element *elements;
};

An ldb_message represents all or part of a record. It can contain an arbitrary number of elements.

Methods

ldb_msg_new()

Create an empty message

Parameters:

  • mem_ctx - the memory context to create in. You can pass NULL to get the top level context, however the ldb context (from ldb_init()) may be a better choice
    struct ldb_message *ldb_msg_new(TALLOC_CTX *mem_ctx);
    

    ldb_msg_find_element()

    Find an element within an message

    struct ldb_message_element *ldb_msg_find_element(const struct ldb_message *msg, 
    						 const char *attr_name);
    

    ldb_val_equal_exact()

    Compare two ldb_val values

    Parameters:

  • v1 first ldb_val structure to be tested
  • v2 second ldb_val structure to be tested Returns: 1 for a match, 0 if there is any difference
    int ldb_val_equal_exact(const struct ldb_val *v1, const struct ldb_val *v2);