Change packet id to uint64_t.

This commit is contained in:
2019-10-12 22:09:27 +01:00
parent a5727168ef
commit c21e16711b
2 changed files with 5 additions and 5 deletions

View File

@@ -22,7 +22,7 @@
#define DICMOTE_NAME "DiscImageChef Remote Server"
#define DICMOTE_VERSION "0.99"
#define DICMOTE_PORT 6666
#define DICMOTE_PACKET_ID "DICPACKT"
#define DICMOTE_PACKET_ID 0x6873678065677584 // "DICPACKT"
#define DICMOTE_PACKET_VERSION 1
#define DICMOTE_PACKET_TYPE_HELLO 1
#define DICMOTE_PROTOCOL_MAX 1
@@ -31,7 +31,7 @@
typedef struct
{
char id[8];
uint64_t id;
uint32_t len;
uint8_t version;
uint8_t packet_type;

6
main.c
View File

@@ -132,7 +132,7 @@ int main()
memset(pkt_server_hello, 0, sizeof(DicPacketHello));
strncpy(pkt_server_hello->hdr.id, DICMOTE_PACKET_ID, sizeof(DICMOTE_PACKET_ID));
pkt_server_hello->hdr.id = DICMOTE_PACKET_ID;
pkt_server_hello->hdr.len = sizeof(DicPacketHello);
pkt_server_hello->hdr.version = DICMOTE_PACKET_VERSION;
pkt_server_hello->hdr.packet_type = DICMOTE_PACKET_TYPE_HELLO;
@@ -178,7 +178,7 @@ int main()
return 0;
}
if(strncmp(pkt_hdr->id, DICMOTE_PACKET_ID, sizeof(DICMOTE_PACKET_ID)) != 0)
if(pkt_hdr->id != DICMOTE_PACKET_ID)
{
printf("Received data is not a correct dicremote packet, exiting...\n");
close(cli_sock);
@@ -238,7 +238,7 @@ int main()
pkt_client_hello->sysname,
pkt_client_hello->release,
pkt_client_hello->machine);
printf("Client maximum protocol: %d", pkt_client_hello->max_protocol);
printf("Client maximum protocol: %d\n", pkt_client_hello->max_protocol);
printf("Closing socket.\n");
close(cli_sock);