Difference between revisions of "Samba4/LDB/Message"
(→ldb_msg_element_compare_name()) |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | = | + | = Structures = |
− | + | == ldb_val == | |
− | + | ||
− | + | <pre> | |
− | + | struct ldb_val { | |
− | + | uint8_t *data; /*!< result data */ | |
− | + | size_t length; /*!< length of data */ | |
+ | }; | ||
+ | </pre> | ||
+ | |||
+ | == ldb_message_element == | ||
+ | |||
+ | <pre> | ||
+ | struct ldb_message_element { | ||
+ | unsigned int flags; | ||
+ | const char *name; | ||
+ | unsigned int num_values; | ||
+ | struct ldb_val *values; | ||
+ | }; | ||
+ | </pre> | ||
Results are given back as arrays of ldb_message_element. | Results are given back as arrays of ldb_message_element. | ||
− | = ldb_message = | + | == ldb_message == |
− | + | <pre> | |
− | + | struct ldb_message { | |
− | + | struct ldb_dn *dn; | |
− | + | unsigned int num_elements; | |
− | + | struct ldb_message_element *elements; | |
+ | }; | ||
+ | </pre> | ||
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() == | ||
+ | |||
+ | <pre> | ||
+ | struct ldb_message *ldb_msg_new(TALLOC_CTX *mem_ctx); | ||
+ | </pre> | ||
+ | |||
+ | 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() == | ||
+ | |||
+ | <pre> | ||
+ | struct ldb_message_element *ldb_msg_find_element(const struct ldb_message *msg, | ||
+ | const char *attr_name); | ||
+ | </pre> | ||
+ | |||
+ | Find an element within an message | ||
+ | |||
+ | == 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 | ||
+ | |||
+ | 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() == | ||
+ | |||
+ | <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> | ||
+ | |||
+ | Add a new empty element to a ldb_message. | ||
+ | |||
+ | == ldb_msg_add() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_add(struct ldb_message *msg, | ||
+ | const struct ldb_message_element *el, | ||
+ | int flags); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_add_value() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_add_value(struct ldb_message *msg, | ||
+ | const char *attr_name, | ||
+ | const struct ldb_val *val, | ||
+ | struct ldb_message_element **return_el); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_add_steal_value() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_add_steal_value(struct ldb_message *msg, | ||
+ | const char *attr_name, | ||
+ | struct ldb_val *val); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_add_steal_string() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_add_steal_string(struct ldb_message *msg, | ||
+ | const char *attr_name, char *str); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_add_string() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_add_string(struct ldb_message *msg, | ||
+ | const char *attr_name, const char *str); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_add_fmt() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_add_fmt(struct ldb_message *msg, | ||
+ | const char *attr_name, const char *fmt, ...) PRINTF_ATTRIBUTE(3,4); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_element_compare() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_element_compare(struct ldb_message_element *el1, | ||
+ | struct ldb_message_element *el2); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_element_compare_name() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_element_compare_name(struct ldb_message_element *el1, | ||
+ | struct ldb_message_element *el2); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_find_ldb_val() == | ||
+ | |||
+ | <pre> | ||
+ | const struct ldb_val *ldb_msg_find_ldb_val(const struct ldb_message *msg, const char *attr_name); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_find_attr_as_int() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_find_attr_as_int(const struct ldb_message *msg, | ||
+ | const char *attr_name, | ||
+ | int default_value); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_find_attr_as_uint() == | ||
+ | |||
+ | <pre> | ||
+ | unsigned int ldb_msg_find_attr_as_uint(const struct ldb_message *msg, | ||
+ | const char *attr_name, | ||
+ | unsigned int default_value); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_find_attr_as_int64() == | ||
+ | |||
+ | <pre> | ||
+ | int64_t ldb_msg_find_attr_as_int64(const struct ldb_message *msg, | ||
+ | const char *attr_name, | ||
+ | int64_t default_value); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_find_attr_as_uint64() == | ||
+ | |||
+ | <pre> | ||
+ | uint64_t ldb_msg_find_attr_as_uint64(const struct ldb_message *msg, | ||
+ | const char *attr_name, | ||
+ | uint64_t default_value); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_find_attr_as_double() == | ||
+ | |||
+ | <pre> | ||
+ | double ldb_msg_find_attr_as_double(const struct ldb_message *msg, | ||
+ | const char *attr_name, | ||
+ | double default_value); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_find_attr_as_bool() == | ||
+ | |||
+ | <pre> | ||
+ | int ldb_msg_find_attr_as_bool(const struct ldb_message *msg, | ||
+ | const char *attr_name, | ||
+ | int default_value); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_find_attr_as_string() == | ||
+ | |||
+ | <pre> | ||
+ | const char *ldb_msg_find_attr_as_string(const struct ldb_message *msg, | ||
+ | const char *attr_name, | ||
+ | const char *default_value); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_find_attr_as_dn() == | ||
+ | |||
+ | <pre> | ||
+ | struct ldb_dn *ldb_msg_find_attr_as_dn(struct ldb_context *ldb, | ||
+ | TALLOC_CTX *mem_ctx, | ||
+ | const struct ldb_message *msg, | ||
+ | const char *attr_name); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_sort_elements() == | ||
+ | |||
+ | <pre> | ||
+ | void ldb_msg_sort_elements(struct ldb_message *msg); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_copy_shallow() == | ||
+ | |||
+ | <pre> | ||
+ | struct ldb_message *ldb_msg_copy_shallow(TALLOC_CTX *mem_ctx, | ||
+ | const struct ldb_message *msg); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_copy() == | ||
+ | |||
+ | <pre> | ||
+ | struct ldb_message *ldb_msg_copy(TALLOC_CTX *mem_ctx, | ||
+ | const struct ldb_message *msg); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_canonicalize() == | ||
+ | |||
+ | <pre> | ||
+ | struct ldb_message *ldb_msg_canonicalize(struct ldb_context *ldb, | ||
+ | const struct ldb_message *msg); | ||
+ | </pre> | ||
+ | |||
+ | == ldb_msg_diff() == | ||
+ | |||
+ | <pre> | ||
+ | struct ldb_message *ldb_msg_diff(struct ldb_context *ldb, | ||
+ | struct ldb_message *msg1, | ||
+ | struct ldb_message *msg2); | ||
+ | </pre> |
Latest revision as of 22:25, 11 November 2009
Contents
- 1 Structures
- 2 Methods
- 2.1 ldb_msg_new()
- 2.2 ldb_msg_find_element()
- 2.3 ldb_val_equal_exact()
- 2.4 ldb_msg_find_val()
- 2.5 ldb_msg_add_empty()
- 2.6 ldb_msg_add()
- 2.7 ldb_msg_add_value()
- 2.8 ldb_msg_add_steal_value()
- 2.9 ldb_msg_add_steal_string()
- 2.10 ldb_msg_add_string()
- 2.11 ldb_msg_add_fmt()
- 2.12 ldb_msg_element_compare()
- 2.13 ldb_msg_element_compare_name()
- 2.14 ldb_msg_find_ldb_val()
- 2.15 ldb_msg_find_attr_as_int()
- 2.16 ldb_msg_find_attr_as_uint()
- 2.17 ldb_msg_find_attr_as_int64()
- 2.18 ldb_msg_find_attr_as_uint64()
- 2.19 ldb_msg_find_attr_as_double()
- 2.20 ldb_msg_find_attr_as_bool()
- 2.21 ldb_msg_find_attr_as_string()
- 2.22 ldb_msg_find_attr_as_dn()
- 2.23 ldb_msg_sort_elements()
- 2.24 ldb_msg_copy_shallow()
- 2.25 ldb_msg_copy()
- 2.26 ldb_msg_canonicalize()
- 2.27 ldb_msg_diff()
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.
ldb_msg_add()
int ldb_msg_add(struct ldb_message *msg, const struct ldb_message_element *el, int flags);
ldb_msg_add_value()
int ldb_msg_add_value(struct ldb_message *msg, const char *attr_name, const struct ldb_val *val, struct ldb_message_element **return_el);
ldb_msg_add_steal_value()
int ldb_msg_add_steal_value(struct ldb_message *msg, const char *attr_name, struct ldb_val *val);
ldb_msg_add_steal_string()
int ldb_msg_add_steal_string(struct ldb_message *msg, const char *attr_name, char *str);
ldb_msg_add_string()
int ldb_msg_add_string(struct ldb_message *msg, const char *attr_name, const char *str);
ldb_msg_add_fmt()
int ldb_msg_add_fmt(struct ldb_message *msg, const char *attr_name, const char *fmt, ...) PRINTF_ATTRIBUTE(3,4);
ldb_msg_element_compare()
int ldb_msg_element_compare(struct ldb_message_element *el1, struct ldb_message_element *el2);
ldb_msg_element_compare_name()
int ldb_msg_element_compare_name(struct ldb_message_element *el1, struct ldb_message_element *el2);
ldb_msg_find_ldb_val()
const struct ldb_val *ldb_msg_find_ldb_val(const struct ldb_message *msg, const char *attr_name);
ldb_msg_find_attr_as_int()
int ldb_msg_find_attr_as_int(const struct ldb_message *msg, const char *attr_name, int default_value);
ldb_msg_find_attr_as_uint()
unsigned int ldb_msg_find_attr_as_uint(const struct ldb_message *msg, const char *attr_name, unsigned int default_value);
ldb_msg_find_attr_as_int64()
int64_t ldb_msg_find_attr_as_int64(const struct ldb_message *msg, const char *attr_name, int64_t default_value);
ldb_msg_find_attr_as_uint64()
uint64_t ldb_msg_find_attr_as_uint64(const struct ldb_message *msg, const char *attr_name, uint64_t default_value);
ldb_msg_find_attr_as_double()
double ldb_msg_find_attr_as_double(const struct ldb_message *msg, const char *attr_name, double default_value);
ldb_msg_find_attr_as_bool()
int ldb_msg_find_attr_as_bool(const struct ldb_message *msg, const char *attr_name, int default_value);
ldb_msg_find_attr_as_string()
const char *ldb_msg_find_attr_as_string(const struct ldb_message *msg, const char *attr_name, const char *default_value);
ldb_msg_find_attr_as_dn()
struct ldb_dn *ldb_msg_find_attr_as_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const struct ldb_message *msg, const char *attr_name);
ldb_msg_sort_elements()
void ldb_msg_sort_elements(struct ldb_message *msg);
ldb_msg_copy_shallow()
struct ldb_message *ldb_msg_copy_shallow(TALLOC_CTX *mem_ctx, const struct ldb_message *msg);
ldb_msg_copy()
struct ldb_message *ldb_msg_copy(TALLOC_CTX *mem_ctx, const struct ldb_message *msg);
ldb_msg_canonicalize()
struct ldb_message *ldb_msg_canonicalize(struct ldb_context *ldb, const struct ldb_message *msg);
ldb_msg_diff()
struct ldb_message *ldb_msg_diff(struct ldb_context *ldb, struct ldb_message *msg1, struct ldb_message *msg2);