File: answer.h

package info (click to toggle)
simgrid 4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 38,980 kB
  • sloc: cpp: 123,583; ansic: 66,779; python: 8,358; java: 6,406; fortran: 6,079; f90: 5,123; xml: 4,587; sh: 2,337; perl: 1,436; makefile: 105; lisp: 49; javascript: 7; sed: 6
file content (31 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Copyright (c) 2012-2025. The SimGrid Team.  All rights reserved.         */

/* This program is free software; you can redistribute it and/or modify it
 * under the terms of the license (GNU LGPL) which comes with this package. */

#ifndef _KADEMLIA_EXAMPLES_ANSWER_H_
#define _KADEMLIA_EXAMPLES_ANSWER_H_
#include "routing_table.h"
#include <xbt/dynar.h>

/* Node query answer. contains the elements closest to the id given. */
typedef struct s_node_answer {
  unsigned int destination_id;
  xbt_dynar_t nodes; // Dynar of node_contact_t
  unsigned int size;
} s_answer_t;

typedef s_answer_t* answer_t;
typedef const s_answer_t* const_answer_t;

answer_t answer_init(unsigned int destination_id);
void answer_free(answer_t answer);
void answer_print(const_answer_t answer);
unsigned int answer_merge(answer_t destination, const_answer_t source);
void answer_sort(const_answer_t answer);
void answer_trim(answer_t answer);
void answer_add_bucket(const_bucket_t bucket, answer_t answer);
unsigned int answer_contains(const_answer_t answer, unsigned int id);
unsigned int answer_destination_found(const_answer_t answer);

#endif /* _KADEMLIA_EXAMPLES_ANSWER_H_ */