Difference between revisions of "Samba4/LDB/Message"
(→Structures) |
(→Methods) |
||
Line 38: | Line 38: | ||
== ldb_msg_new() == | == ldb_msg_new() == | ||
+ | |||
+ | <pre> | ||
+ | struct ldb_message *ldb_msg_new(TALLOC_CTX *mem_ctx); | ||
+ | </pre> | ||
Create an empty message | Create an empty message | ||
Parameters: | 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 | |
− | |||
− | |||
− | |||
− | |||
== ldb_msg_find_element() == | == ldb_msg_find_element() == | ||
− | |||
− | |||
<pre> | <pre> | ||
Line 56: | Line 54: | ||
const char *attr_name); | const char *attr_name); | ||
</pre> | </pre> | ||
+ | |||
+ | Find an element within an message | ||
== ldb_val_equal_exact() == | == ldb_val_equal_exact() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_val_equal_exact(const struct ldb_val *v1, const struct ldb_val *v2); | ||
+ | </pre> | ||
Compare two ldb_val values | Compare two ldb_val values | ||
Parameters: | 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 | Returns: 1 for a match, 0 if there is any difference | ||
+ | |||
+ | == ldb_msg_find_val() == | ||
<pre> | <pre> | ||
− | + | struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el, | |
+ | struct ldb_val *val); | ||
+ | </pre> | ||
+ | |||
+ | Find a value within an ldb_message_element. | ||
+ | |||
+ | Parameters: | ||
+ | * el: the element to search | ||
+ | * val: the value to search for | ||
+ | |||
+ | Note: This search is case sensitive | ||
+ | |||
+ | == ldb_msg_add_empty() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_add_empty(struct ldb_message *msg, | ||
+ | const char *attr_name, | ||
+ | int flags, | ||
+ | struct ldb_message_element **return_el); | ||
</pre> | </pre> | ||
+ | |||
+ | Add a new empty element to a ldb_message. |
Revision as of 22:19, 11 November 2009
Contents
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()
struct ldb_message *ldb_msg_new(TALLOC_CTX *mem_ctx);
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
ldb_msg_find_element()
struct ldb_message_element *ldb_msg_find_element(const struct ldb_message *msg, const char *attr_name);
Find an element within an message
ldb_val_equal_exact()
int ldb_val_equal_exact(const struct ldb_val *v1, const struct ldb_val *v2);
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
ldb_msg_find_val()
struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el, struct ldb_val *val);
Find a value within an ldb_message_element.
Parameters:
- el: the element to search
- val: the value to search for
Note: This search is case sensitive
ldb_msg_add_empty()
int ldb_msg_add_empty(struct ldb_message *msg, const char *attr_name, int flags, struct ldb_message_element **return_el);
Add a new empty element to a ldb_message.