summaryrefslogtreecommitdiff
path: root/core.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--core.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/core.h b/core.h
index e38d0f6..a01904d 100644
--- a/core.h
+++ b/core.h
@@ -10,6 +10,10 @@
#define SESSION_KEY_SIZE 16
+#define PROTOCOL_VERSION 1
+
+#define SERVE_VIA_TLS false
+
struct SocketRWCommon {
Buffer inputBuf, outputBuf;
@@ -41,7 +45,17 @@ private:
struct Packet {
- int type;
+ enum Type {
+ T_OUT_OF_BAND_FLAG = 0x8000,
+
+ C2B_OOB_LOGIN = 0x8001,
+
+ B2C_OOB_LOGIN_SUCCESS = 0x8001,
+ B2C_OOB_LOGIN_FAILED = 0x8002,
+ B2C_OOB_SESSION_RESUMED = 0x8003,
+ };
+
+ Type type;
int id;
Buffer data;
};
@@ -65,14 +79,18 @@ struct Client : SocketRWCommon {
void startService(int _sock, bool withTls);
void close();
+ void sendPacket(Packet::Type type, const Buffer &data, bool allowUnauthed = false);
+
private:
int readBufPosition;
void processReadBuffer();
+ void handlePacket(Packet::Type type, char *data, int size);
void handleLine(char *line, int size);
void generateSessionKey();
-
- void stealConnection(Client *other);
+ void resumeSession(Client *other, int lastReceivedByClient);
+ void sendPacketOverWire(const Packet *packet);
+ void clearCachedPackets(int maxID);
};
struct Server : SocketRWCommon {