diff options
Diffstat (limited to 'core/Lossless_UDP.c')
-rw-r--r-- | core/Lossless_UDP.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/core/Lossless_UDP.c b/core/Lossless_UDP.c index 3a289735..002e2cf8 100644 --- a/core/Lossless_UDP.c +++ b/core/Lossless_UDP.c | |||
@@ -555,7 +555,7 @@ static int send_DATA(uint32_t connection_id) | |||
555 | 555 | ||
556 | 556 | ||
557 | /* Return 0 if handled correctly, 1 if packet is bad. */ | 557 | /* Return 0 if handled correctly, 1 if packet is bad. */ |
558 | static int handle_handshake(uint8_t * packet, uint32_t length, IP_Port source) | 558 | static int handle_handshake(IP_Port source, uint8_t * packet, uint32_t length) |
559 | { | 559 | { |
560 | if (length != (1 + 4 + 4)) | 560 | if (length != (1 + 4 + 4)) |
561 | return 1; | 561 | return 1; |
@@ -669,7 +669,7 @@ static int handle_SYNC3(int connection_id, uint8_t counter, uint32_t recv_packet | |||
669 | return 1; | 669 | return 1; |
670 | } | 670 | } |
671 | 671 | ||
672 | static int handle_SYNC(uint8_t *packet, uint32_t length, IP_Port source) | 672 | static int handle_SYNC(IP_Port source, uint8_t *packet, uint32_t length) |
673 | { | 673 | { |
674 | 674 | ||
675 | if (!SYNC_valid(length)) | 675 | if (!SYNC_valid(length)) |
@@ -742,7 +742,7 @@ static int add_recv(int connection_id, uint32_t data_num, uint8_t *data, uint16_ | |||
742 | return 0; | 742 | return 0; |
743 | } | 743 | } |
744 | 744 | ||
745 | static int handle_data(uint8_t *packet, uint32_t length, IP_Port source) | 745 | static int handle_data(IP_Port source, uint8_t *packet, uint32_t length) |
746 | { | 746 | { |
747 | int connection = getconnection_id(source); | 747 | int connection = getconnection_id(source); |
748 | 748 | ||
@@ -770,23 +770,11 @@ static int handle_data(uint8_t *packet, uint32_t length, IP_Port source) | |||
770 | * END of packet handling functions | 770 | * END of packet handling functions |
771 | */ | 771 | */ |
772 | 772 | ||
773 | int LosslessUDP_handlepacket(uint8_t *packet, uint32_t length, IP_Port source) | 773 | void LosslessUDP_init(void) |
774 | { | 774 | { |
775 | switch (packet[0]) { | 775 | networking_registerhandler(16, &handle_handshake); |
776 | case 16: | 776 | networking_registerhandler(17, &handle_SYNC); |
777 | return handle_handshake(packet, length, source); | 777 | networking_registerhandler(18, &handle_data); |
778 | |||
779 | case 17: | ||
780 | return handle_SYNC(packet, length, source); | ||
781 | |||
782 | case 18: | ||
783 | return handle_data(packet, length, source); | ||
784 | |||
785 | default: | ||
786 | return 1; | ||
787 | } | ||
788 | |||
789 | return 0; | ||
790 | } | 778 | } |
791 | 779 | ||
792 | /* | 780 | /* |