int ctdb_connection_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
struct ctdb_connection **out, size_t *npull);
+size_t ctdb_connection_list_len(struct ctdb_connection_list *in);
+void ctdb_connection_list_push(struct ctdb_connection_list *in, uint8_t *buf,
+ size_t *npush);
+int ctdb_connection_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
+ struct ctdb_connection_list **out, size_t *npull);
+
size_t ctdb_tunable_len(struct ctdb_tunable *in);
void ctdb_tunable_push(struct ctdb_tunable *in, uint8_t *buf, size_t *npush);
int ctdb_tunable_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
return ret;
}
+size_t ctdb_connection_list_len(struct ctdb_connection_list *in)
+{
+ size_t len;
+
+ len = ctdb_uint32_len(&in->num);
+ if (in->num > 0) {
+ len += in->num * ctdb_connection_len(&in->conn[0]);
+ }
+
+ return len;
+}
+
+void ctdb_connection_list_push(struct ctdb_connection_list *in, uint8_t *buf,
+ size_t *npush)
+{
+ size_t offset = 0, np;
+ uint32_t i;
+
+ ctdb_uint32_push(&in->num, buf+offset, &np);
+ offset += np;
+
+ for (i=0; i<in->num; i++) {
+ ctdb_connection_push(&in->conn[i], buf+offset, &np);
+ offset += np;
+ }
+
+ *npush = offset;
+}
+
+int ctdb_connection_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
+ struct ctdb_connection_list **out, size_t *npull)
+{
+ struct ctdb_connection_list *val;
+ size_t offset = 0, np;
+ uint32_t i;
+ int ret;
+
+ val = talloc(mem_ctx, struct ctdb_connection_list);
+ if (val == NULL) {
+ return ENOMEM;
+ }
+
+ ret = ctdb_uint32_pull(buf+offset, buflen-offset, &val->num, &np);
+ if (ret != 0) {
+ goto fail;
+ }
+ offset += np;
+
+ if (val->num == 0) {
+ val->conn = NULL;
+ goto done;
+ }
+
+ val->conn = talloc_array(val, struct ctdb_connection, val->num);
+ if (val->conn == NULL) {
+ ret = ENOMEM;
+ goto fail;
+ }
+
+ for (i=0; i<val->num; i++) {
+ ret = ctdb_connection_pull_elems(buf+offset, buflen-offset,
+ val, &val->conn[i], &np);
+ if (ret != 0) {
+ goto fail;
+ }
+ offset += np;
+ }
+
+done:
+ *out = val;
+ *npull = offset;
+ return 0;
+
+fail:
+ talloc_free(val);
+ return ret;
+}
+
size_t ctdb_tunable_len(struct ctdb_tunable *in)
{
return ctdb_uint32_len(&in->value) +
verify_ctdb_sock_addr(&p1->dst, &p2->dst);
}
+void fill_ctdb_connection_list(TALLOC_CTX *mem_ctx,
+ struct ctdb_connection_list *p)
+{
+ uint32_t i;
+
+ p->num = rand_int(1000);
+ if (p->num > 0) {
+ p->conn = talloc_array(mem_ctx, struct ctdb_connection, p->num);
+ assert(p->conn != NULL);
+ for (i=0; i<p->num; i++) {
+ fill_ctdb_connection(mem_ctx, &p->conn[i]);
+ }
+ } else {
+ p->conn = NULL;
+ }
+}
+
+void verify_ctdb_connection_list(struct ctdb_connection_list *p1,
+ struct ctdb_connection_list *p2)
+{
+ uint32_t i;
+
+ assert(p1->num == p2->num);
+ for (i=0; i<p1->num; i++) {
+ verify_ctdb_connection(&p1->conn[i], &p2->conn[i]);
+ }
+}
+
void fill_ctdb_tunable(TALLOC_CTX *mem_ctx, struct ctdb_tunable *p)
{
fill_ctdb_string(mem_ctx, &p->name);
void verify_ctdb_connection(struct ctdb_connection *p1,
struct ctdb_connection *p2);
+void fill_ctdb_connection_list(TALLOC_CTX *mem_ctx,
+ struct ctdb_connection_list *p);
+void verify_ctdb_connection_list(struct ctdb_connection_list *p1,
+ struct ctdb_connection_list *p2);
+
void fill_ctdb_tunable(TALLOC_CTX *mem_ctx, struct ctdb_tunable *p);
void verify_ctdb_tunable(struct ctdb_tunable *p1, struct ctdb_tunable *p2);
PROTOCOL_TYPE3_TEST(struct ctdb_traverse_all_ext, ctdb_traverse_all_ext);
PROTOCOL_TYPE3_TEST(ctdb_sock_addr, ctdb_sock_addr);
PROTOCOL_TYPE3_TEST(struct ctdb_connection, ctdb_connection);
+PROTOCOL_TYPE3_TEST(struct ctdb_connection_list, ctdb_connection_list);
PROTOCOL_TYPE3_TEST(struct ctdb_tunable, ctdb_tunable);
PROTOCOL_TYPE3_TEST(struct ctdb_node_flag_change, ctdb_node_flag_change);
PROTOCOL_TYPE3_TEST(struct ctdb_var_list, ctdb_var_list);
TEST_FUNC(ctdb_traverse_all_ext)();
TEST_FUNC(ctdb_sock_addr)();
TEST_FUNC(ctdb_connection)();
+ TEST_FUNC(ctdb_connection_list)();
TEST_FUNC(ctdb_tunable)();
TEST_FUNC(ctdb_node_flag_change)();
TEST_FUNC(ctdb_var_list)();