design CadetPeerPathEntry data structure
[oweals/gnunet.git] / src / cadet / gnunet-service-cadet-new_paths.c
1
2 /*
3      This file is part of GNUnet.
4      Copyright (C) 2001-2017 GNUnet e.V.
5
6      GNUnet is free software; you can redistribute it and/or modify
7      it under the terms of the GNU General Public License as published
8      by the Free Software Foundation; either version 3, or (at your
9      option) any later version.
10
11      GNUnet is distributed in the hope that it will be useful, but
12      WITHOUT ANY WARRANTY; without even the implied warranty of
13      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14      General Public License for more details.
15
16      You should have received a copy of the GNU General Public License
17      along with GNUnet; see the file COPYING.  If not, write to the
18      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19      Boston, MA 02110-1301, USA.
20 */
21
22 /**
23  * @file cadet/gnunet-service-cadet-new_paths.c
24  * @brief Information we track per path.
25  * @author Bartlomiej Polot
26  * @author Christian Grothoff
27  */
28 #include "platform.h"
29 #include "gnunet-service-cadet-new_paths.h"
30
31
32
33 /**
34  * Return how much we like keeping the path.  This is an aggregate
35  * score based on various factors, including the age of the path
36  * (older == better), and the value of this path to all of its ajacent
37  * peers.  For example, long paths that end at a peer that we have no
38  * shorter way to reach are very desirable, while long paths that end
39  * at a peer for which we have a shorter way as well are much less
40  * desirable.  Higher values indicate more valuable paths.  The
41  * returned value should be used to decide which paths to remember.
42  *
43  * @param path path to return the length for
44  * @return desirability of the path, larger is more desirable
45  */
46 GNUNET_CONTAINER_HeapCostType
47 GCPP_get_desirability (struct CadetPeerPath *path)
48 {
49   GNUNET_assert (0);
50   return 0;
51 }
52
53
54 /**
55  * The given peer @a cp used to own this @a path.  However, it is no
56  * longer interested in maintaining it, so the path should be
57  * discarded or shortened (in case a previous peer on the path finds
58  * the path desirable).
59  *
60  * @param path the path that is being released
61  * @param cp original final destination of @a path
62  * @param node entry in the heap of @a cp where this path is anchored
63  *             should be used for updates to the desirability of this path
64  */
65 void
66 GCPP_acquire (struct CadetPeerPath *path,
67               struct CadetPeer *cp,
68               struct GNUNET_CONTAINER_HeapNode *node)
69 {
70   GNUNET_assert (0);
71 }
72
73
74 /**
75  * The given peer @a cp used to own this @a path.  However, it is no
76  * longer interested in maintaining it, so the path should be
77  * discarded or shortened (in case a previous peer on the path finds
78  * the path desirable).
79  *
80  * @param path the path that is being released
81  * @param cp original final destination of @a path
82  */
83 void
84 GCPP_release (struct CadetPeerPath *path,
85               struct CadetPeer *cp)
86 {
87   GNUNET_assert (0);
88 }
89
90
91 /**
92  * Create a peer path based on the result of a DHT lookup.
93  *
94  * @param get_path path of the get request
95  * @param get_path_length lenght of @a get_path
96  * @param put_path path of the put request
97  * @param put_path_length length of the @a put_path
98  * @return a path through the network
99  */
100 struct CadetPeerPath *
101 GCPP_path_from_dht (const struct GNUNET_PeerIdentity *get_path,
102                     unsigned int get_path_length,
103                     const struct GNUNET_PeerIdentity *put_path,
104                     unsigned int put_path_length)
105 {
106   GNUNET_break (0);
107   return NULL;
108 }
109
110
111 /**
112  * Destroy a path, we no longer need it.
113  *
114  * @param p path to destroy.
115  */
116 void
117 GCPP_path_destroy (struct CadetPeerPath *p)
118 {
119   GNUNET_assert (0);
120 }
121
122
123 /**
124  * Return the length of the path.  Excludes one end of the
125  * path, so the loopback path has length 0.
126  *
127  * @param path path to return the length for
128  * @return number of peers on the path
129  */
130 unsigned int
131 GCPP_get_length (struct CadetPeerPath *path)
132 {
133   GNUNET_assert (0);
134   return -1;
135 }
136
137
138 /**
139  * Obtain the identity of the peer at offset @a off in @a path.
140  *
141  * @param path peer path to inspect
142  * @param off offset to return, must be smaller than path length
143  * @param[out] pid where to write the pid, must not be NULL
144  */
145 void
146 GCPP_get_pid_at_offset (struct CadetPeerPath *path,
147                         unsigned int off,
148                         struct GNUNET_PeerIdentity *pid)
149 {
150   GNUNET_assert (0);
151 }
152
153
154 /* end of gnunet-service-cadet-new_paths.c */