<?xml version="1.0"?>
<!-- This file was automatically generated from C sources - DO NOT EDIT!
To affect the contents of this file, edit the original C definitions,
and/or use gtk-doc annotations.  -->
<repository version="1.2"
            xmlns="http://www.gtk.org/introspection/core/1.0"
            xmlns:c="http://www.gtk.org/introspection/c/1.0"
            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
  <include name="GObject" version="2.0"/>
  <include name="Soup" version="2.4"/>
  <package name="libuhttpmock"/>
  <c:include name="libuhttpmock/uhm.h"/>
  <namespace name="Uhm"
             version="0.0"
             shared-library="libuhttpmock-0.0.so.0"
             c:identifier-prefixes="Uhm"
             c:symbol-prefixes="uhm">
    <constant name="MAJOR_VERSION"
              value="0"
              c:type="UHM_MAJOR_VERSION"
              version="0.1.0">
      <doc xml:space="preserve">Evaluates to the major version of the libuhttpmock headers at compile time.
(e.g. in libuhttpmock version 1.2.3 this is 1).</doc>
      <type name="gint" c:type="gint"/>
    </constant>
    <constant name="MICRO_VERSION"
              value="3"
              c:type="UHM_MICRO_VERSION"
              version="0.1.0">
      <doc xml:space="preserve">Evaluates to the micro version of the libuhttpmock headers at compile time.
(e.g. in libuhttpmock version 1.2.3 this is 3).</doc>
      <type name="gint" c:type="gint"/>
    </constant>
    <constant name="MINOR_VERSION"
              value="3"
              c:type="UHM_MINOR_VERSION"
              version="0.1.0">
      <doc xml:space="preserve">Evaluates to the minor version of the libuhttpmock headers at compile time.
(e.g. in libuhttpmock version 1.2.3 this is 2).</doc>
      <type name="gint" c:type="gint"/>
    </constant>
    <class name="Resolver"
           c:symbol-prefix="resolver"
           c:type="UhmResolver"
           version="0.1.0"
           parent="Gio.Resolver"
           glib:type-name="UhmResolver"
           glib:get-type="uhm_resolver_get_type"
           glib:type-struct="ResolverClass">
      <doc xml:space="preserve">All the fields in the #UhmResolver structure are private and should never be accessed directly.</doc>
      <constructor name="new" c:identifier="uhm_resolver_new">
        <doc xml:space="preserve">Creates a new #UhmResolver with default property values.</doc>
        <return-value transfer-ownership="full">
          <doc xml:space="preserve">a new #UhmResolver; unref with g_object_unref()</doc>
          <type name="Resolver" c:type="UhmResolver*"/>
        </return-value>
      </constructor>
      <method name="add_A" c:identifier="uhm_resolver_add_A" version="0.1.0">
        <doc xml:space="preserve">Adds a resolution mapping from the host name @hostname to the IP address @addr.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">%TRUE on success; %FALSE otherwise</doc>
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmResolver</doc>
            <type name="Resolver" c:type="UhmResolver*"/>
          </instance-parameter>
          <parameter name="hostname" transfer-ownership="none">
            <doc xml:space="preserve">the hostname to match</doc>
            <type name="utf8" c:type="const gchar*"/>
          </parameter>
          <parameter name="addr" transfer-ownership="none">
            <doc xml:space="preserve">the IP address to resolve to</doc>
            <type name="utf8" c:type="const gchar*"/>
          </parameter>
        </parameters>
      </method>
      <method name="add_SRV"
              c:identifier="uhm_resolver_add_SRV"
              version="0.1.0">
        <doc xml:space="preserve">Adds a resolution mapping the given @service (on @protocol and @domain) to the IP address @addr and given @port.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">%TRUE on success; %FALSE otherwise</doc>
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmResolver</doc>
            <type name="Resolver" c:type="UhmResolver*"/>
          </instance-parameter>
          <parameter name="service" transfer-ownership="none">
            <doc xml:space="preserve">the service name to match</doc>
            <type name="utf8" c:type="const gchar*"/>
          </parameter>
          <parameter name="protocol" transfer-ownership="none">
            <doc xml:space="preserve">the protocol name to match</doc>
            <type name="utf8" c:type="const gchar*"/>
          </parameter>
          <parameter name="domain" transfer-ownership="none">
            <doc xml:space="preserve">the domain name to match</doc>
            <type name="utf8" c:type="const gchar*"/>
          </parameter>
          <parameter name="addr" transfer-ownership="none">
            <doc xml:space="preserve">the IP address to resolve to</doc>
            <type name="utf8" c:type="const gchar*"/>
          </parameter>
          <parameter name="port" transfer-ownership="none">
            <doc xml:space="preserve">the port to resolve to</doc>
            <type name="guint16" c:type="guint16"/>
          </parameter>
        </parameters>
      </method>
      <method name="reset" c:identifier="uhm_resolver_reset">
        <doc xml:space="preserve">Resets the state of the #UhmResolver, deleting all records added with uhm_resolver_add_A() and uhm_resolver_add_SRV().</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmResolver</doc>
            <type name="Resolver" c:type="UhmResolver*"/>
          </instance-parameter>
        </parameters>
      </method>
      <field name="parent" readable="0" private="1">
        <type name="Gio.Resolver" c:type="GResolver"/>
      </field>
      <field name="priv" readable="0" private="1">
        <type name="ResolverPrivate" c:type="UhmResolverPrivate*"/>
      </field>
    </class>
    <record name="ResolverClass"
            c:type="UhmResolverClass"
            glib:is-gtype-struct-for="Resolver"
            version="0.1.0">
      <doc xml:space="preserve">All the fields in the #UhmResolverClass structure are private and should never be accessed directly.</doc>
      <field name="parent" readable="0" private="1">
        <type name="Gio.ResolverClass" c:type="GResolverClass"/>
      </field>
    </record>
    <record name="ResolverPrivate" c:type="UhmResolverPrivate" disguised="1">
    </record>
    <class name="Server"
           c:symbol-prefix="server"
           c:type="UhmServer"
           version="0.1.0"
           parent="GObject.Object"
           glib:type-name="UhmServer"
           glib:get-type="uhm_server_get_type"
           glib:type-struct="ServerClass">
      <doc xml:space="preserve">All the fields in the #UhmServer structure are private and should never be accessed directly.</doc>
      <constructor name="new" c:identifier="uhm_server_new" version="0.1.0">
        <doc xml:space="preserve">Creates a new #UhmServer with default properties.</doc>
        <return-value transfer-ownership="full">
          <doc xml:space="preserve">a new #UhmServer; unref with g_object_unref()</doc>
          <type name="Server" c:type="UhmServer*"/>
        </return-value>
      </constructor>
      <function name="error_quark" c:identifier="uhm_server_error_quark">
        <return-value transfer-ownership="none">
          <type name="GLib.Quark" c:type="GQuark"/>
        </return-value>
      </function>
      <function name="received_message_chunk_from_soup"
                c:identifier="uhm_server_received_message_chunk_from_soup"
                version="0.3.0">
        <doc xml:space="preserve">Convenience version of uhm_server_received_message_chunk() which can be passed directly to soup_logger_set_printer()
to forward all libsoup traffic logging to a #UhmServer. The #UhmServer must be passed to soup_logger_set_printer() as
its user data.

&lt;informalexample&gt;&lt;programlisting&gt;
UhmServer *mock_server;
SoupSession *session;
SoupLogger *logger;

mock_server = uhm_server_new ();
session = soup_session_new ();

logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1);
soup_logger_set_printer (logger, uhm_server_received_message_chunk_from_soup, g_object_ref (mock_server), g_object_unref);
soup_session_add_feature (session, SOUP_SESSION_FEATURE (logger));
g_object_unref (logger);

/&lt;!-- --&gt;* Do something with mock_server here. *&lt;!-- --&gt;/
&lt;/programlisting&gt;&lt;/informalexample&gt;</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <parameter name="logger" transfer-ownership="none">
            <doc xml:space="preserve">a #SoupLogger</doc>
            <type name="Soup.Logger" c:type="SoupLogger*"/>
          </parameter>
          <parameter name="level" transfer-ownership="none">
            <doc xml:space="preserve">the detail level of this log message</doc>
            <type name="Soup.LoggerLogLevel" c:type="SoupLoggerLogLevel"/>
          </parameter>
          <parameter name="direction" transfer-ownership="none">
            <doc xml:space="preserve">the transmission direction of the message</doc>
            <type name="gchar" c:type="char"/>
          </parameter>
          <parameter name="data" transfer-ownership="none">
            <doc xml:space="preserve">message data</doc>
            <type name="utf8" c:type="const char*"/>
          </parameter>
          <parameter name="user_data"
                     transfer-ownership="none"
                     nullable="1"
                     allow-none="1">
            <doc xml:space="preserve">user data passed to the #SoupLogger, or %NULL</doc>
            <type name="gpointer" c:type="gpointer"/>
          </parameter>
        </parameters>
      </function>
      <virtual-method name="compare_messages">
        <return-value transfer-ownership="none">
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="expected_message" transfer-ownership="none">
            <type name="Soup.Message" c:type="SoupMessage*"/>
          </parameter>
          <parameter name="actual_message" transfer-ownership="none">
            <type name="Soup.Message" c:type="SoupMessage*"/>
          </parameter>
          <parameter name="actual_client" transfer-ownership="none">
            <type name="Soup.ClientContext" c:type="SoupClientContext*"/>
          </parameter>
        </parameters>
      </virtual-method>
      <virtual-method name="handle_message">
        <return-value transfer-ownership="none">
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="message" transfer-ownership="none">
            <type name="Soup.Message" c:type="SoupMessage*"/>
          </parameter>
          <parameter name="client" transfer-ownership="none">
            <type name="Soup.ClientContext" c:type="SoupClientContext*"/>
          </parameter>
        </parameters>
      </virtual-method>
      <method name="end_trace"
              c:identifier="uhm_server_end_trace"
              version="0.1.0">
        <doc xml:space="preserve">Convenience function to finish logging to or reading from a trace file previously passed to uhm_server_start_trace() or
uhm_server_start_trace_full().

If #UhmServer:enable-online is %FALSE, this will shut down the mock server (as if uhm_server_stop() had been called).</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="get_address"
              c:identifier="uhm_server_get_address"
              version="0.1.0">
        <doc xml:space="preserve">Gets the value of the #UhmServer:address property.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">the physical address of the listening socket the server is currently bound to; or %NULL if the server is not running</doc>
          <type name="utf8" c:type="const gchar*"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="get_enable_logging"
              c:identifier="uhm_server_get_enable_logging"
              version="0.1.0">
        <doc xml:space="preserve">Gets the value of the #UhmServer:enable-logging property.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">%TRUE if client network traffic is being logged to a trace file; %FALSE otherwise</doc>
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="get_enable_online"
              c:identifier="uhm_server_get_enable_online"
              version="0.1.0">
        <doc xml:space="preserve">Gets the value of the #UhmServer:enable-online property.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">%TRUE if the server does not intercept and handle network connections from client code; %FALSE otherwise</doc>
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="get_port"
              c:identifier="uhm_server_get_port"
              version="0.1.0">
        <doc xml:space="preserve">Gets the value of the #UhmServer:port property.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">the port of the listening socket the server is currently bound to; or &lt;code class="literal"&gt;0&lt;/code&gt; if the server is not running</doc>
          <type name="guint" c:type="guint"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="get_resolver"
              c:identifier="uhm_server_get_resolver"
              version="0.1.0">
        <doc xml:space="preserve">Gets the value of the #UhmServer:resolver property.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">the mock resolver in use by the mock server, or %NULL if no resolver is active</doc>
          <type name="Resolver" c:type="UhmResolver*"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="get_tls_certificate"
              c:identifier="uhm_server_get_tls_certificate"
              version="0.1.0">
        <doc xml:space="preserve">Gets the value of the #UhmServer:tls-certificate property.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">the server's current TLS certificate; or %NULL if it's serving HTTP only</doc>
          <type name="Gio.TlsCertificate" c:type="GTlsCertificate*"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="get_trace_directory"
              c:identifier="uhm_server_get_trace_directory"
              version="0.1.0">
        <doc xml:space="preserve">Gets the value of the #UhmServer:trace-directory property.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">the directory to load/store trace files from, or %NULL</doc>
          <type name="Gio.File" c:type="GFile*"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="load_trace"
              c:identifier="uhm_server_load_trace"
              version="0.1.0"
              throws="1">
        <doc xml:space="preserve">Synchronously loads the given @trace_file of network messages, ready to simulate a network conversation by matching
requests against the file and returning the associated responses. Call uhm_server_run() to start the mock
server afterwards.

Loading the trace file may be cancelled from another thread using @cancellable.

On error, @error will be set and the state of the #UhmServer will not change. A #GIOError will be set if there is
a problem reading the trace file.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="trace_file" transfer-ownership="none">
            <doc xml:space="preserve">trace file to load</doc>
            <type name="Gio.File" c:type="GFile*"/>
          </parameter>
          <parameter name="cancellable"
                     transfer-ownership="none"
                     nullable="1"
                     allow-none="1">
            <doc xml:space="preserve">a #GCancellable, or %NULL</doc>
            <type name="Gio.Cancellable" c:type="GCancellable*"/>
          </parameter>
        </parameters>
      </method>
      <method name="load_trace_async"
              c:identifier="uhm_server_load_trace_async"
              version="0.1.0">
        <doc xml:space="preserve">Asynchronous version of uhm_server_load_trace(). In @callback, call uhm_server_load_trace_finish() to complete the operation.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="trace_file" transfer-ownership="none">
            <doc xml:space="preserve">trace file to load</doc>
            <type name="Gio.File" c:type="GFile*"/>
          </parameter>
          <parameter name="cancellable"
                     transfer-ownership="none"
                     nullable="1"
                     allow-none="1">
            <doc xml:space="preserve">a #GCancellable, or %NULL</doc>
            <type name="Gio.Cancellable" c:type="GCancellable*"/>
          </parameter>
          <parameter name="callback"
                     transfer-ownership="none"
                     nullable="1"
                     allow-none="1"
                     scope="async"
                     closure="3">
            <doc xml:space="preserve">function to call once the async operation is complete</doc>
            <type name="Gio.AsyncReadyCallback" c:type="GAsyncReadyCallback"/>
          </parameter>
          <parameter name="user_data"
                     transfer-ownership="none"
                     nullable="1"
                     allow-none="1">
            <doc xml:space="preserve">user data to pass to @callback, or %NULL</doc>
            <type name="gpointer" c:type="gpointer"/>
          </parameter>
        </parameters>
      </method>
      <method name="load_trace_finish"
              c:identifier="uhm_server_load_trace_finish"
              version="0.1.0"
              throws="1">
        <doc xml:space="preserve">Finishes an asynchronous operation started by uhm_server_load_trace_async().

On error, @error will be set and the state of the #UhmServer will not change.
See uhm_server_load_trace() for details on the error domains used.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="result" transfer-ownership="none">
            <doc xml:space="preserve">asynchronous operation result passed to the callback</doc>
            <type name="Gio.AsyncResult" c:type="GAsyncResult*"/>
          </parameter>
        </parameters>
      </method>
      <method name="received_message_chunk"
              c:identifier="uhm_server_received_message_chunk"
              version="0.1.0"
              throws="1">
        <doc xml:space="preserve">Indicates to the mock server that a single new line of a message was received from the real server. The message line may be
appended to the current trace file if logging is enabled (#UhmServer:enable-logging is %TRUE), adding a newline character
at the end. If logging is disabled but online mode is enabled (#UhmServer:enable-online is %TRUE), the message line will
be compared to the next expected line in the existing trace file. Otherwise, this function is a no-op.

On failure, @error will be set and the #UhmServer state will remain unchanged apart from the parse state machine, which will remain
in the state reached after parsing @message_chunk. A %G_IO_ERROR will be returned if writing to the trace file failed. If in
comparison mode and the received message chunk corresponds to an unexpected message in the trace file, a %UHM_SERVER_ERROR will
be returned.

&lt;note&gt;&lt;para&gt;In common cases where message log data only needs to be passed to a #UhmServer and not (for example) logged to an
application-specific file or the command line as  well, it is simpler to use uhm_server_received_message_chunk_from_soup(), passing
it directly to soup_logger_set_printer(). See the documentation for uhm_server_received_message_chunk_from_soup() for details.&lt;/para&gt;&lt;/note&gt;</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="message_chunk" transfer-ownership="none">
            <doc xml:space="preserve">single line of a message which was received</doc>
            <type name="utf8" c:type="const gchar*"/>
          </parameter>
          <parameter name="message_chunk_length" transfer-ownership="none">
            <doc xml:space="preserve">length of @message_chunk in bytes</doc>
            <type name="gint64" c:type="goffset"/>
          </parameter>
        </parameters>
      </method>
      <method name="received_message_chunk_with_direction"
              c:identifier="uhm_server_received_message_chunk_with_direction"
              version="0.3.0"
              throws="1">
        <doc xml:space="preserve">Convenience version of uhm_server_received_message_chunk() which takes the
message @direction and @data separately, as provided by libsoup in a
#SoupLoggerPrinter callback.

&lt;informalexample&gt;&lt;programlisting&gt;
UhmServer *mock_server;
SoupSession *session;
SoupLogger *logger;

static void
soup_log_printer (SoupLogger *logger, SoupLoggerLogLevel level, char direction, const char *data, gpointer user_data)
{
	/&lt;!-- --&gt;* Pass the data to libuhttpmock. *&lt;!-- --&gt;/
UhmServer *mock_server = UHM_SERVER (user_data);
	uhm_server_received_message_chunk_with_direction (mock_server, direction, data, strlen (data), NULL);
}

mock_server = uhm_server_new ();
session = soup_session_new ();

logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1);
soup_logger_set_printer (logger, (SoupLoggerPrinter) soup_log_printer, g_object_ref (mock_server), g_object_unref);
soup_session_add_feature (session, SOUP_SESSION_FEATURE (logger));
g_object_unref (logger);

/&lt;!-- --&gt;* Do something with mock_server here. *&lt;!-- --&gt;/
&lt;/programlisting&gt;&lt;/informalexample&gt;</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="direction" transfer-ownership="none">
            <doc xml:space="preserve">single character indicating the direction of message transmission</doc>
            <type name="gchar" c:type="char"/>
          </parameter>
          <parameter name="data" transfer-ownership="none">
            <doc xml:space="preserve">single line of a message which was received</doc>
            <type name="utf8" c:type="const gchar*"/>
          </parameter>
          <parameter name="data_length" transfer-ownership="none">
            <doc xml:space="preserve">length of @data in bytes</doc>
            <type name="gint64" c:type="goffset"/>
          </parameter>
        </parameters>
      </method>
      <method name="run" c:identifier="uhm_server_run" version="0.1.0">
        <doc xml:space="preserve">Runs the mock server, binding to a loopback TCP/IP interface and preparing a HTTPS server which is ready to accept requests.
The TCP/IP address and port number are chosen randomly out of the loopback addresses, and are exposed as #UhmServer:address and #UhmServer:port
once this function has returned. A #UhmResolver (exposed as #UhmServer:resolver) is set as the default #GResolver while the server is running.

The server is started in a worker thread, so this function returns immediately and the server continues to run in the background. Use uhm_server_stop()
to shut it down.

This function always succeeds.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="set_default_tls_certificate"
              c:identifier="uhm_server_set_default_tls_certificate"
              version="0.1.0">
        <doc xml:space="preserve">Sets the value of the #UhmServer:tls-certificate property to the default TLS certificate built in to libuhttpmock.
This default certificate is not signed by any certificate authority, and contains minimal metadata details. It may
be used by clients which have no special certificate requirements; clients which have special requirements should
construct a custom #GTlsCertificate and pass it to uhm_server_set_tls_certificate().</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">the default certificate set as #UhmServer:tls-certificate</doc>
          <type name="Gio.TlsCertificate" c:type="GTlsCertificate*"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="set_enable_logging"
              c:identifier="uhm_server_set_enable_logging"
              version="0.1.0">
        <doc xml:space="preserve">Sets the value of the #UhmServer:enable-logging property.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="enable_logging" transfer-ownership="none">
            <doc xml:space="preserve">%TRUE to log client network traffic to a trace file; %FALSE otherwise</doc>
            <type name="gboolean" c:type="gboolean"/>
          </parameter>
        </parameters>
      </method>
      <method name="set_enable_online"
              c:identifier="uhm_server_set_enable_online"
              version="0.1.0">
        <doc xml:space="preserve">Sets the value of the #UhmServer:enable-online property.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="enable_online" transfer-ownership="none">
            <doc xml:space="preserve">%TRUE to not intercept and handle network connections from client code; %FALSE otherwise</doc>
            <type name="gboolean" c:type="gboolean"/>
          </parameter>
        </parameters>
      </method>
      <method name="set_expected_domain_names"
              c:identifier="uhm_server_set_expected_domain_names"
              version="0.3.0">
        <doc xml:space="preserve">Set the domain names which are expected to have requests made of them by the client code interacting with this #UhmServer.
This is a convenience method which calls uhm_resolver_add_A() on the server’s #UhmResolver for each of the domain names
listed in @domain_names. It associates them with the server’s current IP address, and automatically updates the mappings
if the IP address or resolver change.

Note that this will reset all records on the server’s #UhmResolver, replacing all of them with the provided @domain_names.

It is safe to add further domain names to the #UhmResolver in a callback for the #GObject::notify signal for #UhmServer:resolver;
that signal is emitted after the resolver is cleared and these @domain_names are added.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="domain_names"
                     transfer-ownership="none"
                     nullable="1"
                     allow-none="1">
            <doc xml:space="preserve">%NULL-terminated array of domain names to expect, or %NULL to not expect any</doc>
            <array c:type="gchar**">
              <type name="utf8"/>
            </array>
          </parameter>
        </parameters>
      </method>
      <method name="set_tls_certificate"
              c:identifier="uhm_server_set_tls_certificate"
              version="0.1.0">
        <doc xml:space="preserve">Sets the value of the #UhmServer:tls-certificate property.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="tls_certificate"
                     transfer-ownership="none"
                     nullable="1"
                     allow-none="1">
            <doc xml:space="preserve">TLS certificate for the server to use; or %NULL to serve HTTP only</doc>
            <type name="Gio.TlsCertificate" c:type="GTlsCertificate*"/>
          </parameter>
        </parameters>
      </method>
      <method name="set_trace_directory"
              c:identifier="uhm_server_set_trace_directory"
              version="0.1.0">
        <doc xml:space="preserve">Sets the value of the #UhmServer:trace-directory property.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="trace_directory"
                     transfer-ownership="none"
                     nullable="1"
                     allow-none="1">
            <doc xml:space="preserve">a directory to load/store trace files from, or %NULL to unset it</doc>
            <type name="Gio.File" c:type="GFile*"/>
          </parameter>
        </parameters>
      </method>
      <method name="start_trace"
              c:identifier="uhm_server_start_trace"
              version="0.1.0"
              throws="1">
        <doc xml:space="preserve">Starts a mock server which follows the trace file of filename @trace_name in the #UhmServer:trace-directory directory.
See uhm_server_start_trace_full() for further documentation.

This function has undefined behaviour if #UhmServer:trace-directory is %NULL.

On failure, @error will be set and the #UhmServer state will remain unchanged. See uhm_server_start_trace_full() for
details of the error domains used.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="trace_name" transfer-ownership="none">
            <doc xml:space="preserve">name of the trace</doc>
            <type name="utf8" c:type="const gchar*"/>
          </parameter>
        </parameters>
      </method>
      <method name="start_trace_full"
              c:identifier="uhm_server_start_trace_full"
              version="0.1.0"
              throws="1">
        <doc xml:space="preserve">Convenience function to start logging to or reading from the given @trace_file, depending on the values of #UhmServer:enable-logging and
#UhmServer:enable-online.

If #UhmServer:enable-logging is %TRUE, a log handler will be set up to redirect all client network activity into the given @trace_file.
If @trace_file already exists, it will be overwritten.

If #UhmServer:enable-online is %FALSE, the given @trace_file is loaded using uhm_server_load_trace() and then a mock server is
started using uhm_server_run().

On failure, @error will be set and the #UhmServer state will remain unchanged. A #GIOError will be set if logging is enabled
(#UhmServer:enable-logging) and there is a problem writing to the trace file; or if a trace needs to be loaded and there is a problem
reading from the trace file.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
          <parameter name="trace_file" transfer-ownership="none">
            <doc xml:space="preserve">a trace file to load</doc>
            <type name="Gio.File" c:type="GFile*"/>
          </parameter>
        </parameters>
      </method>
      <method name="stop" c:identifier="uhm_server_stop" version="0.1.0">
        <doc xml:space="preserve">Stops a mock server started by calling uhm_server_run(). This shuts down the server's worker thread and unbinds it from its TCP/IP socket.

This unloads any trace file loaded by calling uhm_server_load_trace() (or its asynchronous counterpart). It also resets the set of domain
names loaded into the #UhmServer:resolver.

This function always succeeds.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <method name="unload_trace"
              c:identifier="uhm_server_unload_trace"
              version="0.1.0">
        <doc xml:space="preserve">Unloads the current trace file of network messages, as loaded by uhm_server_load_trace() or uhm_server_load_trace_async().</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #UhmServer</doc>
            <type name="Server" c:type="UhmServer*"/>
          </instance-parameter>
        </parameters>
      </method>
      <property name="address" version="0.1.0" transfer-ownership="none">
        <doc xml:space="preserve">Address of the local mock server if it's running, or %NULL otherwise. This will be non-%NULL between calls to uhm_server_run() and
uhm_server_stop(). The address is a physical IP address, e.g. &lt;code class="literal"&gt;127.0.0.1&lt;/code&gt;.

This should not normally need to be passed into client code under test, unless the code references IP addresses specifically. The mock server
runs a DNS resolver which automatically redirects client requests for known domain names to this address (#UhmServer:resolver).</doc>
        <type name="utf8" c:type="gchar*"/>
      </property>
      <property name="enable-logging"
                version="0.1.0"
                writable="1"
                transfer-ownership="none">
        <doc xml:space="preserve">%TRUE if network traffic should be logged to a trace file (specified by calling uhm_server_start_trace()). This operates independently
of whether traffic is online or being handled locally by the mock server.
Use this in conjunction with #UhmServer:enable-online to either log online traffic, or replay logged traffic locally.</doc>
        <type name="gboolean" c:type="gboolean"/>
      </property>
      <property name="enable-online"
                version="0.1.0"
                writable="1"
                transfer-ownership="none">
        <doc xml:space="preserve">%TRUE if network traffic should reach the Internet as normal; %FALSE to redirect it to the local mock server.
Use this in conjunction with #UhmServer:enable-logging to either log online traffic, or replay logged traffic locally.</doc>
        <type name="gboolean" c:type="gboolean"/>
      </property>
      <property name="port" version="0.1.0" transfer-ownership="none">
        <doc xml:space="preserve">Port of the local mock server if it's running, or &lt;code class="literal"&gt;0&lt;/code&gt; otherwise. This will be non-&lt;code class="literal"&gt;0&lt;/code&gt; between
calls to uhm_server_run() and uhm_server_stop().

It is intended that this port be passed into the client code under test, to substitute for the default HTTPS port (443) which it would otherwise
use.</doc>
        <type name="guint" c:type="guint"/>
      </property>
      <property name="resolver" version="0.1.0" transfer-ownership="none">
        <doc xml:space="preserve">Mock resolver used to redirect HTTP requests from specified domain names to the local mock server instance. This will always be set while the
server is running (between calls to uhm_server_run() and uhm_server_stop()), and is %NULL otherwise.

Use the resolver specified in this property to add domain names which are expected to be requested by the current trace. Domain names not added
to the resolver will be rejected by the mock server. The set of domain names in the resolver will be reset when uhm_server_stop() is
called.</doc>
        <type name="Resolver"/>
      </property>
      <property name="tls-certificate"
                version="0.1.0"
                writable="1"
                transfer-ownership="none">
        <doc xml:space="preserve">TLS certificate for the mock server to use when serving HTTPS pages. If this is non-%NULL, the server will always use HTTPS. If it is %NULL,
the server will always use HTTP. The TLS certificate may be changed after constructing the #UhmServer, but changes to the property will not
take effect until the next call to uhm_server_run().

A certificate and private key may be generated by executing:
&lt;code&gt;openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -nodes&lt;/code&gt;. These files may then be used to construct a
#GTlsCertificate by calling g_tls_certificate_new_from_files().

Alternatively, a default #GTlsCertificate which wraps a dummy certificate (not signed by any certificate authority) may be set by
calling uhm_server_set_default_tls_certificate(). This may be used as the #UhmServer:tls-certificate if the code under test has no specific
requirements of the certificate used by the mock server it's tested against.</doc>
        <type name="Gio.TlsCertificate"/>
      </property>
      <property name="trace-directory"
                version="0.1.0"
                writable="1"
                transfer-ownership="none">
        <doc xml:space="preserve">Directory relative to which all trace files specified in calls to uhm_server_start_trace() will be resolved.
This is not used for any other methods, but must be non-%NULL if uhm_server_start_trace() is called.</doc>
        <type name="Gio.File"/>
      </property>
      <field name="parent" readable="0" private="1">
        <type name="GObject.Object" c:type="GObject"/>
      </field>
      <field name="priv" readable="0" private="1">
        <type name="ServerPrivate" c:type="UhmServerPrivate*"/>
      </field>
      <glib:signal name="compare-messages" when="last" version="0.1.0">
        <doc xml:space="preserve">Emitted whenever the mock server must compare two #SoupMessage&lt;!-- --&gt;s for equality; e.g. when in the testing or comparison modes.
Test code may connect to this signal and implement a handler which checks custom properties of the messages. The default handler compares
the URI and method of the messages, but no headers and not the message bodies.

Signal handlers should return %TRUE if the messages match; and %FALSE otherwise. The first signal handler executed when
this signal is emitted wins.</doc>
        <return-value transfer-ownership="none">
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <parameter name="expected_message" transfer-ownership="none">
            <doc xml:space="preserve">a message containing the expected HTTP(S) message provided by #UhmServer::handle-message</doc>
            <type name="Soup.Message"/>
          </parameter>
          <parameter name="actual_message" transfer-ownership="none">
            <doc xml:space="preserve">a message containing the incoming HTTP(S) request</doc>
            <type name="Soup.Message"/>
          </parameter>
          <parameter name="actual_client" transfer-ownership="none">
            <doc xml:space="preserve">additional data about the HTTP client making the request</doc>
            <type name="Soup.ClientContext"/>
          </parameter>
        </parameters>
      </glib:signal>
      <glib:signal name="handle-message" when="last" version="0.1.0">
        <doc xml:space="preserve">Emitted whenever the mock server is running and receives a request from a client. Test code may connect to this signal and implement a handler
which builds and returns a suitable response for a given message. The default handler reads a request–response pair from the current trace file,
matches the requests and then returns the given response. If the requests don't match, an error is raised.

Signal handlers should return %TRUE if they have handled the request and set an appropriate response; and %FALSE otherwise.</doc>
        <return-value transfer-ownership="none">
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <parameter name="message" transfer-ownership="none">
            <doc xml:space="preserve">a message containing the incoming HTTP(S) request, and which the outgoing HTTP(S) response should be set on</doc>
            <type name="Soup.Message"/>
          </parameter>
          <parameter name="client" transfer-ownership="none">
            <doc xml:space="preserve">additional data about the HTTP client making the request</doc>
            <type name="Soup.ClientContext"/>
          </parameter>
        </parameters>
      </glib:signal>
    </class>
    <record name="ServerClass"
            c:type="UhmServerClass"
            glib:is-gtype-struct-for="Server"
            version="0.1.0">
      <doc xml:space="preserve">Most of the fields in the #UhmServerClass structure are private and should never be accessed directly.</doc>
      <field name="parent" readable="0" private="1">
        <type name="GObject.ObjectClass" c:type="GObjectClass"/>
      </field>
      <field name="handle_message">
        <callback name="handle_message">
          <return-value transfer-ownership="none">
            <type name="gboolean" c:type="gboolean"/>
          </return-value>
          <parameters>
            <parameter name="self" transfer-ownership="none">
              <type name="Server" c:type="UhmServer*"/>
            </parameter>
            <parameter name="message" transfer-ownership="none">
              <type name="Soup.Message" c:type="SoupMessage*"/>
            </parameter>
            <parameter name="client" transfer-ownership="none">
              <type name="Soup.ClientContext" c:type="SoupClientContext*"/>
            </parameter>
          </parameters>
        </callback>
      </field>
      <field name="compare_messages">
        <callback name="compare_messages">
          <return-value transfer-ownership="none">
            <type name="gboolean" c:type="gboolean"/>
          </return-value>
          <parameters>
            <parameter name="self" transfer-ownership="none">
              <type name="Server" c:type="UhmServer*"/>
            </parameter>
            <parameter name="expected_message" transfer-ownership="none">
              <type name="Soup.Message" c:type="SoupMessage*"/>
            </parameter>
            <parameter name="actual_message" transfer-ownership="none">
              <type name="Soup.Message" c:type="SoupMessage*"/>
            </parameter>
            <parameter name="actual_client" transfer-ownership="none">
              <type name="Soup.ClientContext" c:type="SoupClientContext*"/>
            </parameter>
          </parameters>
        </callback>
      </field>
    </record>
    <enumeration name="ServerError" c:type="UhmServerError">
      <doc xml:space="preserve">Error codes for #UhmServer operations.</doc>
      <member name="server_error_message_mismatch"
              value="1"
              c:identifier="UHM_SERVER_ERROR_MESSAGE_MISMATCH">
        <doc xml:space="preserve">In comparison mode, a message received from the client did not match the next message in the current trace file.</doc>
      </member>
    </enumeration>
    <record name="ServerPrivate" c:type="UhmServerPrivate" disguised="1">
    </record>
  </namespace>
</repository>
