int ctdb_db_statistics_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
struct ctdb_db_statistics **out, size_t *npull);
+size_t ctdb_pid_srvid_len(struct ctdb_pid_srvid *in);
+void ctdb_pid_srvid_push(struct ctdb_pid_srvid *in, uint8_t *buf,
+ size_t *npush);
+int ctdb_pid_srvid_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
+ struct ctdb_pid_srvid **out, size_t *npull);
+
size_t ctdb_election_message_len(struct ctdb_election_message *in);
void ctdb_election_message_push(struct ctdb_election_message *in,
uint8_t *buf, size_t *npush);
return 0;
}
+size_t ctdb_pid_srvid_len(struct ctdb_pid_srvid *in)
+{
+ return ctdb_pid_len(&in->pid) +
+ ctdb_uint64_len(&in->srvid);
+}
+
+void ctdb_pid_srvid_push(struct ctdb_pid_srvid *in, uint8_t *buf,
+ size_t *npush)
+{
+ size_t offset = 0, np;
+
+ ctdb_pid_push(&in->pid, buf+offset, &np);
+ offset += np;
+
+ ctdb_uint64_push(&in->srvid, buf+offset, &np);
+ offset += np;
+
+ *npush = offset;
+}
+
+int ctdb_pid_srvid_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
+ struct ctdb_pid_srvid **out, size_t *npull)
+{
+ struct ctdb_pid_srvid *val;
+ size_t offset = 0, np;
+ int ret;
+
+ val = talloc(mem_ctx, struct ctdb_pid_srvid);
+ if (val == NULL) {
+ return ENOMEM;
+ }
+
+ ret = ctdb_pid_pull(buf+offset, buflen-offset, &val->pid, &np);
+ if (ret != 0) {
+ goto fail;
+ }
+ offset += np;
+
+ ret = ctdb_uint64_pull(buf+offset, buflen-offset, &val->srvid, &np);
+ if (ret != 0) {
+ goto fail;
+ }
+ offset += np;
+
+ *out = val;
+ *npull = offset;
+ return 0;
+
+fail:
+ talloc_free(val);
+ return ret;
+}
+
size_t ctdb_election_message_len(struct ctdb_election_message *in)
{
return ctdb_uint32_len(&in->num_connected) +
}
}
+void fill_ctdb_pid_srvid(TALLOC_CTX *mem_ctx, struct ctdb_pid_srvid *p)
+{
+ p->pid = rand32();
+ p->srvid = rand64();
+}
+
+void verify_ctdb_pid_srvid(struct ctdb_pid_srvid *p1,
+ struct ctdb_pid_srvid *p2)
+{
+ assert(p1->pid == p2->pid);
+ assert(p1->srvid == p2->srvid);
+}
+
void fill_ctdb_election_message(TALLOC_CTX *mem_ctx,
struct ctdb_election_message *p)
{
void verify_ctdb_db_statistics(struct ctdb_db_statistics *p1,
struct ctdb_db_statistics *p2);
+void fill_ctdb_pid_srvid(TALLOC_CTX *mem_ctx, struct ctdb_pid_srvid *p);
+void verify_ctdb_pid_srvid(struct ctdb_pid_srvid *p1,
+ struct ctdb_pid_srvid *p2);
+
void fill_ctdb_election_message(TALLOC_CTX *mem_ctx,
struct ctdb_election_message *p);
void verify_ctdb_election_message(struct ctdb_election_message *p1,
PROTOCOL_TYPE3_TEST(struct ctdb_statistics_list, ctdb_statistics_list);
PROTOCOL_TYPE3_TEST(struct ctdb_key_data, ctdb_key_data);
PROTOCOL_TYPE3_TEST(struct ctdb_db_statistics, ctdb_db_statistics);
+PROTOCOL_TYPE3_TEST(struct ctdb_pid_srvid, ctdb_pid_srvid);
PROTOCOL_TYPE3_TEST(struct ctdb_election_message, ctdb_election_message);
PROTOCOL_TYPE3_TEST(struct ctdb_srvid_message, ctdb_srvid_message);
PROTOCOL_TYPE3_TEST(struct ctdb_disable_message, ctdb_disable_message);
TEST_FUNC(ctdb_statistics_list)();
TEST_FUNC(ctdb_key_data)();
TEST_FUNC(ctdb_db_statistics)();
+ TEST_FUNC(ctdb_pid_srvid)();
TEST_FUNC(ctdb_election_message)();
TEST_FUNC(ctdb_srvid_message)();
TEST_FUNC(ctdb_disable_message)();