Safe Haskell | None |
---|
This module exports everything from this package (except some functions defined in Network.Stun) to avoid the need for copy/paste.
- type Method = Word16
- data MessageClass
- = Request
- | Success
- | Failure
- | Indication
- data Attribute = Attribute {}
- data TransactionID = TID !Word32 !Word32 !Word32
- data Message = Message {}
- cookie :: Word32
- data AttributeError
- class Serialize a => IsAttribute a where
- attributeTypeValue :: a -> Word16
- toAttribute :: a -> Attribute
- fromAttribute :: Attribute -> Either AttributeError a
- findAttribute :: IsAttribute a => [Attribute] -> Either AttributeError [a]
- putAttribute :: Attribute -> PutM ()
- getAttribute :: Get Attribute
- encodeMessageType :: Method -> MessageClass -> Word16
- decodeMessageType :: Word16 -> (Method, MessageClass)
- fingerprintXorConstant :: Word32
- fingerprintAttribute :: Word32 -> Attribute
- putPlainMessage :: Int -> Message -> PutM ()
- putMessage :: Message -> PutM ()
- getMessage :: Get Message
- showBits :: Bits a => a -> [Char]
- data Credentials
- data Username = Username {
- unUsername :: !Text
- data MessageIntegrity = MessageIntegrity {
- miHmac :: !ByteString
- withMessageIntegrity :: Credentials -> Message -> Message
- checkMessageIntegrity :: Credentials -> Message -> Maybe (Bool, Message)
- data ErrorAttribute = ErrorAttribute {}
- putErrorAttribute :: ErrorAttribute -> PutM ()
- getErrorAttribute :: Get ErrorAttribute
- errTryAlternate :: ErrorAttribute
- errBadRequest :: ErrorAttribute
- errUnauthorized :: ErrorAttribute
- errUnknownAttribute :: ErrorAttribute
- errStaleNonce :: ErrorAttribute
- errServerError :: ErrorAttribute
- xmaAttributeType :: Word16
- maAttributeType :: Word16
- newtype MappedAddress = MA {}
- newtype XorMappedAddress = XMA {}
- halfCookie :: Word16
- putAddress :: SockAddr -> PutM ()
- getAddress :: Get SockAddr
- fromXorMappedAddress :: TransactionID -> XorMappedAddress -> SockAddr
- xorMappedAddress :: TransactionID -> SockAddr -> XorMappedAddress
- xorAddress :: TransactionID -> SockAddr -> SockAddr
Documentation
data TransactionID Source
Message | |
|
magic cookie constant
data AttributeError Source
class Serialize a => IsAttribute a whereSource
attributeTypeValue :: a -> Word16Source
toAttribute :: a -> AttributeSource
findAttribute :: IsAttribute a => [Attribute] -> Either AttributeError [a]Source
putAttribute :: Attribute -> PutM ()Source
encodeMessageType :: Method -> MessageClass -> Word16Source
decodeMessageType :: Word16 -> (Method, MessageClass)Source
putPlainMessage :: Int -> Message -> PutM ()Source
putMessage :: Message -> PutM ()Source
data Credentials Source
data MessageIntegrity Source
withMessageIntegrity :: Credentials -> Message -> MessageSource
Generate a MESSAGE-INTEGRITY attribute and append it to the message attribute list
checkMessageIntegrity :: Credentials -> Message -> Maybe (Bool, Message)Source
Checks the credentials of a message
- returns Nothing when the credentials don't match
- returns Just (False, oldmsg) when no MESSAGE-INTEGRITY attribute is present
where oldmsg is the unchanged message passed to the function
- returns Just (True, prunedmsg) when the attribute is present and matches
where prunedmsg is the message with all fields after MESSAGE-INTEGRITY removed
putErrorAttribute :: ErrorAttribute -> PutM ()Source
newtype MappedAddress Source
newtype XorMappedAddress Source
putAddress :: SockAddr -> PutM ()Source
xorAddress :: TransactionID -> SockAddr -> SockAddrSource