From 5b15d8085306759787eeefb7e434e6901273e5be Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 17 Jun 2018 22:10:43 -0400 Subject: Added packet-id values grepped from c-toxcore. --- src/Network/Tox/Crypto/Handlers.hs | 42 +++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'src/Network/Tox/Crypto/Handlers.hs') diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index 57e1741f..3336052b 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs @@ -1,8 +1,9 @@ -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE TupleSections #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE DeriveFunctor #-} -{-# LANGUAGE CPP #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeOperators #-} module Network.Tox.Crypto.Handlers where import Network.Tox.NodeId @@ -1099,6 +1100,37 @@ mkMsgTypes msgs = let zeros = A.listArray (0,255) (replicate 256 0) toIndex (GrpMsg KnownLossless nam) = 0x63 -- fromEnum MESSAGE_GROUPCHAT toIndex (GrpMsg KnownLossy nam) = 0xC7 -- fromEnum LOSSY_GROUPCHAT +------------------ Slurped from c-toxcore for reference. ------------------------------- +pattern PACKET_ID_ONLINE = 24 +pattern PACKET_ID_OFFLINE = 25 +pattern PACKET_ID_NICKNAME = 48 +pattern PACKET_ID_STATUSMESSAGE = 49 +pattern PACKET_ID_USERSTATUS = 50 +pattern PACKET_ID_TYPING = 51 +pattern PACKET_ID_MESSAGE = 64 +-- pattern PACKET_ID_ACTION = (PACKET_ID_MESSAGE + MESSAGE_ACTION) {- 65 -} +pattern PACKET_ID_MSI = 69 +pattern PACKET_ID_FILE_SENDREQUEST = 80 +pattern PACKET_ID_FILE_CONTROL = 81 +pattern PACKET_ID_FILE_DATA = 82 +pattern PACKET_ID_INVITE_CONFERENCE = 96 +pattern PACKET_ID_ONLINE_PACKET = 97 +pattern PACKET_ID_DIRECT_CONFERENCE = 98 +pattern PACKET_ID_MESSAGE_CONFERENCE = 99 +pattern PACKET_ID_LOSSY_CONFERENCE = 199 +pattern PACKET_ID_LOSSLESS_RANGE_START = 160 +pattern PACKET_ID_LOSSLESS_RANGE_SIZE = 32 +pattern PACKET_ID_ALIVE = 16 +pattern PACKET_ID_SHARE_RELAYS = 17 +pattern PACKET_ID_FRIEND_REQUESTS = 18 +pattern PACKET_ID_PADDING = 0 -- Denotes padding +pattern PACKET_ID_REQUEST = 1 -- Used to request unreceived packets +pattern PACKET_ID_KILL = 2 -- Used to killconnection +pattern PACKET_ID_LOSSY_RANGE_START = 192 +pattern PACKET_ID_LOSSY_RANGE_SIZE = 63 +---------------------------------------------------------------------------------------- + + -- | Handle all Tox messages that this code base is aware of. -- The first parameter is a function which is applied to get the values -- for keys of unknown nature. Could be either 'id' or 'const 0' -- cgit v1.2.3