Added some message types, removed protocolbuffer dependency and added msgpack dependency

This commit is contained in:
Tristan B. Velloza Kildaire 2022-01-11 10:33:15 +02:00
parent 7d096ce8f2
commit 1cf64931ff
2 changed files with 81 additions and 1 deletions

View File

@ -3,8 +3,11 @@
"Tristan B. Kildaire"
],
"copyright": "Copyright © 2021, Tristan B. Kildaire",
"dependencies": {
"msgpack-d": "~>1.0.3"
},
"description": "Client-side DNET API",
"license": "LGPLv2",
"name": "libdnet",
"targetType": "library"
}
}

77
source/libdnet/types.d Normal file
View File

@ -0,0 +1,77 @@
/**
* Type declarations
*/
module libdnet.types;
import msgpack;
/* TODO: Add structs here */
public enum HeaderType
{
CLIENT,
SERVER
}
/**
* Header format
*
* [ messageType | payload ]
*/
struct Header
{
/**
* Type of message
*
* How the `payload` should be
* interpreted
*/
HeaderType type;
/**
* Data of the message
*/
ubyte[] payload;
}
/**
* Server message
*
* TODO: Describe message
*/
struct ServerMessage
{
/* TODO: Populate */
}
/**
* ClientType
*
* The type of ClientMessage
*/
public enum ClientType
{
AUTH
}
/**
* Client message
*
* TODO: Describe message
*/
struct ClientMessage
{
/* TODO: Populate */
ClientType type;
ubyte[] payload;
}
struct AuthenticateMessage
{
string username;
string password;
}