/* construct tree from adjcency matrix */ TREENODE* construct_tree(int node_num, int root_index, int **graph) { int i; TREENODE *root, *nodes; /* allocate memory */ nodes = (TREENODE*)malloc(sizeof(TREENODE)*node_num); if(nodes == NULL) { printf("Out of memory"); return NULL; } /* initialization */ for(i = 0; i < node_num; i++) { nodes[i].index = i; nodes[i].dims[0] = 0; nodes[i].dims[1] = 0; nodes[i].potential = NULL; nodes[i].message_num = 0; nodes[i].messages = NULL; nodes[i].locations = NULL; nodes[i].child_num = 0; nodes[i].children = NULL; nodes[i].parent_num = 0; nodes[i].parent = NULL; } /* set root */ root = nodes + root_index; /* construct tree */ construct(root, NULL, nodes, node_num, graph); initialize_message(nodes, node_num); return nodes; }
void send_auth_failed(struct privd_instance *privd) { initialize_message(privd, PRIVD_RESPONSE_AUTH_FAILED); send_message(privd); }
void send_ok(struct privd_instance *privd) { initialize_message(privd, PRIVD_RESPONSE_OK); send_message(privd); }