gi-soup-2.4.18: Libsoup bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.Soup.Callbacks

Contents

Description

 
Synopsis

Signals

AddressCallback

type AddressCallback Source #

Arguments

 = Address

addr: the Address that was resolved

-> Word32

status: StatusOk, StatusCantResolve, or StatusCancelled

-> IO () 

The callback function passed to addressResolveAsync.

type AddressCallback_WithClosures Source #

Arguments

 = Address

addr: the Address that was resolved

-> Word32

status: StatusOk, StatusCantResolve, or StatusCancelled

-> Ptr ()

userData: the user data that was passed to addressResolveAsync

-> IO () 

The callback function passed to addressResolveAsync.

type C_AddressCallback = Ptr Address -> Word32 -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

drop_closures_AddressCallback :: AddressCallback -> AddressCallback_WithClosures Source #

A simple wrapper that ignores the closure arguments.

dynamic_AddressCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a) 
=> FunPtr C_AddressCallback 
-> a

addr: the Address that was resolved

-> Word32

status: StatusOk, StatusCantResolve, or StatusCancelled

-> Ptr ()

userData: the user data that was passed to addressResolveAsync

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_AddressCallback :: C_AddressCallback -> IO (FunPtr C_AddressCallback) Source #

Generate a function pointer callable from C code, from a C_AddressCallback.

AuthDomainBasicAuthCallback

type AuthDomainBasicAuthCallback Source #

Arguments

 = AuthDomainBasic

domain: the domain

-> Message

msg: the message being authenticated

-> Text

username: the username provided by the client

-> Text

password: the password provided by the client

-> IO Bool

Returns: True if username and password are valid

Callback used by AuthDomainBasic for authentication purposes. The application should verify that username and password and valid and return True or False.

If you are maintaining your own password database (rather than using the password to authenticate against some other system like PAM or a remote server), you should make sure you know what you are doing. In particular, don't store cleartext passwords, or easily-computed hashes of cleartext passwords, even if you don't care that much about the security of your server, because users will frequently use the same password for multiple sites, and so compromising any site with a cleartext (or easily-cracked) password database may give attackers access to other more-interesting sites as well.

type AuthDomainBasicAuthCallback_WithClosures Source #

Arguments

 = AuthDomainBasic

domain: the domain

-> Message

msg: the message being authenticated

-> Text

username: the username provided by the client

-> Text

password: the password provided by the client

-> Ptr ()

userData: the data passed to authDomainBasicSetAuthCallback

-> IO Bool

Returns: True if username and password are valid

Callback used by AuthDomainBasic for authentication purposes. The application should verify that username and password and valid and return True or False.

If you are maintaining your own password database (rather than using the password to authenticate against some other system like PAM or a remote server), you should make sure you know what you are doing. In particular, don't store cleartext passwords, or easily-computed hashes of cleartext passwords, even if you don't care that much about the security of your server, because users will frequently use the same password for multiple sites, and so compromising any site with a cleartext (or easily-cracked) password database may give attackers access to other more-interesting sites as well.

type C_AuthDomainBasicAuthCallback = Ptr AuthDomainBasic -> Ptr Message -> CString -> CString -> Ptr () -> IO CInt Source #

Type for the callback on the (unwrapped) C side.

dynamic_AuthDomainBasicAuthCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsAuthDomainBasic a, IsMessage b) 
=> FunPtr C_AuthDomainBasicAuthCallback 
-> a

domain: the domain

-> b

msg: the message being authenticated

-> Text

username: the username provided by the client

-> Text

password: the password provided by the client

-> Ptr ()

userData: the data passed to authDomainBasicSetAuthCallback

-> m Bool

Returns: True if username and password are valid

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

AuthDomainDigestAuthCallback

type AuthDomainDigestAuthCallback Source #

Arguments

 = AuthDomainDigest

domain: the domain

-> Message

msg: the message being authenticated

-> Text

username: the username provided by the client

-> IO (Maybe Text)

Returns: the encoded password, or Nothing if username is not a valid user. domain will free the password when it is done with it.

Callback used by AuthDomainDigest for authentication purposes. The application should look up username in its password database, and return the corresponding encoded password (see authDomainDigestEncodePassword).

type AuthDomainDigestAuthCallback_WithClosures Source #

Arguments

 = AuthDomainDigest

domain: the domain

-> Message

msg: the message being authenticated

-> Text

username: the username provided by the client

-> Ptr ()

userData: the data passed to authDomainDigestSetAuthCallback

-> IO (Maybe Text)

Returns: the encoded password, or Nothing if username is not a valid user. domain will free the password when it is done with it.

Callback used by AuthDomainDigest for authentication purposes. The application should look up username in its password database, and return the corresponding encoded password (see authDomainDigestEncodePassword).

type C_AuthDomainDigestAuthCallback = Ptr AuthDomainDigest -> Ptr Message -> CString -> Ptr () -> IO CString Source #

Type for the callback on the (unwrapped) C side.

dynamic_AuthDomainDigestAuthCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsAuthDomainDigest a, IsMessage b) 
=> FunPtr C_AuthDomainDigestAuthCallback 
-> a

domain: the domain

-> b

msg: the message being authenticated

-> Text

username: the username provided by the client

-> Ptr ()

userData: the data passed to authDomainDigestSetAuthCallback

-> m (Maybe Text)

Returns: the encoded password, or Nothing if username is not a valid user. domain will free the password when it is done with it.

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

AuthDomainFilter

type AuthDomainFilter Source #

Arguments

 = AuthDomain

domain: a AuthDomain

-> Message

msg: a Message

-> IO Bool

Returns: True if msg requires authentication, False if not.

The prototype for a AuthDomain filter; see authDomainSetFilter for details.

type AuthDomainFilter_WithClosures Source #

Arguments

 = AuthDomain

domain: a AuthDomain

-> Message

msg: a Message

-> Ptr ()

userData: the data passed to authDomainSetFilter

-> IO Bool

Returns: True if msg requires authentication, False if not.

The prototype for a AuthDomain filter; see authDomainSetFilter for details.

type C_AuthDomainFilter = Ptr AuthDomain -> Ptr Message -> Ptr () -> IO CInt Source #

Type for the callback on the (unwrapped) C side.

drop_closures_AuthDomainFilter :: AuthDomainFilter -> AuthDomainFilter_WithClosures Source #

A simple wrapper that ignores the closure arguments.

dynamic_AuthDomainFilter Source #

Arguments

:: (HasCallStack, MonadIO m, IsAuthDomain a, IsMessage b) 
=> FunPtr C_AuthDomainFilter 
-> a

domain: a AuthDomain

-> b

msg: a Message

-> Ptr ()

userData: the data passed to authDomainSetFilter

-> m Bool

Returns: True if msg requires authentication, False if not.

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_AuthDomainFilter :: C_AuthDomainFilter -> IO (FunPtr C_AuthDomainFilter) Source #

Generate a function pointer callable from C code, from a C_AuthDomainFilter.

AuthDomainGenericAuthCallback

type AuthDomainGenericAuthCallback Source #

Arguments

 = AuthDomain

domain: a AuthDomain

-> Message

msg: the Message being authenticated

-> Text

username: the username from msg

-> IO Bool

Returns: True if msg is authenticated, False if not.

The prototype for a AuthDomain generic authentication callback.

The callback should look up the user's password, call authDomainCheckPassword, and use the return value from that method as its own return value.

In general, for security reasons, it is preferable to use the auth-domain-specific auth callbacks (eg, AuthDomainBasicAuthCallback and AuthDomainDigestAuthCallback), because they don't require keeping a cleartext password database. Most users will use the same password for many different sites, meaning if any site with a cleartext password database is compromised, accounts on other servers might be compromised as well. For many of the cases where Server is used, this is not really relevant, but it may still be worth considering.

type AuthDomainGenericAuthCallback_WithClosures Source #

Arguments

 = AuthDomain

domain: a AuthDomain

-> Message

msg: the Message being authenticated

-> Text

username: the username from msg

-> Ptr ()

userData: the data passed to authDomainSetGenericAuthCallback

-> IO Bool

Returns: True if msg is authenticated, False if not.

The prototype for a AuthDomain generic authentication callback.

The callback should look up the user's password, call authDomainCheckPassword, and use the return value from that method as its own return value.

In general, for security reasons, it is preferable to use the auth-domain-specific auth callbacks (eg, AuthDomainBasicAuthCallback and AuthDomainDigestAuthCallback), because they don't require keeping a cleartext password database. Most users will use the same password for many different sites, meaning if any site with a cleartext password database is compromised, accounts on other servers might be compromised as well. For many of the cases where Server is used, this is not really relevant, but it may still be worth considering.

type C_AuthDomainGenericAuthCallback = Ptr AuthDomain -> Ptr Message -> CString -> Ptr () -> IO CInt Source #

Type for the callback on the (unwrapped) C side.

dynamic_AuthDomainGenericAuthCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsAuthDomain a, IsMessage b) 
=> FunPtr C_AuthDomainGenericAuthCallback 
-> a

domain: a AuthDomain

-> b

msg: the Message being authenticated

-> Text

username: the username from msg

-> Ptr ()

userData: the data passed to authDomainSetGenericAuthCallback

-> m Bool

Returns: True if msg is authenticated, False if not.

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

ChunkAllocator

type C_ChunkAllocator = Ptr Message -> Word64 -> Ptr () -> IO (Ptr Buffer) Source #

Type for the callback on the (unwrapped) C side.

type ChunkAllocator Source #

Arguments

 = Message

msg: the Message the chunk is being allocated for

-> Word64

maxLen: the maximum length that will be read, or 0.

-> IO (Maybe Buffer)

Returns: the new buffer (or Nothing)

Deprecated: Use Request if you want to read into yourown buffers.

The prototype for a chunk allocation callback. This should allocate a new Buffer and return it for the I/O layer to read message body data off the network into.

If maxLen is non-0, it indicates the maximum number of bytes that could be read, based on what is known about the message size. Note that this might be a very large number, and you should not simply try to allocate that many bytes blindly. If maxLen is 0, that means that libsoup does not know how many bytes remain to be read, and the allocator should return a buffer of a size that it finds convenient.

If the allocator returns Nothing, the message will be paused. It is up to the application to make sure that it gets unpaused when it becomes possible to allocate a new buffer.

type ChunkAllocator_WithClosures Source #

Arguments

 = Message

msg: the Message the chunk is being allocated for

-> Word64

maxLen: the maximum length that will be read, or 0.

-> Ptr ()

userData: the data passed to messageSetChunkAllocator

-> IO (Maybe Buffer)

Returns: the new buffer (or Nothing)

The prototype for a chunk allocation callback. This should allocate a new Buffer and return it for the I/O layer to read message body data off the network into.

If maxLen is non-0, it indicates the maximum number of bytes that could be read, based on what is known about the message size. Note that this might be a very large number, and you should not simply try to allocate that many bytes blindly. If maxLen is 0, that means that libsoup does not know how many bytes remain to be read, and the allocator should return a buffer of a size that it finds convenient.

If the allocator returns Nothing, the message will be paused. It is up to the application to make sure that it gets unpaused when it becomes possible to allocate a new buffer.

drop_closures_ChunkAllocator :: ChunkAllocator -> ChunkAllocator_WithClosures Source #

A simple wrapper that ignores the closure arguments.

dynamic_ChunkAllocator Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a) 
=> FunPtr C_ChunkAllocator 
-> a

msg: the Message the chunk is being allocated for

-> Word64

maxLen: the maximum length that will be read, or 0.

-> Ptr ()

userData: the data passed to messageSetChunkAllocator

-> m (Maybe Buffer)

Returns: the new buffer (or Nothing)

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_ChunkAllocator :: C_ChunkAllocator -> IO (FunPtr C_ChunkAllocator) Source #

Generate a function pointer callable from C code, from a C_ChunkAllocator.

LoggerFilter

type C_LoggerFilter = Ptr Logger -> Ptr Message -> Ptr () -> IO CUInt Source #

Type for the callback on the (unwrapped) C side.

type LoggerFilter Source #

Arguments

 = Logger

logger: the Logger

-> Message

msg: the message being logged

-> IO LoggerLogLevel

Returns: a LoggerLogLevel value indicating how much of the message to log

The prototype for a logging filter. The filter callback will be invoked for each request or response, and should analyze it and return a LoggerLogLevel value indicating how much of the message to log. Eg, it might choose between LoggerLogLevelBody and LoggerLogLevelHeaders depending on the Content-Type.

type LoggerFilter_WithClosures Source #

Arguments

 = Logger

logger: the Logger

-> Message

msg: the message being logged

-> Ptr ()

userData: the data passed to loggerSetRequestFilter or loggerSetResponseFilter

-> IO LoggerLogLevel

Returns: a LoggerLogLevel value indicating how much of the message to log

The prototype for a logging filter. The filter callback will be invoked for each request or response, and should analyze it and return a LoggerLogLevel value indicating how much of the message to log. Eg, it might choose between LoggerLogLevelBody and LoggerLogLevelHeaders depending on the Content-Type.

drop_closures_LoggerFilter :: LoggerFilter -> LoggerFilter_WithClosures Source #

A simple wrapper that ignores the closure arguments.

dynamic_LoggerFilter Source #

Arguments

:: (HasCallStack, MonadIO m, IsLogger a, IsMessage b) 
=> FunPtr C_LoggerFilter 
-> a

logger: the Logger

-> b

msg: the message being logged

-> Ptr ()

userData: the data passed to loggerSetRequestFilter or loggerSetResponseFilter

-> m LoggerLogLevel

Returns: a LoggerLogLevel value indicating how much of the message to log

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_LoggerFilter :: C_LoggerFilter -> IO (FunPtr C_LoggerFilter) Source #

Generate a function pointer callable from C code, from a C_LoggerFilter.

LoggerPrinter

type C_LoggerPrinter = Ptr Logger -> CUInt -> Int8 -> CString -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type LoggerPrinter Source #

Arguments

 = Logger

logger: the Logger

-> LoggerLogLevel

level: the level of the information being printed.

-> Int8

direction: a single-character prefix to data

-> Text

data: data to print

-> IO () 

The prototype for a custom printing callback.

level indicates what kind of information is being printed. Eg, it will be LoggerLogLevelHeaders if data is header data.

direction is either '<', '>', or ' ', and data is the single line to print; the printer is expected to add a terminating newline.

To get the effect of the default printer, you would do:

<informalexample><programlisting> printf ("c s\n", direction, data); </programlisting></informalexample>

type LoggerPrinter_WithClosures Source #

Arguments

 = Logger

logger: the Logger

-> LoggerLogLevel

level: the level of the information being printed.

-> Int8

direction: a single-character prefix to data

-> Text

data: data to print

-> Ptr ()

userData: the data passed to loggerSetPrinter

-> IO () 

The prototype for a custom printing callback.

level indicates what kind of information is being printed. Eg, it will be LoggerLogLevelHeaders if data is header data.

direction is either '<', '>', or ' ', and data is the single line to print; the printer is expected to add a terminating newline.

To get the effect of the default printer, you would do:

<informalexample><programlisting> printf ("c s\n", direction, data); </programlisting></informalexample>

drop_closures_LoggerPrinter :: LoggerPrinter -> LoggerPrinter_WithClosures Source #

A simple wrapper that ignores the closure arguments.

dynamic_LoggerPrinter Source #

Arguments

:: (HasCallStack, MonadIO m, IsLogger a) 
=> FunPtr C_LoggerPrinter 
-> a

logger: the Logger

-> LoggerLogLevel

level: the level of the information being printed.

-> Int8

direction: a single-character prefix to data

-> Text

data: data to print

-> Ptr ()

userData: the data passed to loggerSetPrinter

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_LoggerPrinter :: C_LoggerPrinter -> IO (FunPtr C_LoggerPrinter) Source #

Generate a function pointer callable from C code, from a C_LoggerPrinter.

MessageHeadersForeachFunc

type C_MessageHeadersForeachFunc = CString -> CString -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type MessageHeadersForeachFunc Source #

Arguments

 = Text

name: the header name

-> Text

value: the header value

-> IO () 

The callback passed to messageHeadersForeach.

type MessageHeadersForeachFunc_WithClosures Source #

Arguments

 = Text

name: the header name

-> Text

value: the header value

-> Ptr ()

userData: the data passed to messageHeadersForeach

-> IO () 

The callback passed to messageHeadersForeach.

dynamic_MessageHeadersForeachFunc Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> FunPtr C_MessageHeadersForeachFunc 
-> Text

name: the header name

-> Text

value: the header value

-> Ptr ()

userData: the data passed to messageHeadersForeach

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

PasswordManagerCallback

type C_PasswordManagerCallback = Ptr PasswordManager -> Ptr Message -> Ptr Auth -> CInt -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type PasswordManagerCallback = PasswordManager -> Message -> Auth -> Bool -> IO () Source #

No description available in the introspection data.

type PasswordManagerCallback_WithClosures = PasswordManager -> Message -> Auth -> Bool -> Ptr () -> IO () Source #

No description available in the introspection data.

dynamic_PasswordManagerCallback :: (HasCallStack, MonadIO m, IsPasswordManager a, IsMessage b, IsAuth c) => FunPtr C_PasswordManagerCallback -> a -> b -> c -> Bool -> Ptr () -> m () Source #

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

ProxyResolverCallback

type C_ProxyResolverCallback = Ptr ProxyResolver -> Ptr Message -> Word32 -> Ptr Address -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type ProxyResolverCallback = ProxyResolver -> Message -> Word32 -> Address -> IO () Source #

Deprecated: (Since version 2.28)Use SoupProxyURIResolver instead

No description available in the introspection data.

type ProxyResolverCallback_WithClosures = ProxyResolver -> Message -> Word32 -> Address -> Ptr () -> IO () Source #

No description available in the introspection data.

dynamic_ProxyResolverCallback :: (HasCallStack, MonadIO m, IsProxyResolver a, IsMessage b, IsAddress c) => FunPtr C_ProxyResolverCallback -> a -> b -> Word32 -> c -> Ptr () -> m () Source #

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_ProxyResolverCallback :: C_ProxyResolverCallback -> IO (FunPtr C_ProxyResolverCallback) Source #

Generate a function pointer callable from C code, from a C_ProxyResolverCallback.

ProxyURIResolverCallback

type C_ProxyURIResolverCallback = Ptr ProxyURIResolver -> Word32 -> Ptr URI -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type ProxyURIResolverCallback Source #

Arguments

 = ProxyURIResolver

resolver: the ProxyURIResolver

-> Word32

status: a Status

-> URI

proxyUri: the resolved proxy URI, or Nothing

-> IO () 

type ProxyURIResolverCallback_WithClosures Source #

Arguments

 = ProxyURIResolver

resolver: the ProxyURIResolver

-> Word32

status: a Status

-> URI

proxyUri: the resolved proxy URI, or Nothing

-> Ptr ()

userData: data passed to proxyURIResolverGetProxyUriAsync

-> IO () 

dynamic_ProxyURIResolverCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsProxyURIResolver a) 
=> FunPtr C_ProxyURIResolverCallback 
-> a

resolver: the ProxyURIResolver

-> Word32

status: a Status

-> URI

proxyUri: the resolved proxy URI, or Nothing

-> Ptr ()

userData: data passed to proxyURIResolverGetProxyUriAsync

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

ServerCallback

type C_ServerCallback = Ptr Server -> Ptr Message -> CString -> Ptr (GHashTable CString CString) -> Ptr ClientContext -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type ServerCallback Source #

Arguments

 = Server

server: the Server

-> Message

msg: the message being processed

-> Text

path: the path component of msg's Request-URI

-> Maybe (Map Text Text)

query: the parsed query component of msg's Request-URI

-> ClientContext

client: additional contextual information about the client

-> IO () 

A callback used to handle requests to a Server.

path and query contain the likewise-named components of the Request-URI, subject to certain assumptions. By default, Server decodes all percent-encoding in the URI path, such that "/foo%<!-- -->2Fbar" is treated the same as "/foo/bar". If your server is serving resources in some non-POSIX-filesystem namespace, you may want to distinguish those as two distinct paths. In that case, you can set the SERVER_RAW_PATHS property when creating the Server, and it will leave those characters undecoded. (You may want to call uriNormalize to decode any percent-encoded characters that you aren't handling specially.)

query contains the query component of the Request-URI parsed according to the rules for HTML form handling. Although this is the only commonly-used query string format in HTTP, there is nothing that actually requires that HTTP URIs use that format; if your server needs to use some other format, you can just ignore query, and call messageGetUri and parse the URI's query field yourself.

See serverAddHandler and serverAddEarlyHandler for details of what handlers can/should do.

type ServerCallback_WithClosures Source #

Arguments

 = Server

server: the Server

-> Message

msg: the message being processed

-> Text

path: the path component of msg's Request-URI

-> Maybe (Map Text Text)

query: the parsed query component of msg's Request-URI

-> ClientContext

client: additional contextual information about the client

-> Ptr ()

userData: the data passed to serverAddHandler or serverAddEarlyHandler.

-> IO () 

A callback used to handle requests to a Server.

path and query contain the likewise-named components of the Request-URI, subject to certain assumptions. By default, Server decodes all percent-encoding in the URI path, such that "/foo%<!-- -->2Fbar" is treated the same as "/foo/bar". If your server is serving resources in some non-POSIX-filesystem namespace, you may want to distinguish those as two distinct paths. In that case, you can set the SERVER_RAW_PATHS property when creating the Server, and it will leave those characters undecoded. (You may want to call uriNormalize to decode any percent-encoded characters that you aren't handling specially.)

query contains the query component of the Request-URI parsed according to the rules for HTML form handling. Although this is the only commonly-used query string format in HTTP, there is nothing that actually requires that HTTP URIs use that format; if your server needs to use some other format, you can just ignore query, and call messageGetUri and parse the URI's query field yourself.

See serverAddHandler and serverAddEarlyHandler for details of what handlers can/should do.

drop_closures_ServerCallback :: ServerCallback -> ServerCallback_WithClosures Source #

A simple wrapper that ignores the closure arguments.

dynamic_ServerCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsServer a, IsMessage b) 
=> FunPtr C_ServerCallback 
-> a

server: the Server

-> b

msg: the message being processed

-> Text

path: the path component of msg's Request-URI

-> Maybe (Map Text Text)

query: the parsed query component of msg's Request-URI

-> ClientContext

client: additional contextual information about the client

-> Ptr ()

userData: the data passed to serverAddHandler or serverAddEarlyHandler.

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_ServerCallback :: C_ServerCallback -> IO (FunPtr C_ServerCallback) Source #

Generate a function pointer callable from C code, from a C_ServerCallback.

ServerWebsocketCallback

type C_ServerWebsocketCallback = Ptr Server -> Ptr WebsocketConnection -> CString -> Ptr ClientContext -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type ServerWebsocketCallback Source #

Arguments

 = Server

server: the Server

-> WebsocketConnection

connection: the newly created WebSocket connection

-> Text

path: the path component of msg's Request-URI

-> ClientContext

client: additional contextual information about the client

-> IO () 

A callback used to handle WebSocket requests to a Server. The callback will be invoked after sending the handshake response back to the client (and is only invoked if the handshake was successful).

path contains the path of the Request-URI, subject to the same rules as ServerCallback (qv).

type ServerWebsocketCallback_WithClosures Source #

Arguments

 = Server

server: the Server

-> WebsocketConnection

connection: the newly created WebSocket connection

-> Text

path: the path component of msg's Request-URI

-> ClientContext

client: additional contextual information about the client

-> Ptr ()

userData: the data passed to soupServerAddHandler

-> IO () 

A callback used to handle WebSocket requests to a Server. The callback will be invoked after sending the handshake response back to the client (and is only invoked if the handshake was successful).

path contains the path of the Request-URI, subject to the same rules as ServerCallback (qv).

dynamic_ServerWebsocketCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsServer a, IsWebsocketConnection b) 
=> FunPtr C_ServerWebsocketCallback 
-> a

server: the Server

-> b

connection: the newly created WebSocket connection

-> Text

path: the path component of msg's Request-URI

-> ClientContext

client: additional contextual information about the client

-> Ptr ()

userData: the data passed to soupServerAddHandler

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

SessionCallback

type C_SessionCallback = Ptr Session -> Ptr Message -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type SessionCallback Source #

Arguments

 = Session

session: the session

-> Message

msg: the message that has finished

-> IO () 

Prototype for the callback passed to sessionQueueMessage, qv.

type SessionCallback_WithClosures Source #

Arguments

 = Session

session: the session

-> Message

msg: the message that has finished

-> Ptr ()

userData: the data passed to soup_session_queue_message

-> IO () 

Prototype for the callback passed to sessionQueueMessage, qv.

drop_closures_SessionCallback :: SessionCallback -> SessionCallback_WithClosures Source #

A simple wrapper that ignores the closure arguments.

dynamic_SessionCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsSession a, IsMessage b) 
=> FunPtr C_SessionCallback 
-> a

session: the session

-> b

msg: the message that has finished

-> Ptr ()

userData: the data passed to soup_session_queue_message

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_SessionCallback :: C_SessionCallback -> IO (FunPtr C_SessionCallback) Source #

Generate a function pointer callable from C code, from a C_SessionCallback.

SessionConnectProgressCallback

type C_SessionConnectProgressCallback = Ptr Session -> CUInt -> Ptr IOStream -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type SessionConnectProgressCallback Source #

Arguments

 = Session

session: the Session

-> SocketClientEvent

event: a SocketClientEvent

-> IOStream

connection: the current state of the network connection

-> IO () 

Prototype for the progress callback passed to sessionConnectAsync.

Since: 2.62

type SessionConnectProgressCallback_WithClosures Source #

Arguments

 = Session

session: the Session

-> SocketClientEvent

event: a SocketClientEvent

-> IOStream

connection: the current state of the network connection

-> Ptr ()

userData: the data passed to sessionConnectAsync.

-> IO () 

Prototype for the progress callback passed to sessionConnectAsync.

Since: 2.62

dynamic_SessionConnectProgressCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsSession a, IsIOStream b) 
=> FunPtr C_SessionConnectProgressCallback 
-> a

session: the Session

-> SocketClientEvent

event: a SocketClientEvent

-> b

connection: the current state of the network connection

-> Ptr ()

userData: the data passed to sessionConnectAsync.

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

SocketCallback

type C_SocketCallback = Ptr Socket -> Word32 -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type SocketCallback Source #

Arguments

 = Socket

sock: the Socket

-> Word32

status: an HTTP status code indicating success or failure

-> IO () 

The callback function passed to socketConnectAsync.

type SocketCallback_WithClosures Source #

Arguments

 = Socket

sock: the Socket

-> Word32

status: an HTTP status code indicating success or failure

-> Ptr ()

userData: the data passed to socketConnectAsync

-> IO () 

The callback function passed to socketConnectAsync.

drop_closures_SocketCallback :: SocketCallback -> SocketCallback_WithClosures Source #

A simple wrapper that ignores the closure arguments.

dynamic_SocketCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocket a) 
=> FunPtr C_SocketCallback 
-> a

sock: the Socket

-> Word32

status: an HTTP status code indicating success or failure

-> Ptr ()

userData: the data passed to socketConnectAsync

-> m () 

Given a pointer to a foreign C function, wrap it into a function callable from Haskell.

mk_SocketCallback :: C_SocketCallback -> IO (FunPtr C_SocketCallback) Source #

Generate a function pointer callable from C code, from a C_SocketCallback.