aboutsummaryrefslogtreecommitdiff
path: root/lib/gateway/opcode.mli
diff options
context:
space:
mode:
authorAdelyn Breedlove <[email protected]>2019-02-11 17:23:59 +0000
committerAdelyn Breedlove <[email protected]>2019-02-11 17:23:59 +0000
commit7c9b809078b5cd53e3d54c0004c683da2ec679af (patch)
tree5a1b165b597fc1ad4167115d9a23b12852a4636b /lib/gateway/opcode.mli
parentMerge branch 'sharder_fixes' into 'master' (diff)
downloaddisml-7c9b809078b5cd53e3d54c0004c683da2ec679af.tar.xz
disml-7c9b809078b5cd53e3d54c0004c683da2ec679af.zip
Add a cache
Diffstat (limited to 'lib/gateway/opcode.mli')
-rw-r--r--lib/gateway/opcode.mli29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/gateway/opcode.mli b/lib/gateway/opcode.mli
new file mode 100644
index 0000000..9fa5b96
--- /dev/null
+++ b/lib/gateway/opcode.mli
@@ -0,0 +1,29 @@
+(** Internal Opcode abstractions. *)
+
+(** Type of known opcodes. *)
+type t =
+| DISPATCH
+| HEARTBEAT
+| IDENTIFY
+| STATUS_UPDATE
+| VOICE_STATE_UPDATE
+| RESUME
+| RECONNECT
+| REQUEST_GUILD_MEMBERS
+| INVALID_SESSION
+| HELLO
+| HEARTBEAT_ACK
+
+(** Raised when receiving an invalid opcode. This should never occur. *)
+exception Invalid_Opcode of int
+
+(** Converts an opcode to its integer form for outgoing frames. *)
+val to_int : t -> int
+
+(** Converts an integer to an opcode for incoming frames.
+ Raise {!Invalid_Opcode} Raised when an unkown opcode is received.
+*)
+val from_int : int -> t
+
+(** Converts and opcode to a human-readable string. Used for logging purposes. *)
+val to_string : t -> string \ No newline at end of file