static void test_req_call_test(void) { TALLOC_CTX *mem_ctx; uint8_t *pkt; size_t pkt_len; int ret; struct ctdb_req_header h, h2; struct ctdb_req_call c, c2; printf("ctdb_req_call\n"); fflush(stdout); mem_ctx = talloc_new(NULL); assert(mem_ctx != NULL); ctdb_req_header_fill(&h, GENERATION, CTDB_REQ_CALL, DESTNODE, SRCNODE, REQID); fill_ctdb_req_call(mem_ctx, &c); ret = ctdb_req_call_push(&h, &c, mem_ctx, &pkt, &pkt_len); assert(ret == 0); ret = ctdb_req_call_pull(pkt, pkt_len, &h2, mem_ctx, &c2); assert(ret == 0); verify_ctdb_req_header(&h, &h2); verify_ctdb_req_call(&c, &c2); talloc_free(mem_ctx); }
static void ctdb_req_call_parse(uint8_t *buf, size_t buflen, FILE *fp, TALLOC_CTX *mem_ctx) { struct ctdb_req_call c; int ret; ret = ctdb_req_call_pull(buf, buflen, NULL, mem_ctx, &c); if (ret != 0) { fprintf(fp, "Failed to parse CTDB_REQ_CALL\n"); return; } ctdb_req_call_print(&c, fp); }