diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-11-06 16:55:50 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-11-06 16:55:50 +0000 |
commit | 76da3738775753c42edcded3e35af3bd2982f931 (patch) | |
tree | 745b7f815a48faeb820d5ddaf5fc2fdf5f80b547 /src/set | |
parent | 5310fb25952d264f06316e7f19511240fb664091 (diff) | |
download | gnunet-76da3738775753c42edcded3e35af3bd2982f931.tar.gz gnunet-76da3738775753c42edcded3e35af3bd2982f931.zip |
dokumentation monster session part 1
Diffstat (limited to 'src/set')
-rw-r--r-- | src/set/gnunet-service-set.c | 140 |
1 files changed, 92 insertions, 48 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c index 7eb3fdb30..3c460a02b 100644 --- a/src/set/gnunet-service-set.c +++ b/src/set/gnunet-service-set.c | |||
@@ -362,6 +362,7 @@ set_destroy (struct Set *set) | |||
362 | * The client's destroy callback will destroy the set again. | 362 | * The client's destroy callback will destroy the set again. |
363 | * We do this so that the tunnel end handler still has a valid set handle | 363 | * We do this so that the tunnel end handler still has a valid set handle |
364 | * to destroy. */ | 364 | * to destroy. */ |
365 | // TODO: use client context | ||
365 | if (NULL != set->client) | 366 | if (NULL != set->client) |
366 | { | 367 | { |
367 | struct GNUNET_SERVER_Client *client = set->client; | 368 | struct GNUNET_SERVER_Client *client = set->client; |
@@ -397,8 +398,7 @@ set_destroy (struct Set *set) | |||
397 | 398 | ||
398 | 399 | ||
399 | /** | 400 | /** |
400 | * Clean up after a client after it is | 401 | * Clean up after a client has disconnected |
401 | * disconnected (either by us or by itself) | ||
402 | * | 402 | * |
403 | * @param cls closure, unused | 403 | * @param cls closure, unused |
404 | * @param client the client to clean up after | 404 | * @param client the client to clean up after |
@@ -436,7 +436,6 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | |||
436 | static void | 436 | static void |
437 | incoming_destroy (struct Operation *incoming) | 437 | incoming_destroy (struct Operation *incoming) |
438 | { | 438 | { |
439 | GNUNET_assert (GNUNET_YES == incoming->is_incoming); | ||
440 | GNUNET_CONTAINER_DLL_remove (incoming_head, incoming_tail, incoming); | 439 | GNUNET_CONTAINER_DLL_remove (incoming_head, incoming_tail, incoming); |
441 | if (GNUNET_SCHEDULER_NO_TASK != incoming->state->timeout_task) | 440 | if (GNUNET_SCHEDULER_NO_TASK != incoming->state->timeout_task) |
442 | { | 441 | { |
@@ -446,12 +445,15 @@ incoming_destroy (struct Operation *incoming) | |||
446 | GNUNET_free (incoming->state); | 445 | GNUNET_free (incoming->state); |
447 | } | 446 | } |
448 | 447 | ||
448 | /** | ||
449 | * remove & free state of the operation from the incoming list | ||
450 | * | ||
451 | * @param incoming the element to remove | ||
452 | */ | ||
449 | 453 | ||
450 | static void | 454 | static void |
451 | incoming_retire (struct Operation *incoming) | 455 | incoming_retire (struct Operation *incoming) |
452 | { | 456 | { |
453 | GNUNET_assert (NULL != incoming->spec); | ||
454 | GNUNET_assert (GNUNET_YES == incoming->is_incoming); | ||
455 | incoming->is_incoming = GNUNET_NO; | 457 | incoming->is_incoming = GNUNET_NO; |
456 | GNUNET_free (incoming->state); | 458 | GNUNET_free (incoming->state); |
457 | incoming->state = NULL; | 459 | incoming->state = NULL; |
@@ -506,6 +508,7 @@ incoming_suggest (struct Operation *incoming, struct Listener *listener) | |||
506 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != incoming->state->timeout_task); | 508 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != incoming->state->timeout_task); |
507 | GNUNET_SCHEDULER_cancel (incoming->state->timeout_task); | 509 | GNUNET_SCHEDULER_cancel (incoming->state->timeout_task); |
508 | incoming->state->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 510 | incoming->state->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
511 | |||
509 | mqm = GNUNET_MQ_msg_nested_mh (cmsg, GNUNET_MESSAGE_TYPE_SET_REQUEST, | 512 | mqm = GNUNET_MQ_msg_nested_mh (cmsg, GNUNET_MESSAGE_TYPE_SET_REQUEST, |
510 | incoming->spec->context_msg); | 513 | incoming->spec->context_msg); |
511 | GNUNET_assert (NULL != mqm); | 514 | GNUNET_assert (NULL != mqm); |
@@ -519,7 +522,11 @@ incoming_suggest (struct Operation *incoming, struct Listener *listener) | |||
519 | 522 | ||
520 | /** | 523 | /** |
521 | * Handle a request for a set operation from | 524 | * Handle a request for a set operation from |
522 | * another peer. | 525 | * another peer. |
526 | * | ||
527 | * This msg is expected as the first and only msg handled through the | ||
528 | * non-operation bound virtual table, acceptance of this operation replaces | ||
529 | * our virtual table and subsequent msgs would be routed differently. | ||
523 | * | 530 | * |
524 | * @param op the operation state | 531 | * @param op the operation state |
525 | * @param mh the received message | 532 | * @param mh the received message |
@@ -542,15 +549,16 @@ handle_incoming_msg (struct Operation *op, | |||
542 | return GNUNET_SYSERR; | 549 | return GNUNET_SYSERR; |
543 | } | 550 | } |
544 | 551 | ||
552 | /* double operation request */ | ||
545 | if (NULL != op->spec) | 553 | if (NULL != op->spec) |
546 | { | 554 | { |
547 | /* double operation request */ | ||
548 | GNUNET_break_op (0); | 555 | GNUNET_break_op (0); |
549 | return GNUNET_SYSERR; | 556 | return GNUNET_SYSERR; |
550 | } | 557 | } |
551 | 558 | ||
552 | spec = GNUNET_new (struct OperationSpecification); | 559 | spec = GNUNET_new (struct OperationSpecification); |
553 | spec->context_msg = GNUNET_MQ_extract_nested_mh (msg); | 560 | spec->context_msg = GNUNET_MQ_extract_nested_mh (msg); |
561 | // for simplicity we just backup the context msg instead of rebuilding it later on | ||
554 | if (NULL != spec->context_msg) | 562 | if (NULL != spec->context_msg) |
555 | spec->context_msg = GNUNET_copy_message (spec->context_msg); | 563 | spec->context_msg = GNUNET_copy_message (spec->context_msg); |
556 | spec->operation = ntohl (msg->operation); | 564 | spec->operation = ntohl (msg->operation); |
@@ -631,6 +639,7 @@ handle_client_iterate (void *cls, | |||
631 | { | 639 | { |
632 | struct Set *set; | 640 | struct Set *set; |
633 | 641 | ||
642 | // iterate over a non existing set | ||
634 | set = set_get (client); | 643 | set = set_get (client); |
635 | if (NULL == set) | 644 | if (NULL == set) |
636 | { | 645 | { |
@@ -639,6 +648,7 @@ handle_client_iterate (void *cls, | |||
639 | return; | 648 | return; |
640 | } | 649 | } |
641 | 650 | ||
651 | // only one concurrent iterate-action per set | ||
642 | if (NULL != set->iter) | 652 | if (NULL != set->iter) |
643 | { | 653 | { |
644 | GNUNET_break (0); | 654 | GNUNET_break (0); |
@@ -661,9 +671,9 @@ handle_client_iterate (void *cls, | |||
661 | * @param m message sent by the client | 671 | * @param m message sent by the client |
662 | */ | 672 | */ |
663 | static void | 673 | static void |
664 | handle_client_create (void *cls, | 674 | handle_client_create_set (void *cls, |
665 | struct GNUNET_SERVER_Client *client, | 675 | struct GNUNET_SERVER_Client *client, |
666 | const struct GNUNET_MessageHeader *m) | 676 | const struct GNUNET_MessageHeader *m) |
667 | { | 677 | { |
668 | struct GNUNET_SET_CreateMessage *msg = (struct GNUNET_SET_CreateMessage *) m; | 678 | struct GNUNET_SET_CreateMessage *msg = (struct GNUNET_SET_CreateMessage *) m; |
669 | struct Set *set; | 679 | struct Set *set; |
@@ -671,7 +681,8 @@ handle_client_create (void *cls, | |||
671 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client created new set (operation %u)\n", | 681 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client created new set (operation %u)\n", |
672 | ntohs (msg->operation)); | 682 | ntohs (msg->operation)); |
673 | 683 | ||
674 | if (NULL != set_get (client)) | 684 | // max. one set per client! |
685 | if (NULL != set_get (client)) | ||
675 | { | 686 | { |
676 | GNUNET_break (0); | 687 | GNUNET_break (0); |
677 | GNUNET_SERVER_client_disconnect (client); | 688 | GNUNET_SERVER_client_disconnect (client); |
@@ -682,18 +693,18 @@ handle_client_create (void *cls, | |||
682 | 693 | ||
683 | switch (ntohs (msg->operation)) | 694 | switch (ntohs (msg->operation)) |
684 | { | 695 | { |
685 | case GNUNET_SET_OPERATION_INTERSECTION: | 696 | case GNUNET_SET_OPERATION_INTERSECTION: |
686 | // FIXME: implement intersection vt | 697 | // FIXME: implement intersection vt |
687 | // set->vt = _GSS_intersection_vt (); | 698 | // set->vt = _GSS_intersection_vt (); |
688 | break; | 699 | break; |
689 | case GNUNET_SET_OPERATION_UNION: | 700 | case GNUNET_SET_OPERATION_UNION: |
690 | set->vt = _GSS_union_vt (); | 701 | set->vt = _GSS_union_vt (); |
691 | break; | 702 | break; |
692 | default: | 703 | default: |
693 | GNUNET_free (set); | 704 | GNUNET_free (set); |
694 | GNUNET_break (0); | 705 | GNUNET_break (0); |
695 | GNUNET_SERVER_client_disconnect (client); | 706 | GNUNET_SERVER_client_disconnect (client); |
696 | return; | 707 | return; |
697 | } | 708 | } |
698 | 709 | ||
699 | set->state = set->vt->create (); | 710 | set->state = set->vt->create (); |
@@ -721,12 +732,14 @@ handle_client_listen (void *cls, | |||
721 | struct Listener *listener; | 732 | struct Listener *listener; |
722 | struct Operation *op; | 733 | struct Operation *op; |
723 | 734 | ||
735 | // max. one per client! | ||
724 | if (NULL != listener_get (client)) | 736 | if (NULL != listener_get (client)) |
725 | { | 737 | { |
726 | GNUNET_break (0); | 738 | GNUNET_break (0); |
727 | GNUNET_SERVER_client_disconnect (client); | 739 | GNUNET_SERVER_client_disconnect (client); |
728 | return; | 740 | return; |
729 | } | 741 | } |
742 | |||
730 | listener = GNUNET_new (struct Listener); | 743 | listener = GNUNET_new (struct Listener); |
731 | listener->client = client; | 744 | listener->client = client; |
732 | listener->client_mq = GNUNET_MQ_queue_for_server_client (client); | 745 | listener->client_mq = GNUNET_MQ_queue_for_server_client (client); |
@@ -735,6 +748,7 @@ handle_client_listen (void *cls, | |||
735 | GNUNET_CONTAINER_DLL_insert_tail (listeners_head, listeners_tail, listener); | 748 | GNUNET_CONTAINER_DLL_insert_tail (listeners_head, listeners_tail, listener); |
736 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new listener created (op %u, app %s)\n", | 749 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new listener created (op %u, app %s)\n", |
737 | listener->operation, GNUNET_h2s (&listener->app_id)); | 750 | listener->operation, GNUNET_h2s (&listener->app_id)); |
751 | |||
738 | /* check for incoming requests the listener is interested in */ | 752 | /* check for incoming requests the listener is interested in */ |
739 | for (op = incoming_head; NULL != op; op = op->next) | 753 | for (op = incoming_head; NULL != op; op = op->next) |
740 | { | 754 | { |
@@ -762,8 +776,8 @@ handle_client_listen (void *cls, | |||
762 | 776 | ||
763 | 777 | ||
764 | /** | 778 | /** |
765 | * Called when the client wants to reject an operation | 779 | * Called when the listening client rejects an operation |
766 | * request from another peer. | 780 | * request by another peer. |
767 | * | 781 | * |
768 | * @param cls unused | 782 | * @param cls unused |
769 | * @param client client that sent the message | 783 | * @param client client that sent the message |
@@ -776,11 +790,11 @@ handle_client_reject (void *cls, | |||
776 | { | 790 | { |
777 | struct Operation *incoming; | 791 | struct Operation *incoming; |
778 | const struct GNUNET_SET_AcceptRejectMessage *msg; | 792 | const struct GNUNET_SET_AcceptRejectMessage *msg; |
779 | struct GNUNET_MESH_Tunnel *tunnel; | ||
780 | 793 | ||
781 | msg = (const struct GNUNET_SET_AcceptRejectMessage *) m; | 794 | msg = (const struct GNUNET_SET_AcceptRejectMessage *) m; |
782 | GNUNET_break (0 == ntohl (msg->request_id)); | 795 | GNUNET_break (0 == ntohl (msg->request_id)); |
783 | 796 | ||
797 | // no matching incoming operation for this reject | ||
784 | incoming = get_incoming (ntohl (msg->accept_reject_id)); | 798 | incoming = get_incoming (ntohl (msg->accept_reject_id)); |
785 | if (NULL == incoming) | 799 | if (NULL == incoming) |
786 | { | 800 | { |
@@ -788,11 +802,9 @@ handle_client_reject (void *cls, | |||
788 | return; | 802 | return; |
789 | } | 803 | } |
790 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer request rejected by client\n"); | 804 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer request rejected by client\n"); |
791 | /* set the incoming's tunnel to NULL so that we don't accidentally destroy | 805 | |
792 | * the tunnel again. */ | 806 | GNUNET_MESH_tunnel_destroy (incoming->tunnel); |
793 | tunnel = incoming->tunnel; | 807 | //tunnel destruction handler called immediately upon destruction |
794 | incoming->tunnel = NULL; | ||
795 | GNUNET_MESH_tunnel_destroy (tunnel); | ||
796 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 808 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
797 | } | 809 | } |
798 | 810 | ||
@@ -815,6 +827,7 @@ handle_client_add_remove (void *cls, | |||
815 | struct GNUNET_SET_Element el; | 827 | struct GNUNET_SET_Element el; |
816 | struct ElementEntry *ee; | 828 | struct ElementEntry *ee; |
817 | 829 | ||
830 | // client without a set requested an operation | ||
818 | set = set_get (client); | 831 | set = set_get (client); |
819 | if (NULL == set) | 832 | if (NULL == set) |
820 | { | 833 | { |
@@ -909,6 +922,8 @@ handle_client_evaluate (void *cls, | |||
909 | spec->result_mode = ntohs (msg->result_mode); | 922 | spec->result_mode = ntohs (msg->result_mode); |
910 | spec->client_request_id = ntohl (msg->request_id); | 923 | spec->client_request_id = ntohl (msg->request_id); |
911 | spec->context_msg = GNUNET_MQ_extract_nested_mh (msg); | 924 | spec->context_msg = GNUNET_MQ_extract_nested_mh (msg); |
925 | |||
926 | // for simplicity we just backup the context msg instead of rebuilding it later on | ||
912 | if (NULL != spec->context_msg) | 927 | if (NULL != spec->context_msg) |
913 | spec->context_msg = GNUNET_copy_message (spec->context_msg); | 928 | spec->context_msg = GNUNET_copy_message (spec->context_msg); |
914 | 929 | ||
@@ -931,8 +946,8 @@ handle_client_evaluate (void *cls, | |||
931 | 946 | ||
932 | 947 | ||
933 | /** | 948 | /** |
934 | * Handle an ack from a client. | 949 | * Handle an ack from a client, and send the next element. |
935 | * | 950 | * |
936 | * @param cls unused | 951 | * @param cls unused |
937 | * @param client the client | 952 | * @param client the client |
938 | * @param m the message | 953 | * @param m the message |
@@ -944,6 +959,7 @@ handle_client_iter_ack (void *cls, | |||
944 | { | 959 | { |
945 | struct Set *set; | 960 | struct Set *set; |
946 | 961 | ||
962 | // client without a set requested an operation | ||
947 | set = set_get (client); | 963 | set = set_get (client); |
948 | if (NULL == set) | 964 | if (NULL == set) |
949 | { | 965 | { |
@@ -952,6 +968,7 @@ handle_client_iter_ack (void *cls, | |||
952 | return; | 968 | return; |
953 | } | 969 | } |
954 | 970 | ||
971 | // client sent an ack, but we were not expecting one | ||
955 | if (NULL == set->iter) | 972 | if (NULL == set->iter) |
956 | { | 973 | { |
957 | GNUNET_break (0); | 974 | GNUNET_break (0); |
@@ -983,6 +1000,7 @@ handle_client_cancel (void *cls, | |||
983 | struct Operation *op; | 1000 | struct Operation *op; |
984 | int found; | 1001 | int found; |
985 | 1002 | ||
1003 | // client without a set requested an operation | ||
986 | set = set_get (client); | 1004 | set = set_get (client); |
987 | if (NULL == set) | 1005 | if (NULL == set) |
988 | { | 1006 | { |
@@ -1014,7 +1032,8 @@ handle_client_cancel (void *cls, | |||
1014 | /** | 1032 | /** |
1015 | * Handle a request from the client to accept | 1033 | * Handle a request from the client to accept |
1016 | * a set operation that came from a remote peer. | 1034 | * a set operation that came from a remote peer. |
1017 | * | 1035 | * We forward the accept to the associated operation for handling |
1036 | * | ||
1018 | * @param cls unused | 1037 | * @param cls unused |
1019 | * @param client the client | 1038 | * @param client the client |
1020 | * @param mh the message | 1039 | * @param mh the message |
@@ -1030,6 +1049,7 @@ handle_client_accept (void *cls, | |||
1030 | 1049 | ||
1031 | op = get_incoming (ntohl (msg->accept_reject_id)); | 1050 | op = get_incoming (ntohl (msg->accept_reject_id)); |
1032 | 1051 | ||
1052 | // incoming operation does not exist | ||
1033 | if (NULL == op) | 1053 | if (NULL == op) |
1034 | { | 1054 | { |
1035 | GNUNET_break (0); | 1055 | GNUNET_break (0); |
@@ -1041,8 +1061,9 @@ handle_client_accept (void *cls, | |||
1041 | 1061 | ||
1042 | GNUNET_assert (GNUNET_YES == op->is_incoming); | 1062 | GNUNET_assert (GNUNET_YES == op->is_incoming); |
1043 | 1063 | ||
1064 | // client without a set requested an operation | ||
1044 | set = set_get (client); | 1065 | set = set_get (client); |
1045 | 1066 | ||
1046 | if (NULL == set) | 1067 | if (NULL == set) |
1047 | { | 1068 | { |
1048 | GNUNET_break (0); | 1069 | GNUNET_break (0); |
@@ -1101,10 +1122,12 @@ shutdown_task (void *cls, | |||
1101 | 1122 | ||
1102 | 1123 | ||
1103 | /** | 1124 | /** |
1104 | * Handle an incoming peer timeout, that is, disconnect a peer if | 1125 | * Timeout happens iff: |
1105 | * has not requested an operation for some amount of time. | 1126 | * - we suggested an operation to our listener, |
1106 | * | 1127 | * but did not receive a response in time |
1107 | * @param cls closure | 1128 | * - we got the tunnel from a peer but no GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST |
1129 | * - shutdown (obviously) | ||
1130 | * @param cls tunnel context | ||
1108 | * @param tc context information (why was this task triggered now) | 1131 | * @param tc context information (why was this task triggered now) |
1109 | */ | 1132 | */ |
1110 | static void | 1133 | static void |
@@ -1123,9 +1146,17 @@ incoming_timeout_cb (void *cls, | |||
1123 | } | 1146 | } |
1124 | 1147 | ||
1125 | 1148 | ||
1149 | /** | ||
1150 | * Terminates an incoming operation in case we have not yet received an | ||
1151 | * operation request. Called by the tunnel destruction handler. | ||
1152 | * | ||
1153 | * @param op the tunnel context | ||
1154 | */ | ||
1126 | static void | 1155 | static void |
1127 | handle_incoming_disconnect (struct Operation *op) | 1156 | handle_incoming_disconnect (struct Operation *op) |
1128 | { | 1157 | { |
1158 | GNUNET_assert (GNUNET_YES == incoming->is_incoming); | ||
1159 | |||
1129 | if (NULL == op->tunnel) | 1160 | if (NULL == op->tunnel) |
1130 | return; | 1161 | return; |
1131 | 1162 | ||
@@ -1137,9 +1168,11 @@ handle_incoming_disconnect (struct Operation *op) | |||
1137 | * Method called whenever another peer has added us to a tunnel | 1168 | * Method called whenever another peer has added us to a tunnel |
1138 | * the other peer initiated. | 1169 | * the other peer initiated. |
1139 | * Only called (once) upon reception of data with a message type which was | 1170 | * Only called (once) upon reception of data with a message type which was |
1140 | * subscribed to in GNUNET_MESH_connect. A call to GNUNET_MESH_tunnel_destroy | 1171 | * subscribed to in GNUNET_MESH_connect. |
1141 | * causes te tunnel to be ignored and no further notifications are sent about | 1172 | * |
1142 | * the same tunnel. | 1173 | * The tunnel context represents the operation itself and gets added to a DLL, |
1174 | * from where it gets looked up when our local listener client responds | ||
1175 | * to a proposed/suggested operation or connects and associates with this operation. | ||
1143 | * | 1176 | * |
1144 | * @param cls closure | 1177 | * @param cls closure |
1145 | * @param tunnel new handle to the tunnel | 1178 | * @param tunnel new handle to the tunnel |
@@ -1183,6 +1216,13 @@ tunnel_new_cb (void *cls, | |||
1183 | * any associated state. | 1216 | * any associated state. |
1184 | * GNUNET_MESH_tunnel_destroy. It must NOT call GNUNET_MESH_tunnel_destroy on | 1217 | * GNUNET_MESH_tunnel_destroy. It must NOT call GNUNET_MESH_tunnel_destroy on |
1185 | * the tunnel. | 1218 | * the tunnel. |
1219 | * | ||
1220 | * The peer_disconnect function is part of a a virtual table set initially either | ||
1221 | * when a peer creates a new tunnel with us (tunnel_new_cb), or once we create | ||
1222 | * a new tunnel ourselves (evaluate). | ||
1223 | * | ||
1224 | * Once we know the exact type of operation (union/intersection), the vt is | ||
1225 | * replaced with an operation specific instance (_GSS_[op]_vt). | ||
1186 | * | 1226 | * |
1187 | * @param cls closure (set from GNUNET_MESH_connect) | 1227 | * @param cls closure (set from GNUNET_MESH_connect) |
1188 | * @param tunnel connection to the other end (henceforth invalid) | 1228 | * @param tunnel connection to the other end (henceforth invalid) |
@@ -1207,12 +1247,15 @@ tunnel_end_cb (void *cls, | |||
1207 | 1247 | ||
1208 | 1248 | ||
1209 | /** | 1249 | /** |
1210 | * Functions with this signature are called whenever a message is | 1250 | * Functions with this signature are called whenever any message is |
1211 | * received. | 1251 | * received via the mesh tunnel. |
1212 | * | 1252 | * |
1213 | * Each time the function must call GNUNET_MESH_receive_done on the tunnel | 1253 | * The msg_handler is a virtual table set in initially either when a peer |
1214 | * in order to receive the next message. This doesn't need to be immediate: | 1254 | * creates a new tunnel with us (tunnel_new_cb), or once we create a new tunnel |
1215 | * can be delayed if some processing is done on the message. | 1255 | * ourselves (evaluate). |
1256 | * | ||
1257 | * Once we know the exact type of operation (union/intersection), the vt is | ||
1258 | * replaced with an operation specific instance (_GSS_[op]_vt). | ||
1216 | * | 1259 | * |
1217 | * @param cls Closure (set from GNUNET_MESH_connect). | 1260 | * @param cls Closure (set from GNUNET_MESH_connect). |
1218 | * @param tunnel Connection to the other end. | 1261 | * @param tunnel Connection to the other end. |
@@ -1259,7 +1302,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1259 | sizeof (struct GNUNET_SET_AcceptRejectMessage)}, | 1302 | sizeof (struct GNUNET_SET_AcceptRejectMessage)}, |
1260 | {handle_client_iter_ack, NULL, GNUNET_MESSAGE_TYPE_SET_ITER_ACK, 0}, | 1303 | {handle_client_iter_ack, NULL, GNUNET_MESSAGE_TYPE_SET_ITER_ACK, 0}, |
1261 | {handle_client_add_remove, NULL, GNUNET_MESSAGE_TYPE_SET_ADD, 0}, | 1304 | {handle_client_add_remove, NULL, GNUNET_MESSAGE_TYPE_SET_ADD, 0}, |
1262 | {handle_client_create, NULL, GNUNET_MESSAGE_TYPE_SET_CREATE, | 1305 | {handle_client_create_set, NULL, GNUNET_MESSAGE_TYPE_SET_CREATE, |
1263 | sizeof (struct GNUNET_SET_CreateMessage)}, | 1306 | sizeof (struct GNUNET_SET_CreateMessage)}, |
1264 | {handle_client_iterate, NULL, GNUNET_MESSAGE_TYPE_SET_ITER_REQUEST, | 1307 | {handle_client_iterate, NULL, GNUNET_MESSAGE_TYPE_SET_ITER_REQUEST, |
1265 | sizeof (struct GNUNET_MessageHeader)}, | 1308 | sizeof (struct GNUNET_MessageHeader)}, |
@@ -1280,6 +1323,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1280 | {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_DONE, 0}, | 1323 | {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_DONE, 0}, |
1281 | {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS, 0}, | 1324 | {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS, 0}, |
1282 | {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_SE, 0}, | 1325 | {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_SE, 0}, |
1326 | {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF, 0}, | ||
1283 | {NULL, 0, 0} | 1327 | {NULL, 0, 0} |
1284 | }; | 1328 | }; |
1285 | static const uint32_t mesh_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0}; | 1329 | static const uint32_t mesh_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0}; |