Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Snmp/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ module Snmp.Types where
import Language.Asn.Types
import Data.Int (Int32)
import Data.Word (Word8,Word32,Word64)
import Data.Bool (bool)
import Data.ByteString (ByteString)
import Data.ByteString.Char8 (all)
import Data.ByteString.Builder (byteStringHex, toLazyByteString)
import Data.Char (isPrint)
import Data.Vector (Vector)
import Prelude hiding (all)

newtype RequestId = RequestId { getRequestId :: Int }
deriving (Eq,Ord,Show,Read)
Expand All @@ -25,7 +30,13 @@ data SimpleSyntax
= SimpleSyntaxInteger !Int32
| SimpleSyntaxString !ByteString
| SimpleSyntaxObjectId !ObjectIdentifier
deriving (Eq,Show)
deriving (Eq)

instance Show SimpleSyntax where
show (SimpleSyntaxInteger v) = "SimpleSyntaxInteger " <> show v
show (SimpleSyntaxObjectId v) = "SimpleSyntaxObjectId " <> show v
show (SimpleSyntaxString v) = "SimpleSyntaxString "
<> bool (show $ (toLazyByteString . byteStringHex) v) (show v) (all isPrint v)

data ApplicationSyntax
= ApplicationSyntaxIpAddress !Word32
Expand Down