diff options
Diffstat (limited to 'src/psycutil/psyc_message.c')
-rw-r--r-- | src/psycutil/psyc_message.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/psycutil/psyc_message.c b/src/psycutil/psyc_message.c index f75a809ef..e16a4e859 100644 --- a/src/psycutil/psyc_message.c +++ b/src/psycutil/psyc_message.c | |||
@@ -879,11 +879,10 @@ static void | |||
879 | recv_error (struct GNUNET_PSYC_ReceiveHandle *recv) | 879 | recv_error (struct GNUNET_PSYC_ReceiveHandle *recv) |
880 | { | 880 | { |
881 | if (NULL != recv->message_part_cb) | 881 | if (NULL != recv->message_part_cb) |
882 | recv->message_part_cb (recv->cb_cls, NULL, recv->message_id, recv->flags, | 882 | recv->message_part_cb (recv->cb_cls, NULL, NULL); |
883 | 0, NULL); | ||
884 | 883 | ||
885 | if (NULL != recv->message_cb) | 884 | if (NULL != recv->message_cb) |
886 | recv->message_cb (recv->cb_cls, recv->message_id, recv->flags, NULL); | 885 | recv->message_cb (recv->cb_cls, NULL); |
887 | 886 | ||
888 | GNUNET_PSYC_receive_reset (recv); | 887 | GNUNET_PSYC_receive_reset (recv); |
889 | } | 888 | } |
@@ -904,7 +903,6 @@ GNUNET_PSYC_receive_message (struct GNUNET_PSYC_ReceiveHandle *recv, | |||
904 | { | 903 | { |
905 | uint16_t size = ntohs (msg->header.size); | 904 | uint16_t size = ntohs (msg->header.size); |
906 | uint32_t flags = ntohl (msg->flags); | 905 | uint32_t flags = ntohl (msg->flags); |
907 | uint64_t message_id; | ||
908 | 906 | ||
909 | GNUNET_PSYC_log_message (GNUNET_ERROR_TYPE_DEBUG, | 907 | GNUNET_PSYC_log_message (GNUNET_ERROR_TYPE_DEBUG, |
910 | (struct GNUNET_MessageHeader *) msg); | 908 | (struct GNUNET_MessageHeader *) msg); |
@@ -936,7 +934,6 @@ GNUNET_PSYC_receive_message (struct GNUNET_PSYC_ReceiveHandle *recv, | |||
936 | recv_error (recv); | 934 | recv_error (recv); |
937 | return GNUNET_SYSERR; | 935 | return GNUNET_SYSERR; |
938 | } | 936 | } |
939 | message_id = recv->message_id; | ||
940 | 937 | ||
941 | uint16_t pos = 0, psize = 0, ptype, size_eq, size_min; | 938 | uint16_t pos = 0, psize = 0, ptype, size_eq, size_min; |
942 | 939 | ||
@@ -1099,10 +1096,7 @@ GNUNET_PSYC_receive_message (struct GNUNET_PSYC_ReceiveHandle *recv, | |||
1099 | } | 1096 | } |
1100 | 1097 | ||
1101 | if (NULL != recv->message_part_cb) | 1098 | if (NULL != recv->message_part_cb) |
1102 | recv->message_part_cb (recv->cb_cls, &recv->slave_pub_key, | 1099 | recv->message_part_cb (recv->cb_cls, msg, pmsg); |
1103 | recv->message_id, recv->flags, | ||
1104 | GNUNET_ntohll (msg->fragment_offset), | ||
1105 | pmsg); | ||
1106 | 1100 | ||
1107 | switch (ptype) | 1101 | switch (ptype) |
1108 | { | 1102 | { |
@@ -1114,7 +1108,7 @@ GNUNET_PSYC_receive_message (struct GNUNET_PSYC_ReceiveHandle *recv, | |||
1114 | } | 1108 | } |
1115 | 1109 | ||
1116 | if (NULL != recv->message_cb) | 1110 | if (NULL != recv->message_cb) |
1117 | recv->message_cb (recv->cb_cls, message_id, flags, msg); | 1111 | recv->message_cb (recv->cb_cls, msg); |
1118 | return GNUNET_OK; | 1112 | return GNUNET_OK; |
1119 | } | 1113 | } |
1120 | 1114 | ||
@@ -1180,23 +1174,22 @@ struct ParseMessageClosure | |||
1180 | 1174 | ||
1181 | static void | 1175 | static void |
1182 | parse_message_part_cb (void *cls, | 1176 | parse_message_part_cb (void *cls, |
1183 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_pub_key, | 1177 | const struct GNUNET_PSYC_MessageHeader *msg, |
1184 | uint64_t message_id, uint32_t flags, uint64_t fragment_offset, | 1178 | const struct GNUNET_MessageHeader *pmsg) |
1185 | const struct GNUNET_MessageHeader *msg) | ||
1186 | { | 1179 | { |
1187 | struct ParseMessageClosure *pmc = cls; | 1180 | struct ParseMessageClosure *pmc = cls; |
1188 | if (NULL == msg) | 1181 | if (NULL == pmsg) |
1189 | { | 1182 | { |
1190 | pmc->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR; | 1183 | pmc->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR; |
1191 | return; | 1184 | return; |
1192 | } | 1185 | } |
1193 | 1186 | ||
1194 | switch (ntohs (msg->type)) | 1187 | switch (ntohs (pmsg->type)) |
1195 | { | 1188 | { |
1196 | case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD: | 1189 | case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD: |
1197 | { | 1190 | { |
1198 | struct GNUNET_PSYC_MessageMethod * | 1191 | struct GNUNET_PSYC_MessageMethod * |
1199 | pmeth = (struct GNUNET_PSYC_MessageMethod *) msg; | 1192 | pmeth = (struct GNUNET_PSYC_MessageMethod *) pmsg; |
1200 | *pmc->method_name = (const char *) &pmeth[1]; | 1193 | *pmc->method_name = (const char *) &pmeth[1]; |
1201 | pmc->msg_state = GNUNET_PSYC_MESSAGE_STATE_METHOD; | 1194 | pmc->msg_state = GNUNET_PSYC_MESSAGE_STATE_METHOD; |
1202 | break; | 1195 | break; |
@@ -1205,7 +1198,7 @@ parse_message_part_cb (void *cls, | |||
1205 | case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER: | 1198 | case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER: |
1206 | { | 1199 | { |
1207 | struct GNUNET_PSYC_MessageModifier * | 1200 | struct GNUNET_PSYC_MessageModifier * |
1208 | pmod = (struct GNUNET_PSYC_MessageModifier *) msg; | 1201 | pmod = (struct GNUNET_PSYC_MessageModifier *) pmsg; |
1209 | 1202 | ||
1210 | const char *name = (const char *) &pmod[1]; | 1203 | const char *name = (const char *) &pmod[1]; |
1211 | const void *value = name + ntohs (pmod->name_size); | 1204 | const void *value = name + ntohs (pmod->name_size); |
@@ -1216,8 +1209,8 @@ parse_message_part_cb (void *cls, | |||
1216 | } | 1209 | } |
1217 | 1210 | ||
1218 | case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_DATA: | 1211 | case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_DATA: |
1219 | *pmc->data = &msg[1]; | 1212 | *pmc->data = &pmsg[1]; |
1220 | *pmc->data_size = ntohs (msg->size) - sizeof (*msg); | 1213 | *pmc->data_size = ntohs (pmsg->size) - sizeof (*pmsg); |
1221 | pmc->msg_state = GNUNET_PSYC_MESSAGE_STATE_DATA; | 1214 | pmc->msg_state = GNUNET_PSYC_MESSAGE_STATE_DATA; |
1222 | break; | 1215 | break; |
1223 | 1216 | ||
@@ -1241,7 +1234,7 @@ parse_message_part_cb (void *cls, | |||
1241 | * @param env | 1234 | * @param env |
1242 | * The environment for the message with a list of modifiers. | 1235 | * The environment for the message with a list of modifiers. |
1243 | * @param[out] data | 1236 | * @param[out] data |
1244 | * Pointer to data inside @a pmsg. | 1237 | * Pointer to data inside @a msg. |
1245 | * @param[out] data_size | 1238 | * @param[out] data_size |
1246 | * Size of @data is written here. | 1239 | * Size of @data is written here. |
1247 | * | 1240 | * |