diff --git a/dicmote.h b/dicmote.h index 77a1858..b4f057c 100644 --- a/dicmote.h +++ b/dicmote.h @@ -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; diff --git a/main.c b/main.c index 6e351fa..9c244f6 100644 --- a/main.c +++ b/main.c @@ -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);