diff options
-rw-r--r-- | src/hello/hello-ng.c | 24 | ||||
-rw-r--r-- | src/include/gnunet_hello_lib.h | 11 | ||||
-rw-r--r-- | src/include/gnunet_transport_communication_service.h | 27 | ||||
-rw-r--r-- | src/include/gnunet_transport_monitor_service.h | 7 | ||||
-rw-r--r-- | src/transport/gnunet-communicator-unix.c | 11 | ||||
-rw-r--r-- | src/transport/gnunet-service-tng.c | 274 | ||||
-rw-r--r-- | src/transport/transport.h | 18 | ||||
-rw-r--r-- | src/transport/transport_api2_communication.c | 28 | ||||
-rw-r--r-- | src/transport/transport_api2_monitor.c | 2 |
9 files changed, 363 insertions, 39 deletions
diff --git a/src/hello/hello-ng.c b/src/hello/hello-ng.c index 425095f9c..46c83a7eb 100644 --- a/src/hello/hello-ng.c +++ b/src/hello/hello-ng.c | |||
@@ -53,6 +53,7 @@ struct SignedAddress | |||
53 | * Build address record by signing raw information with private key. | 53 | * Build address record by signing raw information with private key. |
54 | * | 54 | * |
55 | * @param address text address at @a communicator to sign | 55 | * @param address text address at @a communicator to sign |
56 | * @param nt network type of @a address | ||
56 | * @param expiration how long is @a address valid | 57 | * @param expiration how long is @a address valid |
57 | * @param private_key signing key to use | 58 | * @param private_key signing key to use |
58 | * @param result[out] where to write address record (allocated) | 59 | * @param result[out] where to write address record (allocated) |
@@ -60,6 +61,7 @@ struct SignedAddress | |||
60 | */ | 61 | */ |
61 | void | 62 | void |
62 | GNUNET_HELLO_sign_address (const char *address, | 63 | GNUNET_HELLO_sign_address (const char *address, |
64 | enum GNUNET_ATS_Network_Type nt, | ||
63 | struct GNUNET_TIME_Absolute expiration, | 65 | struct GNUNET_TIME_Absolute expiration, |
64 | const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key, | 66 | const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key, |
65 | void **result, | 67 | void **result, |
@@ -84,9 +86,10 @@ GNUNET_HELLO_sign_address (const char *address, | |||
84 | sizeof (sig), | 86 | sizeof (sig), |
85 | &sig_str); | 87 | &sig_str); |
86 | *result_size = 1 + GNUNET_asprintf ((char **) result, | 88 | *result_size = 1 + GNUNET_asprintf ((char **) result, |
87 | "%s;%llu;%s", | 89 | "%s;%llu;%u;%s", |
88 | sig_str, | 90 | sig_str, |
89 | (unsigned long long) expiration.abs_value_us, | 91 | (unsigned long long) expiration.abs_value_us, |
92 | (unsigned int) nt, | ||
90 | address); | 93 | address); |
91 | GNUNET_free (sig_str); | 94 | GNUNET_free (sig_str); |
92 | } | 95 | } |
@@ -98,6 +101,7 @@ GNUNET_HELLO_sign_address (const char *address, | |||
98 | * @param raw raw signed address | 101 | * @param raw raw signed address |
99 | * @param raw_size size of @a raw | 102 | * @param raw_size size of @a raw |
100 | * @param public_key public key to use for signature verification | 103 | * @param public_key public key to use for signature verification |
104 | * @param nt[out] set to network type | ||
101 | * @param expiration[out] how long is the address valid | 105 | * @param expiration[out] how long is the address valid |
102 | * @return NULL on error, otherwise the address | 106 | * @return NULL on error, otherwise the address |
103 | */ | 107 | */ |
@@ -105,12 +109,15 @@ char * | |||
105 | GNUNET_HELLO_extract_address (const void *raw, | 109 | GNUNET_HELLO_extract_address (const void *raw, |
106 | size_t raw_size, | 110 | size_t raw_size, |
107 | const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, | 111 | const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, |
112 | enum GNUNET_ATS_Network_Type *nt, | ||
108 | struct GNUNET_TIME_Absolute *expiration) | 113 | struct GNUNET_TIME_Absolute *expiration) |
109 | { | 114 | { |
110 | const char *raws = raw; | 115 | const char *raws = raw; |
111 | unsigned long long raw_us; | 116 | unsigned long long raw_us; |
117 | unsigned int raw_nt; | ||
112 | const char *sc; | 118 | const char *sc; |
113 | const char *sc2; | 119 | const char *sc2; |
120 | const char *sc3; | ||
114 | const char *raw_addr; | 121 | const char *raw_addr; |
115 | struct GNUNET_TIME_Absolute raw_expiration; | 122 | struct GNUNET_TIME_Absolute raw_expiration; |
116 | struct SignedAddress sa; | 123 | struct SignedAddress sa; |
@@ -133,9 +140,16 @@ GNUNET_HELLO_extract_address (const void *raw, | |||
133 | GNUNET_break_op (0); | 140 | GNUNET_break_op (0); |
134 | return NULL; | 141 | return NULL; |
135 | } | 142 | } |
143 | if (NULL == (sc3 = strchr (sc2 + 1, | ||
144 | ';'))) | ||
145 | { | ||
146 | GNUNET_break_op (0); | ||
147 | return NULL; | ||
148 | } | ||
136 | if (1 != sscanf (sc + 1, | 149 | if (1 != sscanf (sc + 1, |
137 | "%llu;", | 150 | "%llu;%u;", |
138 | &raw_us)) | 151 | &raw_us, |
152 | &raw_nt)) | ||
139 | { | 153 | { |
140 | GNUNET_break_op (0); | 154 | GNUNET_break_op (0); |
141 | return NULL; | 155 | return NULL; |
@@ -153,7 +167,7 @@ GNUNET_HELLO_extract_address (const void *raw, | |||
153 | GNUNET_free_non_null (sig); | 167 | GNUNET_free_non_null (sig); |
154 | return NULL; | 168 | return NULL; |
155 | } | 169 | } |
156 | raw_addr = sc2 + 1; | 170 | raw_addr = sc3 + 1; |
157 | 171 | ||
158 | sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS); | 172 | sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS); |
159 | sa.purpose.size = htonl (sizeof (sa)); | 173 | sa.purpose.size = htonl (sizeof (sa)); |
@@ -172,6 +186,8 @@ GNUNET_HELLO_extract_address (const void *raw, | |||
172 | return NULL; | 186 | return NULL; |
173 | } | 187 | } |
174 | GNUNET_free (sig); | 188 | GNUNET_free (sig); |
189 | *expiration = raw_expiration; | ||
190 | *nt = (enum GNUNET_ATS_Network_Type) raw_nt; | ||
175 | return GNUNET_strdup (raw_addr); | 191 | return GNUNET_strdup (raw_addr); |
176 | } | 192 | } |
177 | 193 | ||
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h index e19419f25..ceaa60466 100644 --- a/src/include/gnunet_hello_lib.h +++ b/src/include/gnunet_hello_lib.h | |||
@@ -42,7 +42,6 @@ extern "C" | |||
42 | 42 | ||
43 | #include "gnunet_util_lib.h" | 43 | #include "gnunet_util_lib.h" |
44 | 44 | ||
45 | |||
46 | /** | 45 | /** |
47 | * Prefix that every HELLO URI must start with. | 46 | * Prefix that every HELLO URI must start with. |
48 | */ | 47 | */ |
@@ -475,11 +474,18 @@ GNUNET_HELLO_parse_uri (const char *uri, | |||
475 | 474 | ||
476 | 475 | ||
477 | /* NG API */ | 476 | /* NG API */ |
477 | /** | ||
478 | * Defined in gnunet_ats_service.h, but here we do not care about | ||
479 | * the details so are just giving the declaration. | ||
480 | */ | ||
481 | enum GNUNET_ATS_Network_Type; | ||
482 | |||
478 | 483 | ||
479 | /** | 484 | /** |
480 | * Build address record by signing raw information with private key. | 485 | * Build address record by signing raw information with private key. |
481 | * | 486 | * |
482 | * @param address text address to sign | 487 | * @param address text address to sign |
488 | * @param nt network type of @a address | ||
483 | * @param expiration how long is @a address valid | 489 | * @param expiration how long is @a address valid |
484 | * @param private_key signing key to use | 490 | * @param private_key signing key to use |
485 | * @param result[out] where to write address record (allocated) | 491 | * @param result[out] where to write address record (allocated) |
@@ -487,6 +493,7 @@ GNUNET_HELLO_parse_uri (const char *uri, | |||
487 | */ | 493 | */ |
488 | void | 494 | void |
489 | GNUNET_HELLO_sign_address (const char *address, | 495 | GNUNET_HELLO_sign_address (const char *address, |
496 | enum GNUNET_ATS_Network_Type nt, | ||
490 | struct GNUNET_TIME_Absolute expiration, | 497 | struct GNUNET_TIME_Absolute expiration, |
491 | const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key, | 498 | const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key, |
492 | void **result, | 499 | void **result, |
@@ -499,6 +506,7 @@ GNUNET_HELLO_sign_address (const char *address, | |||
499 | * @param raw raw signed address | 506 | * @param raw raw signed address |
500 | * @param raw_size size of @a raw | 507 | * @param raw_size size of @a raw |
501 | * @param public_key public key to use for signature verification | 508 | * @param public_key public key to use for signature verification |
509 | * @param nt[out] set to network type | ||
502 | * @param expiration[out] how long is the address valid | 510 | * @param expiration[out] how long is the address valid |
503 | * @return NULL on error, otherwise the address | 511 | * @return NULL on error, otherwise the address |
504 | */ | 512 | */ |
@@ -506,6 +514,7 @@ char * | |||
506 | GNUNET_HELLO_extract_address (const void *raw, | 514 | GNUNET_HELLO_extract_address (const void *raw, |
507 | size_t raw_size, | 515 | size_t raw_size, |
508 | const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, | 516 | const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, |
517 | enum GNUNET_ATS_Network_Type *nt, | ||
509 | struct GNUNET_TIME_Absolute *expiration); | 518 | struct GNUNET_TIME_Absolute *expiration); |
510 | 519 | ||
511 | 520 | ||
diff --git a/src/include/gnunet_transport_communication_service.h b/src/include/gnunet_transport_communication_service.h index 50f94bddf..fed681f0f 100644 --- a/src/include/gnunet_transport_communication_service.h +++ b/src/include/gnunet_transport_communication_service.h | |||
@@ -86,8 +86,6 @@ struct GNUNET_TRANSPORT_CommunicatorHandle; | |||
86 | * @param config_section section of the configuration to use for options | 86 | * @param config_section section of the configuration to use for options |
87 | * @param addr_prefix address prefix for addresses supported by this | 87 | * @param addr_prefix address prefix for addresses supported by this |
88 | * communicator, could be NULL for incoming-only communicators | 88 | * communicator, could be NULL for incoming-only communicators |
89 | * @param mtu maximum message size supported by communicator, 0 if | ||
90 | * sending is not supported, SIZE_MAX for no MTU | ||
91 | * @param mq_init function to call to initialize a message queue given | 89 | * @param mq_init function to call to initialize a message queue given |
92 | * the address of another peer, can be NULL if the | 90 | * the address of another peer, can be NULL if the |
93 | * communicator only supports receiving messages | 91 | * communicator only supports receiving messages |
@@ -98,7 +96,6 @@ struct GNUNET_TRANSPORT_CommunicatorHandle * | |||
98 | GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 96 | GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
99 | const char *config_section_name, | 97 | const char *config_section_name, |
100 | const char *addr_prefix, | 98 | const char *addr_prefix, |
101 | size_t mtu, | ||
102 | GNUNET_TRANSPORT_CommunicatorMqInit mq_init, | 99 | GNUNET_TRANSPORT_CommunicatorMqInit mq_init, |
103 | void *mq_init_cls); | 100 | void *mq_init_cls); |
104 | 101 | ||
@@ -162,6 +159,25 @@ struct GNUNET_TRANSPORT_QueueHandle; | |||
162 | 159 | ||
163 | 160 | ||
164 | /** | 161 | /** |
162 | * Possible states of a connection. | ||
163 | */ | ||
164 | enum GNUNET_TRANSPORT_ConnectionStatus { | ||
165 | /** | ||
166 | * Connection is down. | ||
167 | */ | ||
168 | GNUNET_TRANSPORT_CS_DOWN = -1, | ||
169 | /** | ||
170 | * this is an outbound connection (transport initiated) | ||
171 | */ | ||
172 | GNUNET_TRANSPORT_CS_OUTBOUND = 0, | ||
173 | /** | ||
174 | * this is an inbound connection (communicator initiated) | ||
175 | */ | ||
176 | GNUNET_TRANSPORT_CS_INBOUND = 1 | ||
177 | }; | ||
178 | |||
179 | |||
180 | /** | ||
165 | * Notify transport service that an MQ became available due to an | 181 | * Notify transport service that an MQ became available due to an |
166 | * "inbound" connection or because the communicator discovered the | 182 | * "inbound" connection or because the communicator discovered the |
167 | * presence of another peer. | 183 | * presence of another peer. |
@@ -169,7 +185,10 @@ struct GNUNET_TRANSPORT_QueueHandle; | |||
169 | * @param ch connection to transport service | 185 | * @param ch connection to transport service |
170 | * @param peer peer with which we can now communicate | 186 | * @param peer peer with which we can now communicate |
171 | * @param address address in human-readable format, 0-terminated, UTF-8 | 187 | * @param address address in human-readable format, 0-terminated, UTF-8 |
188 | * @param mtu maximum message size supported by queue, 0 if | ||
189 | * sending is not supported, SIZE_MAX for no MTU | ||
172 | * @param nt which network type does the @a address belong to? | 190 | * @param nt which network type does the @a address belong to? |
191 | * @param cs what is the connection status of the queue? | ||
173 | * @param mq message queue of the @a peer | 192 | * @param mq message queue of the @a peer |
174 | * @return API handle identifying the new MQ | 193 | * @return API handle identifying the new MQ |
175 | */ | 194 | */ |
@@ -177,7 +196,9 @@ struct GNUNET_TRANSPORT_QueueHandle * | |||
177 | GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, | 196 | GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, |
178 | const struct GNUNET_PeerIdentity *peer, | 197 | const struct GNUNET_PeerIdentity *peer, |
179 | const char *address, | 198 | const char *address, |
199 | uint32_t mtu, | ||
180 | enum GNUNET_ATS_Network_Type nt, | 200 | enum GNUNET_ATS_Network_Type nt, |
201 | enum GNUNET_TRANSPORT_ConnectionStatus cs, | ||
181 | struct GNUNET_MQ_Handle *mq); | 202 | struct GNUNET_MQ_Handle *mq); |
182 | 203 | ||
183 | 204 | ||
diff --git a/src/include/gnunet_transport_monitor_service.h b/src/include/gnunet_transport_monitor_service.h index 76fec0af4..799434016 100644 --- a/src/include/gnunet_transport_monitor_service.h +++ b/src/include/gnunet_transport_monitor_service.h | |||
@@ -42,6 +42,8 @@ extern "C" | |||
42 | 42 | ||
43 | #include "gnunet_util_lib.h" | 43 | #include "gnunet_util_lib.h" |
44 | #include "gnunet_ats_service.h" | 44 | #include "gnunet_ats_service.h" |
45 | #include "gnunet_transport_communication_service.h" | ||
46 | |||
45 | 47 | ||
46 | /** | 48 | /** |
47 | * Version number of the transport API. | 49 | * Version number of the transport API. |
@@ -66,10 +68,9 @@ struct GNUNET_TRANSPORT_MonitorInformation | |||
66 | enum GNUNET_ATS_Network_Type nt; | 68 | enum GNUNET_ATS_Network_Type nt; |
67 | 69 | ||
68 | /** | 70 | /** |
69 | * #GNUNET_YES if this is an inbound connection (communicator initiated) | 71 | * Connection status. |
70 | * #GNUNET_NO if this is an outbound connection (transport initiated) | ||
71 | */ | 72 | */ |
72 | int is_inbound; | 73 | enum GNUNET_TRANSPORT_ConnectionStatus cs; |
73 | 74 | ||
74 | /** | 75 | /** |
75 | * Number of messages pending transmission for this @e address. | 76 | * Number of messages pending transmission for this @e address. |
diff --git a/src/transport/gnunet-communicator-unix.c b/src/transport/gnunet-communicator-unix.c index b2eebbe20..a9a75f779 100644 --- a/src/transport/gnunet-communicator-unix.c +++ b/src/transport/gnunet-communicator-unix.c | |||
@@ -50,6 +50,10 @@ | |||
50 | */ | 50 | */ |
51 | #define COMMUNICATOR_CONFIG_SECTION "communicator-unix" | 51 | #define COMMUNICATOR_CONFIG_SECTION "communicator-unix" |
52 | 52 | ||
53 | /** | ||
54 | * Our MTU. | ||
55 | */ | ||
56 | #define UNIX_MTU UINT16_MAX | ||
53 | 57 | ||
54 | GNUNET_NETWORK_STRUCT_BEGIN | 58 | GNUNET_NETWORK_STRUCT_BEGIN |
55 | 59 | ||
@@ -619,12 +623,14 @@ mq_error (void *cls, | |||
619 | * data to another peer. | 623 | * data to another peer. |
620 | * | 624 | * |
621 | * @param peer the target peer | 625 | * @param peer the target peer |
626 | * @param cs inbound or outbound queue | ||
622 | * @param un the address | 627 | * @param un the address |
623 | * @param un_len number of bytes in @a un | 628 | * @param un_len number of bytes in @a un |
624 | * @return the queue or NULL of max connections exceeded | 629 | * @return the queue or NULL of max connections exceeded |
625 | */ | 630 | */ |
626 | static struct Queue * | 631 | static struct Queue * |
627 | setup_queue (const struct GNUNET_PeerIdentity *target, | 632 | setup_queue (const struct GNUNET_PeerIdentity *target, |
633 | enum GNUNET_TRANSPORT_ConnectionStatus cs, | ||
628 | const struct sockaddr_un *un, | 634 | const struct sockaddr_un *un, |
629 | socklen_t un_len) | 635 | socklen_t un_len) |
630 | { | 636 | { |
@@ -673,7 +679,9 @@ setup_queue (const struct GNUNET_PeerIdentity *target, | |||
673 | = GNUNET_TRANSPORT_communicator_mq_add (ch, | 679 | = GNUNET_TRANSPORT_communicator_mq_add (ch, |
674 | &queue->target, | 680 | &queue->target, |
675 | foreign_addr, | 681 | foreign_addr, |
682 | UNIX_MTU, | ||
676 | GNUNET_ATS_NET_LOOPBACK, | 683 | GNUNET_ATS_NET_LOOPBACK, |
684 | cs, | ||
677 | queue->mq); | 685 | queue->mq); |
678 | GNUNET_free (foreign_addr); | 686 | GNUNET_free (foreign_addr); |
679 | } | 687 | } |
@@ -779,6 +787,7 @@ select_read_cb (void *cls) | |||
779 | addrlen); | 787 | addrlen); |
780 | if (NULL == queue) | 788 | if (NULL == queue) |
781 | queue = setup_queue (&msg->sender, | 789 | queue = setup_queue (&msg->sender, |
790 | GNUNET_TRANSPORT_CS_INBOUND, | ||
782 | &un, | 791 | &un, |
783 | addrlen); | 792 | addrlen); |
784 | else | 793 | else |
@@ -885,6 +894,7 @@ mq_init (void *cls, | |||
885 | return GNUNET_OK; | 894 | return GNUNET_OK; |
886 | } | 895 | } |
887 | queue = setup_queue (peer, | 896 | queue = setup_queue (peer, |
897 | GNUNET_TRANSPORT_CS_OUTBOUND, | ||
888 | un, | 898 | un, |
889 | un_len); | 899 | un_len); |
890 | GNUNET_free (un); | 900 | GNUNET_free (un); |
@@ -1072,7 +1082,6 @@ run (void *cls, | |||
1072 | ch = GNUNET_TRANSPORT_communicator_connect (cfg, | 1082 | ch = GNUNET_TRANSPORT_communicator_connect (cfg, |
1073 | COMMUNICATOR_CONFIG_SECTION, | 1083 | COMMUNICATOR_CONFIG_SECTION, |
1074 | COMMUNICATOR_ADDRESS_PREFIX, | 1084 | COMMUNICATOR_ADDRESS_PREFIX, |
1075 | 65535, | ||
1076 | &mq_init, | 1085 | &mq_init, |
1077 | NULL); | 1086 | NULL); |
1078 | if (NULL == ch) | 1087 | if (NULL == ch) |
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index e5fb51bd2..efbaf6fc9 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c | |||
@@ -21,16 +21,17 @@ | |||
21 | * @author Christian Grothoff | 21 | * @author Christian Grothoff |
22 | * | 22 | * |
23 | * TODO: | 23 | * TODO: |
24 | * - MTU information is missing for queues! | 24 | * - monitor start: iterate to inform monitor about all existing queues! |
25 | * - start supporting monitor logic (add functions to signal monitors!) | ||
26 | * - manage fragmentation/defragmentation, retransmission, track RTT, loss, etc. | 25 | * - manage fragmentation/defragmentation, retransmission, track RTT, loss, etc. |
27 | * - ask ATS about bandwidth allocation | 26 | * - inform ATS about RTT, goodput/loss, overheads, etc. |
27 | * - ask ATS about bandwidth allocation! | ||
28 | * - | 28 | * - |
29 | */ | 29 | */ |
30 | #include "platform.h" | 30 | #include "platform.h" |
31 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
32 | #include "gnunet_statistics_service.h" | 32 | #include "gnunet_statistics_service.h" |
33 | #include "gnunet_transport_service.h" | 33 | #include "gnunet_transport_service.h" |
34 | #include "gnunet_transport_monitor_service.h" | ||
34 | #include "gnunet_peerstore_service.h" | 35 | #include "gnunet_peerstore_service.h" |
35 | #include "gnunet_ats_service.h" | 36 | #include "gnunet_ats_service.h" |
36 | #include "gnunet-service-transport.h" | 37 | #include "gnunet-service-transport.h" |
@@ -137,6 +138,11 @@ struct Queue | |||
137 | uint32_t qid; | 138 | uint32_t qid; |
138 | 139 | ||
139 | /** | 140 | /** |
141 | * Maximum transmission unit supported by this queue. | ||
142 | */ | ||
143 | uint32_t mtu; | ||
144 | |||
145 | /** | ||
140 | * Network type offered by this queue. | 146 | * Network type offered by this queue. |
141 | */ | 147 | */ |
142 | enum GNUNET_ATS_Network_Type nt; | 148 | enum GNUNET_ATS_Network_Type nt; |
@@ -454,6 +460,127 @@ lookup_neighbour (const struct GNUNET_PeerIdentity *pid) | |||
454 | 460 | ||
455 | 461 | ||
456 | /** | 462 | /** |
463 | * Details about what to notify monitors about. | ||
464 | */ | ||
465 | struct MonitorEvent | ||
466 | { | ||
467 | /** | ||
468 | * @deprecated To be discussed if we keep these... | ||
469 | */ | ||
470 | struct GNUNET_TIME_Absolute last_validation; | ||
471 | struct GNUNET_TIME_Absolute valid_until; | ||
472 | struct GNUNET_TIME_Absolute next_validation; | ||
473 | |||
474 | /** | ||
475 | * Current round-trip time estimate. | ||
476 | */ | ||
477 | struct GNUNET_TIME_Relative rtt; | ||
478 | |||
479 | /** | ||
480 | * Connection status. | ||
481 | */ | ||
482 | enum GNUNET_TRANSPORT_ConnectionStatus cs; | ||
483 | |||
484 | /** | ||
485 | * Messages pending. | ||
486 | */ | ||
487 | uint32_t num_msg_pending; | ||
488 | |||
489 | /** | ||
490 | * Bytes pending. | ||
491 | */ | ||
492 | uint32_t num_bytes_pending; | ||
493 | |||
494 | |||
495 | }; | ||
496 | |||
497 | |||
498 | /** | ||
499 | * Notify monitor @a tc about an event. That @a tc | ||
500 | * cares about the event has already been checked. | ||
501 | * | ||
502 | * Send @a tc information in @a me about a @a peer's status with | ||
503 | * respect to some @a address to all monitors that care. | ||
504 | * | ||
505 | * @param tc monitor to inform | ||
506 | * @param peer peer the information is about | ||
507 | * @param address address the information is about | ||
508 | * @param nt network type associated with @a address | ||
509 | * @param me detailed information to transmit | ||
510 | */ | ||
511 | static void | ||
512 | notify_monitor (struct TransportClient *tc, | ||
513 | const struct GNUNET_PeerIdentity *peer, | ||
514 | const char *address, | ||
515 | enum GNUNET_ATS_Network_Type nt, | ||
516 | const struct MonitorEvent *me) | ||
517 | { | ||
518 | struct GNUNET_MQ_Envelope *env; | ||
519 | struct GNUNET_TRANSPORT_MonitorData *md; | ||
520 | size_t addr_len = strlen (address) + 1; | ||
521 | |||
522 | env = GNUNET_MQ_msg_extra (md, | ||
523 | addr_len, | ||
524 | GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_DATA); | ||
525 | md->nt = htonl ((uint32_t) nt); | ||
526 | md->peer = *peer; | ||
527 | md->last_validation = GNUNET_TIME_absolute_hton (me->last_validation); | ||
528 | md->valid_until = GNUNET_TIME_absolute_hton (me->valid_until); | ||
529 | md->next_validation = GNUNET_TIME_absolute_hton (me->next_validation); | ||
530 | md->rtt = GNUNET_TIME_relative_hton (me->rtt); | ||
531 | md->cs = htonl ((uint32_t) me->cs); | ||
532 | md->num_msg_pending = htonl (me->num_msg_pending); | ||
533 | md->num_bytes_pending = htonl (me->num_bytes_pending); | ||
534 | memcpy (&md[1], | ||
535 | address, | ||
536 | addr_len); | ||
537 | GNUNET_MQ_send (tc->mq, | ||
538 | env); | ||
539 | } | ||
540 | |||
541 | |||
542 | /** | ||
543 | * Send information in @a me about a @a peer's status with respect | ||
544 | * to some @a address to all monitors that care. | ||
545 | * | ||
546 | * @param peer peer the information is about | ||
547 | * @param address address the information is about | ||
548 | * @param nt network type associated with @a address | ||
549 | * @param me detailed information to transmit | ||
550 | */ | ||
551 | static void | ||
552 | notify_monitors (const struct GNUNET_PeerIdentity *peer, | ||
553 | const char *address, | ||
554 | enum GNUNET_ATS_Network_Type nt, | ||
555 | const struct MonitorEvent *me) | ||
556 | { | ||
557 | static struct GNUNET_PeerIdentity zero; | ||
558 | |||
559 | for (struct TransportClient *tc = clients_head; | ||
560 | NULL != tc; | ||
561 | tc = tc->next) | ||
562 | { | ||
563 | if (CT_MONITOR != tc->type) | ||
564 | continue; | ||
565 | if (tc->details.monitor.one_shot) | ||
566 | continue; | ||
567 | if ( (0 != memcmp (&tc->details.monitor.peer, | ||
568 | &zero, | ||
569 | sizeof (zero))) && | ||
570 | (0 != memcmp (&tc->details.monitor.peer, | ||
571 | peer, | ||
572 | sizeof (*peer))) ) | ||
573 | continue; | ||
574 | notify_monitor (tc, | ||
575 | peer, | ||
576 | address, | ||
577 | nt, | ||
578 | me); | ||
579 | } | ||
580 | } | ||
581 | |||
582 | |||
583 | /** | ||
457 | * Called whenever a client connects. Allocates our | 584 | * Called whenever a client connects. Allocates our |
458 | * data structures associated with that client. | 585 | * data structures associated with that client. |
459 | * | 586 | * |
@@ -500,6 +627,80 @@ free_neighbour (struct Neighbour *neighbour) | |||
500 | 627 | ||
501 | 628 | ||
502 | /** | 629 | /** |
630 | * Send message to CORE clients that we lost a connection. | ||
631 | * | ||
632 | * @param tc client to inform (must be CORE client) | ||
633 | * @param pid peer the connection is for | ||
634 | * @param quota_out current quota for the peer | ||
635 | */ | ||
636 | static void | ||
637 | core_send_connect_info (struct TransportClient *tc, | ||
638 | const struct GNUNET_PeerIdentity *pid, | ||
639 | struct GNUNET_BANDWIDTH_Value32NBO quota_out) | ||
640 | { | ||
641 | struct GNUNET_MQ_Envelope *env; | ||
642 | struct ConnectInfoMessage *cim; | ||
643 | |||
644 | GNUNET_assert (CT_CORE == tc->type); | ||
645 | env = GNUNET_MQ_msg (cim, | ||
646 | GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); | ||
647 | cim->quota_out = quota_out; | ||
648 | cim->id = *pid; | ||
649 | GNUNET_MQ_send (tc->mq, | ||
650 | env); | ||
651 | } | ||
652 | |||
653 | |||
654 | /** | ||
655 | * Send message to CORE clients that we gained a connection | ||
656 | * | ||
657 | * @param pid peer the queue was for | ||
658 | * @param quota_out current quota for the peer | ||
659 | */ | ||
660 | static void | ||
661 | cores_send_connect_info (const struct GNUNET_PeerIdentity *pid, | ||
662 | struct GNUNET_BANDWIDTH_Value32NBO quota_out) | ||
663 | { | ||
664 | for (struct TransportClient *tc = clients_head; | ||
665 | NULL != tc; | ||
666 | tc = tc->next) | ||
667 | { | ||
668 | if (CT_CORE != tc->type) | ||
669 | continue; | ||
670 | core_send_connect_info (tc, | ||
671 | pid, | ||
672 | quota_out); | ||
673 | } | ||
674 | } | ||
675 | |||
676 | |||
677 | /** | ||
678 | * Send message to CORE clients that we lost a connection. | ||
679 | * | ||
680 | * @param pid peer the connection was for | ||
681 | */ | ||
682 | static void | ||
683 | cores_send_disconnect_info (const struct GNUNET_PeerIdentity *pid) | ||
684 | { | ||
685 | for (struct TransportClient *tc = clients_head; | ||
686 | NULL != tc; | ||
687 | tc = tc->next) | ||
688 | { | ||
689 | struct GNUNET_MQ_Envelope *env; | ||
690 | struct DisconnectInfoMessage *dim; | ||
691 | |||
692 | if (CT_CORE != tc->type) | ||
693 | continue; | ||
694 | env = GNUNET_MQ_msg (dim, | ||
695 | GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT); | ||
696 | dim->peer = *pid; | ||
697 | GNUNET_MQ_send (tc->mq, | ||
698 | env); | ||
699 | } | ||
700 | } | ||
701 | |||
702 | |||
703 | /** | ||
503 | * Free @a queue. | 704 | * Free @a queue. |
504 | * | 705 | * |
505 | * @param queue the queue to free | 706 | * @param queue the queue to free |
@@ -509,6 +710,10 @@ free_queue (struct Queue *queue) | |||
509 | { | 710 | { |
510 | struct Neighbour *neighbour = queue->neighbour; | 711 | struct Neighbour *neighbour = queue->neighbour; |
511 | struct TransportClient *tc = queue->tc; | 712 | struct TransportClient *tc = queue->tc; |
713 | struct MonitorEvent me = { | ||
714 | .cs = GNUNET_TRANSPORT_CS_DOWN, | ||
715 | .rtt = GNUNET_TIME_UNIT_FOREVER_REL | ||
716 | }; | ||
512 | 717 | ||
513 | GNUNET_CONTAINER_MDLL_remove (neighbour, | 718 | GNUNET_CONTAINER_MDLL_remove (neighbour, |
514 | neighbour->queue_head, | 719 | neighbour->queue_head, |
@@ -518,10 +723,15 @@ free_queue (struct Queue *queue) | |||
518 | tc->details.communicator.queue_head, | 723 | tc->details.communicator.queue_head, |
519 | tc->details.communicator.queue_tail, | 724 | tc->details.communicator.queue_tail, |
520 | queue); | 725 | queue); |
726 | |||
727 | notify_monitors (&neighbour->pid, | ||
728 | queue->address, | ||
729 | queue->nt, | ||
730 | &me); | ||
521 | GNUNET_free (queue); | 731 | GNUNET_free (queue); |
522 | if (NULL == neighbour->queue_head) | 732 | if (NULL == neighbour->queue_head) |
523 | { | 733 | { |
524 | // FIXME: notify cores/monitors! | 734 | cores_send_disconnect_info (&neighbour->pid); |
525 | free_neighbour (neighbour); | 735 | free_neighbour (neighbour); |
526 | } | 736 | } |
527 | } | 737 | } |
@@ -613,6 +823,30 @@ client_disconnect_cb (void *cls, | |||
613 | 823 | ||
614 | 824 | ||
615 | /** | 825 | /** |
826 | * Iterator telling new CORE client about all existing | ||
827 | * connections to peers. | ||
828 | * | ||
829 | * @param cls the new `struct TransportClient` | ||
830 | * @param pid a connected peer | ||
831 | * @param value the `struct Neighbour` with more information | ||
832 | * @return #GNUNET_OK (continue to iterate) | ||
833 | */ | ||
834 | static int | ||
835 | notify_client_connect_info (void *cls, | ||
836 | const struct GNUNET_PeerIdentity *pid, | ||
837 | void *value) | ||
838 | { | ||
839 | struct TransportClient *tc = cls; | ||
840 | struct Neighbour *neighbour = value; | ||
841 | |||
842 | core_send_connect_info (tc, | ||
843 | pid, | ||
844 | neighbour->quota_out); | ||
845 | return GNUNET_OK; | ||
846 | } | ||
847 | |||
848 | |||
849 | /** | ||
616 | * Initialize a "CORE" client. We got a start message from this | 850 | * Initialize a "CORE" client. We got a start message from this |
617 | * client, so add it to the list of clients for broadcasting of | 851 | * client, so add it to the list of clients for broadcasting of |
618 | * inbound messages. | 852 | * inbound messages. |
@@ -646,6 +880,9 @@ handle_client_start (void *cls, | |||
646 | return; | 880 | return; |
647 | } | 881 | } |
648 | tc->type = CT_CORE; | 882 | tc->type = CT_CORE; |
883 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, | ||
884 | ¬ify_client_connect_info, | ||
885 | tc); | ||
649 | GNUNET_SERVICE_client_continue (tc->client); | 886 | GNUNET_SERVICE_client_continue (tc->client); |
650 | } | 887 | } |
651 | 888 | ||
@@ -786,7 +1023,7 @@ handle_client_send (void *cls, | |||
786 | tc->details.core.pending_msg_head, | 1023 | tc->details.core.pending_msg_head, |
787 | tc->details.core.pending_msg_tail, | 1024 | tc->details.core.pending_msg_tail, |
788 | pm); | 1025 | pm); |
789 | // FIXME: do the work, continuation with: | 1026 | // FIXME: do the work, final continuation with call to: |
790 | client_send_response (pm, | 1027 | client_send_response (pm, |
791 | GNUNET_NO, | 1028 | GNUNET_NO, |
792 | 0); | 1029 | 0); |
@@ -930,6 +1167,7 @@ store_pi (void *cls) | |||
930 | ale->st = NULL; | 1167 | ale->st = NULL; |
931 | expiration = GNUNET_TIME_relative_to_absolute (ale->expiration); | 1168 | expiration = GNUNET_TIME_relative_to_absolute (ale->expiration); |
932 | GNUNET_HELLO_sign_address (ale->address, | 1169 | GNUNET_HELLO_sign_address (ale->address, |
1170 | ale->nt, | ||
933 | expiration, | 1171 | expiration, |
934 | GST_my_private_key, | 1172 | GST_my_private_key, |
935 | &addr, | 1173 | &addr, |
@@ -1123,7 +1361,7 @@ handle_add_queue_message (void *cls, | |||
1123 | struct Queue *queue; | 1361 | struct Queue *queue; |
1124 | struct Neighbour *neighbour; | 1362 | struct Neighbour *neighbour; |
1125 | const char *addr; | 1363 | const char *addr; |
1126 | uint16_t addr_len; | 1364 | uint16_t addr_len; |
1127 | 1365 | ||
1128 | neighbour = lookup_neighbour (&aqm->receiver); | 1366 | neighbour = lookup_neighbour (&aqm->receiver); |
1129 | if (NULL == neighbour) | 1367 | if (NULL == neighbour) |
@@ -1135,12 +1373,15 @@ handle_add_queue_message (void *cls, | |||
1135 | &neighbour->pid, | 1373 | &neighbour->pid, |
1136 | neighbour, | 1374 | neighbour, |
1137 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 1375 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
1138 | // FIXME: notify ATS/COREs/monitors! | 1376 | cores_send_connect_info (&neighbour->pid, |
1377 | GNUNET_BANDWIDTH_ZERO); | ||
1378 | // FIXME: notify ATS! | ||
1139 | } | 1379 | } |
1140 | addr_len = ntohs (aqm->header.size) - sizeof (*aqm); | 1380 | addr_len = ntohs (aqm->header.size) - sizeof (*aqm); |
1141 | addr = (const char *) &aqm[1]; | 1381 | addr = (const char *) &aqm[1]; |
1142 | 1382 | ||
1143 | queue = GNUNET_malloc (sizeof (struct Queue) + addr_len); | 1383 | queue = GNUNET_malloc (sizeof (struct Queue) + addr_len); |
1384 | queue->mtu = ntohl (aqm->mtu); | ||
1144 | queue->qid = aqm->qid; | 1385 | queue->qid = aqm->qid; |
1145 | queue->nt = (enum GNUNET_ATS_Network_Type) ntohl (aqm->nt); | 1386 | queue->nt = (enum GNUNET_ATS_Network_Type) ntohl (aqm->nt); |
1146 | queue->tc = tc; | 1387 | queue->tc = tc; |
@@ -1149,6 +1390,17 @@ handle_add_queue_message (void *cls, | |||
1149 | memcpy (&queue[1], | 1390 | memcpy (&queue[1], |
1150 | addr, | 1391 | addr, |
1151 | addr_len); | 1392 | addr_len); |
1393 | /* notify monitors about new queue */ | ||
1394 | { | ||
1395 | struct MonitorEvent me = { | ||
1396 | .cs = (enum GNUNET_TRANSPORT_ConnectionStatus) ntohl (aqm->cs) | ||
1397 | }; | ||
1398 | |||
1399 | notify_monitors (&neighbour->pid, | ||
1400 | queue->address, | ||
1401 | queue->nt, | ||
1402 | &me); | ||
1403 | } | ||
1152 | GNUNET_CONTAINER_MDLL_insert (neighbour, | 1404 | GNUNET_CONTAINER_MDLL_insert (neighbour, |
1153 | neighbour->queue_head, | 1405 | neighbour->queue_head, |
1154 | neighbour->queue_tail, | 1406 | neighbour->queue_tail, |
@@ -1244,6 +1496,8 @@ handle_monitor_start (void *cls, | |||
1244 | tc->details.monitor.peer = start->peer; | 1496 | tc->details.monitor.peer = start->peer; |
1245 | tc->details.monitor.one_shot = ntohl (start->one_shot); | 1497 | tc->details.monitor.one_shot = ntohl (start->one_shot); |
1246 | // FIXME: do work! | 1498 | // FIXME: do work! |
1499 | |||
1500 | GNUNET_SERVICE_client_mark_monitor (tc->client); | ||
1247 | GNUNET_SERVICE_client_continue (tc->client); | 1501 | GNUNET_SERVICE_client_continue (tc->client); |
1248 | } | 1502 | } |
1249 | 1503 | ||
@@ -1286,10 +1540,6 @@ do_shutdown (void *cls) | |||
1286 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, | 1540 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, |
1287 | &free_neighbour_cb, | 1541 | &free_neighbour_cb, |
1288 | NULL); | 1542 | NULL); |
1289 | /* FIXME: if this assertion fails (likely!), make sure we | ||
1290 | clean up clients *before* doing the rest of the | ||
1291 | shutdown! (i.e. by scheduling rest asynchronously!) */ | ||
1292 | GNUNET_assert (NULL == clients_head); | ||
1293 | if (NULL != peerstore) | 1543 | if (NULL != peerstore) |
1294 | { | 1544 | { |
1295 | GNUNET_PEERSTORE_disconnect (peerstore, | 1545 | GNUNET_PEERSTORE_disconnect (peerstore, |
@@ -1362,7 +1612,7 @@ run (void *cls, | |||
1362 | */ | 1612 | */ |
1363 | GNUNET_SERVICE_MAIN | 1613 | GNUNET_SERVICE_MAIN |
1364 | ("transport", | 1614 | ("transport", |
1365 | GNUNET_SERVICE_OPTION_NONE, | 1615 | GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN, |
1366 | &run, | 1616 | &run, |
1367 | &client_connect_cb, | 1617 | &client_connect_cb, |
1368 | &client_disconnect_cb, | 1618 | &client_disconnect_cb, |
diff --git a/src/transport/transport.h b/src/transport/transport.h index 423d3cefa..e8c276342 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h | |||
@@ -800,7 +800,15 @@ struct GNUNET_TRANSPORT_AddQueueMessage | |||
800 | */ | 800 | */ |
801 | uint32_t nt; | 801 | uint32_t nt; |
802 | 802 | ||
803 | // FIXME: add MTU? | 803 | /** |
804 | * Maximum transmission unit, in NBO. UINT32_MAX for unlimited. | ||
805 | */ | ||
806 | uint32_t mtu; | ||
807 | |||
808 | /** | ||
809 | * An `enum GNUNET_TRANSPORT_ConnectionStatus` in NBO. | ||
810 | */ | ||
811 | uint32_t cs; | ||
804 | 812 | ||
805 | /* followed by UTF-8 encoded, 0-terminated human-readable address */ | 813 | /* followed by UTF-8 encoded, 0-terminated human-readable address */ |
806 | }; | 814 | }; |
@@ -992,9 +1000,9 @@ struct GNUNET_TRANSPORT_MonitorData | |||
992 | struct GNUNET_TIME_RelativeNBO rtt; | 1000 | struct GNUNET_TIME_RelativeNBO rtt; |
993 | 1001 | ||
994 | /** | 1002 | /** |
995 | * Is inbound (in NBO). | 1003 | * Connection status (in NBO). |
996 | */ | 1004 | */ |
997 | uint32_t is_inbound GNUNET_PACKED; | 1005 | uint32_t cs GNUNET_PACKED; |
998 | 1006 | ||
999 | /** | 1007 | /** |
1000 | * Messages pending (in NBO). | 1008 | * Messages pending (in NBO). |
@@ -1006,9 +1014,7 @@ struct GNUNET_TRANSPORT_MonitorData | |||
1006 | */ | 1014 | */ |
1007 | uint32_t num_bytes_pending GNUNET_PACKED; | 1015 | uint32_t num_bytes_pending GNUNET_PACKED; |
1008 | 1016 | ||
1009 | /* Followed by 0-terminated address of the peer | 1017 | /* Followed by 0-terminated address of the peer */ |
1010 | (TODO: do we allow no address? If so, | ||
1011 | adjust transport_api2_monitor!) */ | ||
1012 | 1018 | ||
1013 | }; | 1019 | }; |
1014 | 1020 | ||
diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c index 3a68c6eba..6704f0cd8 100644 --- a/src/transport/transport_api2_communication.c +++ b/src/transport/transport_api2_communication.c | |||
@@ -193,11 +193,6 @@ struct GNUNET_TRANSPORT_CommunicatorHandle | |||
193 | uint64_t fc_gen; | 193 | uint64_t fc_gen; |
194 | 194 | ||
195 | /** | 195 | /** |
196 | * MTU of the communicator | ||
197 | */ | ||
198 | size_t mtu; | ||
199 | |||
200 | /** | ||
201 | * Internal UUID for the address used in communication with the | 196 | * Internal UUID for the address used in communication with the |
202 | * transport service. | 197 | * transport service. |
203 | */ | 198 | */ |
@@ -249,6 +244,11 @@ struct GNUNET_TRANSPORT_QueueHandle | |||
249 | enum GNUNET_ATS_Network_Type nt; | 244 | enum GNUNET_ATS_Network_Type nt; |
250 | 245 | ||
251 | /** | 246 | /** |
247 | * Communication status of the queue. | ||
248 | */ | ||
249 | enum GNUNET_TRANSPORT_ConnectionStatus cs; | ||
250 | |||
251 | /** | ||
252 | * The queue itself. | 252 | * The queue itself. |
253 | */ | 253 | */ |
254 | struct GNUNET_MQ_Handle *mq; | 254 | struct GNUNET_MQ_Handle *mq; |
@@ -257,6 +257,11 @@ struct GNUNET_TRANSPORT_QueueHandle | |||
257 | * ID for this queue when talking to the transport service. | 257 | * ID for this queue when talking to the transport service. |
258 | */ | 258 | */ |
259 | uint32_t queue_id; | 259 | uint32_t queue_id; |
260 | |||
261 | /** | ||
262 | * Maximum transmission unit for the queue. | ||
263 | */ | ||
264 | uint32_t mtu; | ||
260 | 265 | ||
261 | }; | 266 | }; |
262 | 267 | ||
@@ -383,9 +388,11 @@ send_add_queue (struct GNUNET_TRANSPORT_QueueHandle *qh) | |||
383 | env = GNUNET_MQ_msg_extra (aqm, | 388 | env = GNUNET_MQ_msg_extra (aqm, |
384 | strlen (qh->address) + 1, | 389 | strlen (qh->address) + 1, |
385 | GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP); | 390 | GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP); |
391 | aqm->qid = htonl (qh->queue_id); | ||
386 | aqm->receiver = qh->peer; | 392 | aqm->receiver = qh->peer; |
387 | aqm->nt = htonl ((uint32_t) qh->nt); | 393 | aqm->nt = htonl ((uint32_t) qh->nt); |
388 | aqm->qid = htonl (qh->queue_id); | 394 | aqm->mtu = htonl (qh->mtu); |
395 | aqm->cs = htonl ((uint32_t) qh->cs); | ||
389 | memcpy (&aqm[1], | 396 | memcpy (&aqm[1], |
390 | qh->address, | 397 | qh->address, |
391 | strlen (qh->address) + 1); | 398 | strlen (qh->address) + 1); |
@@ -776,7 +783,6 @@ struct GNUNET_TRANSPORT_CommunicatorHandle * | |||
776 | GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 783 | GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
777 | const char *config_section, | 784 | const char *config_section, |
778 | const char *addr_prefix, | 785 | const char *addr_prefix, |
779 | size_t mtu, | ||
780 | GNUNET_TRANSPORT_CommunicatorMqInit mq_init, | 786 | GNUNET_TRANSPORT_CommunicatorMqInit mq_init, |
781 | void *mq_init_cls) | 787 | void *mq_init_cls) |
782 | { | 788 | { |
@@ -786,7 +792,6 @@ GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle | |||
786 | ch->cfg = cfg; | 792 | ch->cfg = cfg; |
787 | ch->config_section = config_section; | 793 | ch->config_section = config_section; |
788 | ch->addr_prefix = addr_prefix; | 794 | ch->addr_prefix = addr_prefix; |
789 | ch->mtu = mtu; | ||
790 | ch->mq_init = mq_init; | 795 | ch->mq_init = mq_init; |
791 | ch->mq_init_cls = mq_init_cls; | 796 | ch->mq_init_cls = mq_init_cls; |
792 | reconnect (ch); | 797 | reconnect (ch); |
@@ -910,7 +915,10 @@ GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandl | |||
910 | * @param ch connection to transport service | 915 | * @param ch connection to transport service |
911 | * @param peer peer with which we can now communicate | 916 | * @param peer peer with which we can now communicate |
912 | * @param address address in human-readable format, 0-terminated, UTF-8 | 917 | * @param address address in human-readable format, 0-terminated, UTF-8 |
918 | * @param mtu maximum message size supported by queue, 0 if | ||
919 | * sending is not supported, SIZE_MAX for no MTU | ||
913 | * @param nt which network type does the @a address belong to? | 920 | * @param nt which network type does the @a address belong to? |
921 | * @param cs what is the connection status of the queue? | ||
914 | * @param mq message queue of the @a peer | 922 | * @param mq message queue of the @a peer |
915 | * @return API handle identifying the new MQ | 923 | * @return API handle identifying the new MQ |
916 | */ | 924 | */ |
@@ -918,7 +926,9 @@ struct GNUNET_TRANSPORT_QueueHandle * | |||
918 | GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, | 926 | GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, |
919 | const struct GNUNET_PeerIdentity *peer, | 927 | const struct GNUNET_PeerIdentity *peer, |
920 | const char *address, | 928 | const char *address, |
929 | uint32_t mtu, | ||
921 | enum GNUNET_ATS_Network_Type nt, | 930 | enum GNUNET_ATS_Network_Type nt, |
931 | enum GNUNET_TRANSPORT_ConnectionStatus cs, | ||
922 | struct GNUNET_MQ_Handle *mq) | 932 | struct GNUNET_MQ_Handle *mq) |
923 | { | 933 | { |
924 | struct GNUNET_TRANSPORT_QueueHandle *qh; | 934 | struct GNUNET_TRANSPORT_QueueHandle *qh; |
@@ -928,6 +938,8 @@ GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle | |||
928 | qh->peer = *peer; | 938 | qh->peer = *peer; |
929 | qh->address = GNUNET_strdup (address); | 939 | qh->address = GNUNET_strdup (address); |
930 | qh->nt = nt; | 940 | qh->nt = nt; |
941 | qh->mtu = mtu; | ||
942 | qh->cs = cs; | ||
931 | qh->mq = mq; | 943 | qh->mq = mq; |
932 | qh->queue_id = ch->queue_gen++; | 944 | qh->queue_id = ch->queue_gen++; |
933 | GNUNET_CONTAINER_DLL_insert (ch->queue_head, | 945 | GNUNET_CONTAINER_DLL_insert (ch->queue_head, |
diff --git a/src/transport/transport_api2_monitor.c b/src/transport/transport_api2_monitor.c index d7b13ec74..3798296c1 100644 --- a/src/transport/transport_api2_monitor.c +++ b/src/transport/transport_api2_monitor.c | |||
@@ -175,7 +175,7 @@ handle_monitor_data (void *cls, | |||
175 | 175 | ||
176 | mi.address = (const char *) &md[1]; | 176 | mi.address = (const char *) &md[1]; |
177 | mi.nt = (enum GNUNET_ATS_Network_Type) ntohl (md->nt); | 177 | mi.nt = (enum GNUNET_ATS_Network_Type) ntohl (md->nt); |
178 | mi.is_inbound = (int) ntohl (md->is_inbound); | 178 | mi.cs = (enum GNUNET_TRANSPORT_ConnectionStatus) ntohl (md->cs); |
179 | mi.num_msg_pending = ntohl (md->num_msg_pending); | 179 | mi.num_msg_pending = ntohl (md->num_msg_pending); |
180 | mi.num_bytes_pending = ntohl (md->num_bytes_pending); | 180 | mi.num_bytes_pending = ntohl (md->num_bytes_pending); |
181 | mi.last_validation = GNUNET_TIME_absolute_ntoh (md->last_validation); | 181 | mi.last_validation = GNUNET_TIME_absolute_ntoh (md->last_validation); |