aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r--src/transport/gnunet-transport.c119
1 files changed, 111 insertions, 8 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 0fef7784e..354060ac8 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -39,56 +39,148 @@
39 * Should match NAT_SERVER_TIMEOUT in 'nat_test.c'. 39 * Should match NAT_SERVER_TIMEOUT in 'nat_test.c'.
40 */ 40 */
41#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20) 41#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20)
42
43/**
44 * Timeout for a name resolution
45 */
42#define RESOLUTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) 46#define RESOLUTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
47
48/**
49 * Timeout for an operations
50 */
43#define OP_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) 51#define OP_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
44 52
45 53
54/**
55 * Context to store name resolutions for valiation
56 */
46struct ValidationResolutionContext 57struct ValidationResolutionContext
47{ 58{
59 /**
60 * Next in DLL
61 */
48 struct ValidationResolutionContext *next; 62 struct ValidationResolutionContext *next;
49 63
64 /**
65 * Previous in DLL
66 */
50 struct ValidationResolutionContext *prev; 67 struct ValidationResolutionContext *prev;
51 68
69 /**
70 * Peer identity
71 */
52 struct GNUNET_PeerIdentity id; 72 struct GNUNET_PeerIdentity id;
53 73
74 /**
75 * Address to resolve
76 */
54 struct GNUNET_HELLO_Address *addrcp; 77 struct GNUNET_HELLO_Address *addrcp;
55 78
79 /**
80 * Time of last validation
81 */
56 struct GNUNET_TIME_Absolute last_validation; 82 struct GNUNET_TIME_Absolute last_validation;
57 83
84 /**
85 * Address is valid until
86 */
58 struct GNUNET_TIME_Absolute valid_until; 87 struct GNUNET_TIME_Absolute valid_until;
59 88
89 /**
90 * Time of next validation
91 */
60 struct GNUNET_TIME_Absolute next_validation; 92 struct GNUNET_TIME_Absolute next_validation;
61 93
94 /**
95 * state of validation process
96 */
62 enum GNUNET_TRANSPORT_ValidationState state; 97 enum GNUNET_TRANSPORT_ValidationState state;
63 98
99 /**
100 * Tranport conversion handle
101 */
64 struct GNUNET_TRANSPORT_AddressToStringContext *asc; 102 struct GNUNET_TRANSPORT_AddressToStringContext *asc;
65 103
104 /**
105 * plugin name
106 */
66 char *transport; 107 char *transport;
67 108
109 /**
110 * was the entry printed
111 */
68 int printed; 112 int printed;
69}; 113};
70 114
71 115/**
116 * Struct to store information about peers in monitor mode
117 */
72struct MonitoredPeer 118struct MonitoredPeer
73{ 119{
120 /**
121 * State of the peer
122 */
74 enum GNUNET_TRANSPORT_PeerState state; 123 enum GNUNET_TRANSPORT_PeerState state;
75 124
125 /**
126 * Timeout
127 */
76 struct GNUNET_TIME_Absolute state_timeout; 128 struct GNUNET_TIME_Absolute state_timeout;
77 129
130 /**
131 * The address to convert
132 */
78 struct GNUNET_HELLO_Address *address; 133 struct GNUNET_HELLO_Address *address;
79}; 134};
80 135
81 136/**
137 * Context to store name resolutions for valiation
138 */
82struct PeerResolutionContext 139struct PeerResolutionContext
83{ 140{
141 /**
142 * Next in DLL
143 */
84 struct PeerResolutionContext *next; 144 struct PeerResolutionContext *next;
145
146 /**
147 * Prev in DLL
148 */
85 struct PeerResolutionContext *prev; 149 struct PeerResolutionContext *prev;
150
151 /**
152 * The peer id
153 */
86 struct GNUNET_PeerIdentity id; 154 struct GNUNET_PeerIdentity id;
155
156 /**
157 * address to resolve
158 */
87 struct GNUNET_HELLO_Address *addrcp; 159 struct GNUNET_HELLO_Address *addrcp;
160
161 /**
162 * transport conversiion context
163 */
88 struct GNUNET_TRANSPORT_AddressToStringContext *asc; 164 struct GNUNET_TRANSPORT_AddressToStringContext *asc;
165
166 /**
167 * peer state
168 */
89 enum GNUNET_TRANSPORT_PeerState state; 169 enum GNUNET_TRANSPORT_PeerState state;
170
171 /**
172 * state timeout
173 */
90 struct GNUNET_TIME_Absolute state_timeout; 174 struct GNUNET_TIME_Absolute state_timeout;
175
176 /**
177 * transport plugin
178 */
91 char *transport; 179 char *transport;
180
181 /**
182 * was the entry printed
183 */
92 int printed; 184 int printed;
93}; 185};
94 186
@@ -349,12 +441,24 @@ struct TestContext *head;
349 */ 441 */
350struct TestContext *tail; 442struct TestContext *tail;
351 443
444/**
445 * DLL: head of validation resolution entries
446 */
352static struct ValidationResolutionContext *vc_head; 447static struct ValidationResolutionContext *vc_head;
353 448
449/**
450 * DLL: tail of validation resolution entries
451 */
354static struct ValidationResolutionContext *vc_tail; 452static struct ValidationResolutionContext *vc_tail;
355 453
454/**
455 * DLL: head of resolution entries
456 */
356static struct PeerResolutionContext *rc_head; 457static struct PeerResolutionContext *rc_head;
357 458
459/**
460 * DLL: head of resolution entries
461 */
358static struct PeerResolutionContext *rc_tail; 462static struct PeerResolutionContext *rc_tail;
359 463
360 464
@@ -596,8 +700,7 @@ display_test_result (struct TestContext *tc,
596 * Clean up and update GUI. 700 * Clean up and update GUI.
597 * 701 *
598 * @param cls test context 702 * @param cls test context
599 * @param success currently always #GNUNET_OK 703 * @param result status code
600 * @param emsg error message, NULL on success
601 */ 704 */
602static void 705static void
603result_callback (void *cls, 706result_callback (void *cls,
@@ -633,8 +736,8 @@ resolve_validation_address (const struct GNUNET_PeerIdentity *id,
633/** 736/**
634 * Function to call with a textual representation of an address. This 737 * Function to call with a textual representation of an address. This
635 * function will be called several times with different possible 738 * function will be called several times with different possible
636 * textual representations, and a last time with @address being NULL 739 * textual representations, and a last time with @a address being NULL
637 * to signal the end of the iteration. Note that @address NULL 740 * to signal the end of the iteration. Note that @a address NULL
638 * always is the last call, regardless of the value in @a res. 741 * always is the last call, regardless of the value in @a res.
639 * 742 *
640 * @param cls closure 743 * @param cls closure
@@ -1205,8 +1308,8 @@ print_info (const struct GNUNET_PeerIdentity *id,
1205/** 1308/**
1206 * Function called with a textual representation of an address. This 1309 * Function called with a textual representation of an address. This
1207 * function will be called several times with different possible 1310 * function will be called several times with different possible
1208 * textual representations, and a last time with @address being NULL 1311 * textual representations, and a last time with @a address being NULL
1209 * to signal the end of the iteration. Note that @address NULL 1312 * to signal the end of the iteration. Note that @a address NULL
1210 * always is the last call, regardless of the value in @a res. 1313 * always is the last call, regardless of the value in @a res.
1211 * 1314 *
1212 * @param cls closure 1315 * @param cls closure