aboutsummaryrefslogtreecommitdiff
path: root/src/include/opcodes.h
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@gmail.com>2024-12-28 16:47:43 -0800
committerPreston Pan <ret2pop@gmail.com>2024-12-28 16:47:43 -0800
commit1fd608288ee47c2c560817f12f14b21069fed2f6 (patch)
treee6460b92dba5bb0d089c8c2a4e794e3504098359 /src/include/opcodes.h
parent63f11aaec8d21844a07fd27003a992c102a3a297 (diff)
makefile and directory structure change completely to build client and server
Diffstat (limited to 'src/include/opcodes.h')
-rw-r--r--src/include/opcodes.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/include/opcodes.h b/src/include/opcodes.h
new file mode 100644
index 0000000..ff8400f
--- /dev/null
+++ b/src/include/opcodes.h
@@ -0,0 +1,47 @@
+#ifndef OPCODES_H
+#define OPCODES_H
+
+typedef enum {
+ CO_NOP,
+ CO_JN, /* join */
+ CO_DM,
+ CO_PST, /* post */
+ CO_MSG,
+ CO_REG,
+ CO_NCK, /* nick */
+ CO_PNG, /* pong */
+ CO_LVE, /* leave */
+ CO_QT, /* quit*/
+
+ CO_CLM, /* claim channel */
+ CO_DESC, /* change description */
+ CO_TRSFR, /* ownership transfer of admin */
+ CO_KCK, /* kick */
+ CO_BAN,
+ CO_KNGT, /* knight */
+ CO_DMT, /* demote */
+
+ CO_LOGS, /* allows users to download log file from date specified in unix time */
+
+ CO_UNRECOGNIZED
+} copcode_t;
+
+typedef enum {
+ SO_SUCCESS,
+ SO_FAIL_PARSE,
+ SO_FAIL_NOPERM,
+ SO_FAIL_USER_TAKEN,
+ SO_FAIL_RATE, /* rate limit */
+ SO_PNG, /* ping */
+ SO_BYE,
+} sopcode_t;
+
+char *decode_client_opcode(int op);
+
+char *decode_server_opcode(int op);
+
+int encode_client_opcode(char *c);
+
+int encode_server_opcode(char *c);
+
+#endif