SOUP Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
struct SoupContext; struct SoupConnection; enum SoupConnectErrorCode; void (*SoupConnectCallbackFn) (SoupContext *ctx, SoupConnectErrorCode err, SoupConnection *conn, gpointer user_data); typedef SoupConnectId; SoupContext* soup_context_get (const gchar *uri); SoupContext* soup_context_from_uri (SoupUri *suri); void soup_context_ref (SoupContext *ctx); void soup_context_unref (SoupContext *ctx); SoupConnectId soup_context_get_connection (SoupContext *ctx, SoupConnectCallbackFn cb, gpointer user_data); const SoupUri* soup_context_get_uri (SoupContext *ctx); void soup_context_cancel_connect (SoupConnectId tag); GIOChannel* soup_connection_get_iochannel (SoupConnection *conn); SoupContext* soup_connection_get_context (SoupConnection *conn); void soup_connection_set_keep_alive (SoupConnection *conn, gboolean keepalive); gboolean soup_connection_is_keep_alive (SoupConnection *conn); gboolean soup_connection_is_new (SoupConnection *conn); void soup_connection_release (SoupConnection *conn); |
typedef enum { SOUP_CONNECT_ERROR_NONE, SOUP_CONNECT_ERROR_ADDR_RESOLVE, SOUP_CONNECT_ERROR_NETWORK } SoupConnectErrorCode; |
void (*SoupConnectCallbackFn) (SoupContext *ctx, SoupConnectErrorCode err, SoupConnection *conn, gpointer user_data); |
ctx : | |
err : | |
conn : | |
user_data : |
|
SoupContext* soup_context_get (const gchar *uri); |
Returns a pointer to the SoupContext representing uri. If a context already exists for the URI, it is returned with an added reference. Otherwise, a new context is created with a reference count of one.
uri : | the stringified URI. |
Returns : | a SoupContext representing uri. |
SoupContext* soup_context_from_uri (SoupUri *suri); |
Returns a pointer to the SoupContext representing suri. If a context already exists for the URI, it is returned with an added reference. Otherwise, a new context is created with a reference count of one.
suri : | a SoupUri. |
Returns : | a SoupContext representing uri. |
void soup_context_ref (SoupContext *ctx); |
Adds a reference to ctx.
ctx : | a SoupContext. |
void soup_context_unref (SoupContext *ctx); |
Decrement the reference count on ctx. If the reference count reaches zero, the SoupContext is freed. If this is the last context for a given server address, any open connections are closed.
ctx : | a SoupContext. |
SoupConnectId soup_context_get_connection (SoupContext *ctx, SoupConnectCallbackFn cb, gpointer user_data); |
Initiates the process of establishing a network connection to the server referenced in ctx. If an existing connection is available and not in use, cb is called immediately, and a SoupConnectId of 0 is returned. Otherwise, a new connection is established. If the current connection count exceeds that set in soup_set_connection_limit, the new connection is not created until an existing connection is closed.
Once a network connection is successfully established, or an existing connection becomes available for use, cb is called, passing the SoupConnection representing it.
ctx : | a SoupContext. |
cb : | a SoupConnectCallbackFn to be called when a valid connection is available. |
user_data : | the user_data passed to cb. |
Returns : | a SoupConnectId which can be used to cancel a connection attempt using soup_context_cancel_connect. |
const SoupUri* soup_context_get_uri (SoupContext *ctx); |
Returns a pointer to the SoupUri represented by ctx.
ctx : | a SoupContext. |
Returns : | the SoupUri for ctx. |
void soup_context_cancel_connect (SoupConnectId tag); |
Cancels the connection attempt represented by tag. The SoupConnectCallbackFn passed in soup_context_get_connection is not called.
tag : | a SoupConnextId representing a connection in progress. |
GIOChannel* soup_connection_get_iochannel (SoupConnection *conn); |
Returns a GIOChannel used for IO operations on the network connection represented by conn.
conn : | a SoupConnection. |
Returns : | a pointer to the GIOChannel used for IO on conn. |
SoupContext* soup_connection_get_context (SoupConnection *conn); |
Returns the SoupContext from which conn was created, with an added ref.
conn : | a SoupConnection. |
Returns : | the SoupContext associated with conn. Unref when finished. |
void soup_connection_set_keep_alive (SoupConnection *conn, gboolean keepalive); |
Sets the keep-alive flag on the SoupConnection pointed to by conn.
conn : | a SoupConnection. |
keepalive : |
|
gboolean soup_connection_is_keep_alive (SoupConnection *conn); |
Returns the keep-alive flag for the SoupConnection pointed to by conn. If this flag is TRUE, the connection will be returned to the pool of unused connections when next soup_connection_release is called, otherwise the connection will be closed and resources freed.
conn : | a SoupConnection. |
Returns : | the keep-alive flag for conn. |
gboolean soup_connection_is_new (SoupConnection *conn); |
Returns TRUE if this is the first use of conn (I.E. soup_connection_release has not yet been called on it).
conn : | a SoupConnection. |
Returns : | boolean representing whether this is the first time a connection has been used. |
void soup_connection_release (SoupConnection *conn); |
Mark the connection represented by conn as being unused. If the keep-alive flag is not set on the connection, the connection is closed and its resources freed, otherwise the connection is returned to the unused connection pool for the server.
conn : | a SoupConnection currently in use. |