Lots of pedanic changes.
<FILE>giostream</FILE>
<TITLE>GIOStream</TITLE>
GIOStream
-g_io_stream_clear_pending
+g_io_stream_get_input_stream
+g_io_stream_get_output_stream
g_io_stream_close
g_io_stream_close_async
g_io_stream_close_finish
-g_io_stream_get_input_stream
-g_io_stream_get_output_stream
-g_io_stream_has_pending
g_io_stream_is_closed
+g_io_stream_has_pending
g_io_stream_set_pending
+g_io_stream_clear_pending
<SUBSECTION Standard>
GIOStreamClass
G_IO_STREAM
g_inet_address_to_string
g_inet_address_get_family
g_inet_address_get_is_any
-g_inet_address_get_is_link_local
g_inet_address_get_is_loopback
-g_inet_address_get_is_mc_global
+g_inet_address_get_is_link_local
+g_inet_address_get_is_site_local
+g_inet_address_get_is_multicast
g_inet_address_get_is_mc_link_local
g_inet_address_get_is_mc_node_local
-g_inet_address_get_is_mc_org_local
g_inet_address_get_is_mc_site_local
-g_inet_address_get_is_multicast
-g_inet_address_get_is_site_local
+g_inet_address_get_is_mc_org_local
+g_inet_address_get_is_mc_global
<SUBSECTION Standard>
GInetAddressClass
GInetAddressPrivate
g_socket_protocol_get_type
g_socket_service_get_type
g_socket_type_get_type
+g_srv_target_get_type
g_tcp_connection_get_type
g_themed_icon_get_type
g_threaded_socket_service_get_type
* in all ways except that initialization is asynchronous. For more details
* see the descriptions on #GInitable.
*
- * A class may implement both the #GInitable and #GAsyncInitable interfaces
- * or both.
+ * A class may implement both the #GInitable and #GAsyncInitable interfaces.
*
- * Users of objects implementing this are not intended to use
- * the interface method directly, instead it will be used automatically
- * in various ways. For C applications you generally just call
- * g_async_initable_new() directly, or indirectly via a foo_thing_new_async() wrapper.
- * This will call g_async_initable_init() under the cover, calling back with %NULL and
+ * Users of objects implementing this are not intended to use the interface
+ * method directly, instead it will be used automatically in various ways.
+ * For C applications you generally just call g_async_initable_new() directly,
+ * or indirectly via a foo_thing_new_async() wrapper. This will call
+ * g_async_initable_init() under the cover, calling back with %NULL and
* a set %GError on failure.
- **/
+ */
static void g_async_initable_base_init (gpointer g_iface);
static void g_async_initable_real_init_async (GAsyncInitable *initable,
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function
*
- * Starts asynchronous initialization of the object implementing the interface.
- * This must be done before any real use of the object after initial construction.
- * If the object also implements #GInitable you can optionally call g_initable_init()
- * instead.
+ * Starts asynchronous initialization of the object implementing the
+ * interface. This must be done before any real use of the object after
+ * initial construction. If the object also implements #GInitable you can
+ * optionally call g_initable_init() instead.
*
- * When the initialization is finished, @callback will be called. You can then call
- * g_async_initable_init_finish() to get the result of the initialization.
+ * When the initialization is finished, @callback will be called. You can
+ * then call g_async_initable_init_finish() to get the result of the
+ * initialization.
*
- * Implementations may also support cancellation. If @cancellable is not %NULL,
- * then initialization can be cancelled by triggering the cancellable object
- * from another thread. If the operation was cancelled, the error
+ * Implementations may also support cancellation. If @cancellable is not
+ * %NULL, then initialization can be cancelled by triggering the cancellable
+ * object from another thread. If the operation was cancelled, the error
* %G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL and
* the object doesn't support cancellable initialization the error
* %G_IO_ERROR_NOT_SUPPORTED will be returned.
* any interface methods.
*
* Since: 2.22
- **/
+ */
void
-g_async_initable_init_async (GAsyncInitable *initable,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_async_initable_init_async (GAsyncInitable *initable,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GAsyncInitableIface *iface;
* Finishes asynchronous initialization and returns the result.
* See g_async_initable_init_async().
*
- * Returns: %TRUE if successful. If an error
- * has occurred, this function will return %FALSE and set @error
- * appropriately if present.
+ * Returns: %TRUE if successful. If an error has occurred, this function
+ * will return %FALSE and set @error appropriately if present.
*
* Since: 2.22
- **/
+ */
gboolean
-g_async_initable_init_finish (GAsyncInitable *initable,
- GAsyncResult *res,
- GError **error)
+g_async_initable_init_finish (GAsyncInitable *initable,
+ GAsyncResult *res,
+ GError **error)
{
GAsyncInitableIface *iface;
}
static void
-g_async_initable_real_init_async (GAsyncInitable *initable,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_async_initable_real_init_async (GAsyncInitable *initable,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *res;
}
static gboolean
-g_async_initable_real_init_finish (GAsyncInitable *initable,
- GAsyncResult *res,
- GError **error)
+g_async_initable_real_init_finish (GAsyncInitable *initable,
+ GAsyncResult *res,
+ GError **error)
{
return TRUE; /* Errors handled by base impl */
}
* @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the operation.
* @cancellable: optional #GCancellable object, %NULL to ignore.
- * @callback: a #GAsyncReadyCallback to call when the initialization is finished
+ * @callback: a #GAsyncReadyCallback to call when the initialization is
+ * finished
* @user_data: the data to pass to callback function
- * @first_property_name: the name of the first property, or %NULL if no properties
+ * @first_property_name: the name of the first property, or %NULL if no
+ * properties
* @...: the value if the first property, followed by and other property
* value pairs, and ended by %NULL.
*
* Helper function for constructing #GAsyncInitiable object. This is
* similar to g_object_new() but also initializes the object asyncronously.
*
- * When the initialization is finished, @callback will be called. You can then call
- * g_async_initable_new_finish() to get new object and check for any errors.
+ * When the initialization is finished, @callback will be called. You can
+ * then call g_async_initable_new_finish() to get new object and check for
+ * any errors.
*
* Since: 2.22
- **/
+ */
void
-g_async_initable_new_async (GType object_type,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data,
- const gchar *first_property_name,
+g_async_initable_new_async (GType object_type,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ const gchar *first_property_name,
...)
{
va_list var_args;
* @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the operation.
* @cancellable: optional #GCancellable object, %NULL to ignore.
- * @callback: a #GAsyncReadyCallback to call when the initialization is finished
+ * @callback: a #GAsyncReadyCallback to call when the initialization is
+ * finished
* @user_data: the data to pass to callback function
*
* Helper function for constructing #GAsyncInitiable object. This is
* similar to g_object_newv() but also initializes the object asyncronously.
*
- * When the initialization is finished, @callback will be called. You can then call
- * g_async_initable_new_finish() to get new object and check for any errors.
+ * When the initialization is finished, @callback will be called. You can
+ * then call g_async_initable_new_finish() to get new object and check for
+ * any errors.
*
* Since: 2.22
- **/
+ */
void
-g_async_initable_newv_async (GType object_type,
- guint n_parameters,
- GParameter *parameters,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_async_initable_newv_async (GType object_type,
+ guint n_parameters,
+ GParameter *parameters,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GObject *obj;
* @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the operation.
* @cancellable: optional #GCancellable object, %NULL to ignore.
- * @callback: a #GAsyncReadyCallback to call when the initialization is finished
+ * @callback: a #GAsyncReadyCallback to call when the initialization is
+ * finished
* @user_data: the data to pass to callback function
*
* Helper function for constructing #GAsyncInitiable object. This is
- * similar to g_object_new_valist() but also initializes the object asyncronously.
+ * similar to g_object_new_valist() but also initializes the object
+ * asyncronously.
*
- * When the initialization is finished, @callback will be called. You can then call
- * g_async_initable_new_finish() to get new object and check for any errors.
+ * When the initialization is finished, @callback will be called. You can
+ * then call g_async_initable_new_finish() to get new object and check for
+ * any errors.
*
* Since: 2.22
- **/
+ */
void
-g_async_initable_new_valist_async (GType object_type,
- const gchar *first_property_name,
- va_list var_args,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_async_initable_new_valist_async (GType object_type,
+ const gchar *first_property_name,
+ va_list var_args,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GObject *obj;
callback, user_data);
g_object_unref (obj); /* Passed ownership to async call */
}
+
/**
* g_async_initable_new_finish:
* @initable: the #GAsyncInitable from the callback
* @res: the #GAsyncResult.from the callback
* @error: a #GError location to store the error occuring, or %NULL to
- * ignore.
+ * ignore.
*
* Finishes the async construction for the various g_async_initable_new calls,
* returning the created object or %NULL on error.
*
- * Returns: a newly created #GObject, or %NULL on error. Free with g_object_unref().
+ * Returns: a newly created #GObject, or %NULL on error. Free with
+ * g_object_unref().
*
* Since: 2.22
- **/
+ */
GObject *
-g_async_initable_new_finish (GAsyncInitable *initable,
- GAsyncResult *res,
- GError **error)
+g_async_initable_new_finish (GAsyncInitable *initable,
+ GAsyncResult *res,
+ GError **error)
{
if (g_async_initable_init_finish (initable, res, error))
return g_object_ref (initable);
/**
* g_file_create_readwrite:
- * @file: input #GFile.
- * @flags: a set of #GFileCreateFlags.
- * @cancellable: optional #GCancellable object, %NULL to ignore.
- * @error: a #GError, or %NULL
+ * @file: a #GFile
+ * @flags: a set of #GFileCreateFlags
+ * @cancellable: optional #GCancellable object, %NULL to ignore
+ * @error: return location for a #GError, or %NULL
*
* Creates a new file and returns a stream for reading and writing to it.
* The file must not already exist.
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
- * If a file or directory with this name already exists the G_IO_ERROR_EXISTS
- * error will be returned.
- * Some file systems don't allow all file names, and may
- * return an G_IO_ERROR_INVALID_FILENAME error, and if the name
- * is to long G_IO_ERROR_FILENAME_TOO_LONG will be returned.
- * Other errors are possible too, and depend on what kind of
- * filesystem the file is on.
+ * If a file or directory with this name already exists the %G_IO_ERROR_EXISTS
+ * error will be returned. Some file systems don't allow all file names,
+ * and may return an %G_IO_ERROR_INVALID_FILENAME error, and if the name
+ * is too long, %G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors
+ * are possible too, and depend on what kind of filesystem the file is on.
*
- * Note that in many non-local file cases read and write streams are not supported,
- * so make sure you really need to do read and write streaming, rather than
- * just opening for reading or writing.
+ * Note that in many non-local file cases read and write streams are not
+ * supported, so make sure you really need to do read and write streaming,
+ * rather than just opening for reading or writing.
*
- * Returns: a #GFileIOStream for the newly created file, or
- * %NULL on error.
+ * Returns: a #GFileIOStream for the newly created file, or %NULL on error.
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GFileIOStream *
-g_file_create_readwrite (GFile *file,
- GFileCreateFlags flags,
- GCancellable *cancellable,
- GError **error)
+g_file_create_readwrite (GFile *file,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
GFileIface *iface;
/**
* g_file_replace_readwrite:
- * @file: input #GFile.
+ * @file: a #GFile
* @etag: an optional <link linkend="gfile-etag">entity tag</link> for the
- * current #GFile, or #NULL to ignore.
- * @make_backup: %TRUE if a backup should be created.
- * @flags: a set of #GFileCreateFlags.
- * @cancellable: optional #GCancellable object, %NULL to ignore.
- * @error: a #GError, or %NULL
+ * current #GFile, or #NULL to ignore
+ * @make_backup: %TRUE if a backup should be created
+ * @flags: a set of #GFileCreateFlags
+ * @cancellable: optional #GCancellable object, %NULL to ignore
+ * @error: return location for a #GError, or %NULL
*
* Returns an output stream for overwriting the file in readwrite mode,
- * possibly creating a backup copy of the file first. If the file doesn't exist,
- * it will be created.
+ * possibly creating a backup copy of the file first. If the file doesn't
+ * exist, it will be created.
*
* For details about the behaviour, see g_file_replace() which does the same
* thing but returns an output stream only.
*
- * Note that in many non-local file cases read and write streams are not supported,
- * so make sure you really need to do read and write streaming, rather than
- * just opening for reading or writing.
+ * Note that in many non-local file cases read and write streams are not
+ * supported, so make sure you really need to do read and write streaming,
+ * rather than just opening for reading or writing.
*
* Returns: a #GFileIOStream or %NULL on error.
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GFileIOStream *
-g_file_replace_readwrite (GFile *file,
- const char *etag,
- gboolean make_backup,
- GFileCreateFlags flags,
- GCancellable *cancellable,
- GError **error)
+g_file_replace_readwrite (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
GFileIface *iface;
/**
* g_file_read_async:
- * @file: input #GFile.
- * @io_priority: the <link linkend="io-priority">I/O priority</link>
- * of the request.
+ * @file: input #GFile
+ * @io_priority: the <link linkend="io-priority">I/O priority</link>
+ * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function
/**
* g_file_create_readwrite_async:
- * @file: input #GFile.
- * @flags: a set of #GFileCreateFlags.
+ * @file: input #GFile
+ * @flags: a set of #GFileCreateFlags
* @io_priority: the <link linkend="io-priority">I/O priority</link>
- * of the request.
- * @cancellable: optional #GCancellable object, %NULL to ignore.
+ * of the request
+ * @cancellable: optional #GCancellable object, %NULL to ignore
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function
*
- * Asynchronously creates a new file and returns a stream for reading and writing
- * to it. The file must not already exist.
+ * Asynchronously creates a new file and returns a stream for reading and
+ * writing to it. The file must not already exist.
*
* For more details, see g_file_create_readwrite() which is
* the synchronous version of this call.
*
- * When the operation is finished, @callback will be called. You can then call
- * g_file_create_readwrite_finish() to get the result of the operation.
+ * When the operation is finished, @callback will be called. You can then
+ * call g_file_create_readwrite_finish() to get the result of the operation.
*
* Since: 2.22
- **/
+ */
void
-g_file_create_readwrite_async (GFile *file,
- GFileCreateFlags flags,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_file_create_readwrite_async (GFile *file,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GFileIface *iface;
/**
* g_file_create_readwrite_finish:
- * @file: input #GFile.
- * @res: a #GAsyncResult.
+ * @file: input #GFile
+ * @res: a #GAsyncResult
* @error: a #GError, or %NULL
*
* Finishes an asynchronous file create operation started with
* Since: 2.22
**/
GFileIOStream *
-g_file_create_readwrite_finish (GFile *file,
- GAsyncResult *res,
- GError **error)
+g_file_create_readwrite_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error)
{
GFileIface *iface;
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function
*
- * Asynchronously overwrites the file in read-write mode, replacing the contents,
- * possibly creating a backup copy of the file first.
+ * Asynchronously overwrites the file in read-write mode, replacing the
+ * contents, possibly creating a backup copy of the file first.
*
* For more details, see g_file_replace_readwrite() which is
* the synchronous version of this call.
*
- * When the operation is finished, @callback will be called. You can then call
- * g_file_replace_readwrite_finish() to get the result of the operation.
+ * When the operation is finished, @callback will be called. You can then
+ * call g_file_replace_readwrite_finish() to get the result of the operation.
*
* Since: 2.22
- **/
+ */
void
-g_file_replace_readwrite_async (GFile *file,
- const char *etag,
- gboolean make_backup,
- GFileCreateFlags flags,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_file_replace_readwrite_async (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GFileIface *iface;
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GFileIOStream *
-g_file_replace_readwrite_finish (GFile *file,
- GAsyncResult *res,
- GError **error)
+g_file_replace_readwrite_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error)
{
GFileIface *iface;
* To actually connect to a remote host, you will need a
* #GInetSocketAddress (which includes a #GInetAddress as well as a
* port number).
- **/
+ */
/**
* GInetAddress:
*
* An IPv4 or IPv6 internet address.
- **/
+ */
/* Networking initialization function, called from inside the g_once of
* g_inet_address_get_type()
{
GInetAddress *address = G_INET_ADDRESS (object);
- switch (prop_id)
+ switch (prop_id)
{
case PROP_FAMILY:
address->priv->family = g_value_get_enum (value);
P_("The address family (IPv4 or IPv6)"),
G_TYPE_SOCKET_FAMILY,
G_SOCKET_FAMILY_INVALID,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_BYTES,
g_param_spec_pointer ("bytes",
P_("Bytes"),
P_("The raw address data"),
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
-
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GInetAddress:is-any:
+ *
+ * Whether this is the "any" address for its family.
+ * See g_inet_address_get_is_any().
+ *
+ * Since: 2.22
+ */
g_object_class_install_property (gobject_class, PROP_IS_ANY,
g_param_spec_boolean ("is-any",
P_("Is any"),
- P_("See g_inet_address_get_is_any()"),
+ P_("Whether this is the \"any\" address for its family"),
FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
-
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GInetAddress:is-link-local:
+ *
+ * Whether this is a link-local address.
+ * See g_inet_address_get_is_link_local().
+ *
+ * Since: 2.22
+ */
g_object_class_install_property (gobject_class, PROP_IS_LINK_LOCAL,
g_param_spec_boolean ("is-link-local",
P_("Is link-local"),
- P_("See g_inet_address_get_is_link_local()"),
+ P_("Whether this is a link-local address"),
FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
-
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GInetAddress:is-loopback:
+ *
+ * Whether this is the loopback address for its family.
+ * See g_inet_address_get_is_loopback().
+ *
+ * Since: 2.22
+ */
g_object_class_install_property (gobject_class, PROP_IS_LOOPBACK,
g_param_spec_boolean ("is-loopback",
P_("Is loopback"),
- P_("See g_inet_address_get_is_loopback()"),
+ P_("Whether this is the loopback address for its family"),
FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
-
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GInetAddress:is-site-local:
+ *
+ * Whether this is a site-local address.
+ * See g_inet_address_get_is_loopback().
+ *
+ * Since: 2.22
+ */
g_object_class_install_property (gobject_class, PROP_IS_SITE_LOCAL,
g_param_spec_boolean ("is-site-local",
P_("Is site-local"),
- P_("See g_inet_address_get_is_site_local()"),
+ P_("Whether this is a site-local address"),
FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
-
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GInetAddress:is-multicast:
+ *
+ * Whether this is a multicast address.
+ * See g_inet_address_get_is_multicast().
+ *
+ * Since: 2.22
+ */
g_object_class_install_property (gobject_class, PROP_IS_MULTICAST,
g_param_spec_boolean ("is-multicast",
P_("Is multicast"),
- P_("See g_inet_address_get_is_multicast()"),
+ P_("Whether this is a multicast address"),
FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
-
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GInetAddress:is-mc-global:
+ *
+ * Whether this is a global multicast address.
+ * See g_inet_address_get_is_mc_global().
+ *
+ * Since: 2.22
+ */
g_object_class_install_property (gobject_class, PROP_IS_MC_GLOBAL,
g_param_spec_boolean ("is-mc-global",
P_("Is multicast global"),
- P_("See g_inet_address_get_is_mc_global()"),
+ P_("Whether this is a global multicast address"),
FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
-
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+
+ /**
+ * GInetAddress:is-mc-link-local:
+ *
+ * Whether this is a link-local multicast address.
+ * See g_inet_address_get_is_mc_link_local().
+ *
+ * Since: 2.22
+ */
g_object_class_install_property (gobject_class, PROP_IS_MC_LINK_LOCAL,
g_param_spec_boolean ("is-mc-link-local",
P_("Is multicast link-local"),
- P_("See g_inet_address_get_is_mc_link_local()"),
+ P_("Whether this is a link-local multicast address"),
FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
-
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GInetAddress:is-mc-node-local:
+ *
+ * Whether this is a node-local multicast address.
+ * See g_inet_address_get_is_mc_node_local().
+ *
+ * Since: 2.22
+ */
g_object_class_install_property (gobject_class, PROP_IS_MC_NODE_LOCAL,
g_param_spec_boolean ("is-mc-node-local",
P_("Is multicast node-local"),
- P_("See g_inet_address_get_is_mc_node_local()"),
+ P_("Whether this is a node-local multicast address"),
FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
-
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GInetAddress:is-mc-org-local:
+ *
+ * Whether this is an organization-local multicast address.
+ * See g_inet_address_get_is_mc_org_local().
+ *
+ * Since: 2.22
+ */
g_object_class_install_property (gobject_class, PROP_IS_MC_ORG_LOCAL,
g_param_spec_boolean ("is-mc-org-local",
P_("Is multicast org-local"),
- P_("See g_inet_address_get_is_mc_org_local()"),
+ P_("Whether this is an organization-local multicast address"),
FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
-
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GInetAddress:is-mc-site-local:
+ *
+ * Whether this is a site-local multicast address.
+ * See g_inet_address_get_is_mc_site_local().
+ *
+ * Since: 2.22
+ */
g_object_class_install_property (gobject_class, PROP_IS_MC_SITE_LOCAL,
g_param_spec_boolean ("is-mc-site-local",
P_("Is multicast site-local"),
- P_("See g_inet_address_get_is_mc_site_local()"),
+ P_("Whether this is a site-local multicast address"),
FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
}
static void
*
* An IPv4 or IPv6 socket address; that is, the combination of a
* #GInetAddress and a port number.
- **/
+ */
/**
* GInetSocketAddress:
*
* An IPv4 or IPv6 socket address, corresponding to a <type>struct
* sockaddr_in</type> or <type>struct sockaddr_in6</type>.
- **/
+ */
G_DEFINE_TYPE (GInetSocketAddress, g_inet_socket_address, G_TYPE_SOCKET_ADDRESS);
enum {
}
static gboolean
-g_inet_socket_address_to_native (GSocketAddress *address,
- gpointer dest,
- gsize destlen,
- GError **error)
+g_inet_socket_address_to_native (GSocketAddress *address,
+ gpointer dest,
+ gsize destlen,
+ GError **error)
{
GInetSocketAddress *addr;
GSocketFamily family;
g_object_class_install_property (gobject_class, PROP_ADDRESS,
g_param_spec_object ("address",
- "address",
- "address",
+ P_("Address"),
+ P_("The address"),
G_TYPE_INET_ADDRESS,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK));
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PORT,
g_param_spec_uint ("port",
- "port",
- "port",
+ P_("Port"),
+ P_("The port"),
0,
65535,
0,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK));
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
}
static void
* exceptions the binding could check for objects implemention %GInitable
* during normal construction and automatically initialize them, throwing
* an exception on failure.
- **/
+ */
GType
g_initable_get_type (void)
* of the first call. This is so that its safe to implement the singleton
* pattern in the GObject constructor function.
*
- * Returns: %TRUE if successful. If an error
- * has occurred, this function will return %FALSE and set @error
- * appropriately if present.
+ * Returns: %TRUE if successful. If an error has occurred, this function will
+ * return %FALSE and set @error appropriately if present.
*
* Since: 2.22
- **/
+ */
gboolean
g_initable_init (GInitable *initable,
GCancellable *cancellable,
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to
* ignore.
- * @first_property_name: the name of the first property, or %NULL if no properties
+ * @first_property_name: the name of the first property, or %NULL if no
+ * properties
* @...: the value if the first property, followed by and other property
* value pairs, and ended by %NULL.
*
* Return value: a newly allocated #GObject, or %NULL on error
*
* Since: 2.22
- **/
+ */
gpointer
g_initable_new (GType object_type,
GCancellable *cancellable,
* @parameters: the parameters to use to construct the object
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to
- * ignore.
+ * ignore.
*
* Helper function for constructing #GInitiable object. This is
* similar to g_object_newv() but also initializes the object
* Return value: a newly allocated #GObject, or %NULL on error
*
* Since: 2.22
- **/
+ */
gpointer
g_initable_newv (GType object_type,
guint n_parameters,
* @var_args: The var args list generated from @first_property_name.
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to
- * ignore.
+ * ignore.
*
* Helper function for constructing #GInitiable object. This is
* similar to g_object_new_valist() but also initializes the object
* Return value: a newly allocated #GObject, or %NULL on error
*
* Since: 2.22
- **/
+ */
GObject*
g_initable_new_valist (GType object_type,
const gchar *first_property_name,
* @g_iface: The parent interface.
* @init: Initializes the object.
*
- * Provides an interface for initializing object such that initialization may fail.
+ * Provides an interface for initializing object such that initialization
+ * may fail.
*
* Since: 2.22
**/
/**
* GResolverError:
- * @G_RESOLVER_ERROR_NOT_FOUND: the requested name/address/service was not found
- * @G_RESOLVER_ERROR_TEMPORARY_FAILURE: the requested information could not be looked up due to a network error or similar problem
+ * @G_RESOLVER_ERROR_NOT_FOUND: the requested name/address/service was not
+ * found
+ * @G_RESOLVER_ERROR_TEMPORARY_FAILURE: the requested information could not
+ * be looked up due to a network error or similar problem
* @G_RESOLVER_ERROR_INTERNAL: unknown error
*
* An error code used with %G_RESOLVER_ERROR in a #GError returned
* from a #GResolver routine.
+ *
+ * Since: 2.22
*/
typedef enum {
G_RESOLVER_ERROR_NOT_FOUND,
* The protocol family of a #GSocketAddress. (These values are
* identical to the system defines %AF_INET, %AF_INET6 and %AF_UNIX,
* if available.)
+ *
+ * Since: 2.22
*/
typedef enum {
G_SOCKET_FAMILY_INVALID,
* GSocketType:
* @G_SOCKET_TYPE_INVALID: Type unknown or wrong
* @G_SOCKET_TYPE_STREAM: Reliable connection-based byte streams (e.g. TCP).
- * @G_SOCKET_TYPE_DATAGRAM: Connectionless, unreliable datagram passing. (e.g. UDP)
- * @G_SOCKET_TYPE_SEQPACKET: Reliable connection-based passing of datagrams of fixed maximum length (e.g. SCTP).
+ * @G_SOCKET_TYPE_DATAGRAM: Connectionless, unreliable datagram passing.
+ * (e.g. UDP)
+ * @G_SOCKET_TYPE_SEQPACKET: Reliable connection-based passing of datagrams
+ * of fixed maximum length (e.g. SCTP).
*
- * Flags used when creating a #GSocket. Some protocols may not implement all the socket types.
+ * Flags used when creating a #GSocket. Some protocols may not implement
+ * all the socket types.
*
* Since: 2.22
*/
* GSocketMsgFlags:
* @G_SOCKET_MSG_NONE: No flags.
* @G_SOCKET_MSG_OOB: Request to send/receive out of band data.
- * @G_SOCKET_MSG_PEEK: Read data from the socket without removing it from the queue.
- * @G_SOCKET_MSG_DONTROUTE: Don't use a gateway to send out the packet, only send to hosts on directly connected networks.
+ * @G_SOCKET_MSG_PEEK: Read data from the socket without removing it from
+ * the queue.
+ * @G_SOCKET_MSG_DONTROUTE: Don't use a gateway to send out the packet,
+ * only send to hosts on directly connected networks.
*
- * Flags used in g_socket_receive_message() and g_socket_send_message(). The flags listed in the enum are
- * some commonly available flags, but the values used for them are the same as on the platform, and any other
- * flags are passed in/out as is. So to use a platform specific flag, just include the right system header and
- * pass in the flag.
+ * Flags used in g_socket_receive_message() and g_socket_send_message().
+ * The flags listed in the enum are some commonly available flags, but the
+ * values used for them are the same as on the platform, and any other flags
+ * are passed in/out as is. So to use a platform specific flag, just include
+ * the right system header and pass in the flag.
*
* Since: 2.22
*/
* GSocketProtocol:
* @G_SOCKET_PROTOCOL_UNKNOWN: The protocol type is unknown
* @G_SOCKET_PROTOCOL_DEFAULT: The default protocol for the family/type
- * @G_SOCKET_PROTOCOL_TCP: Tcp over IP
+ * @G_SOCKET_PROTOCOL_TCP: TCP over IP
* @G_SOCKET_PROTOCOL_UDP: UDP over IP
* @G_SOCKET_PROTOCOL_SCTP: SCTP over IP
*
- * A protocol identifier is specified when creating a #GSocket, which is a family/type
- * specific identifier, where 0 means the default protocol for the particular family/type.
- * This enum contains a set of commonly availible and used protocols. You can also
- * pass any other identifiers handled by the platform in order to use protocols not
- * listed here.
+ * A protocol identifier is specified when creating a #GSocket, which is a
+ * family/type specific identifier, where 0 means the default protocol for
+ * the particular family/type.
+ *
+ * This enum contains a set of commonly available and used protocols. You
+ * can also pass any other identifiers handled by the platform in order to
+ * use protocols not listed here.
*
* Since: 2.22
*/
* is actually shut down.
*
* Since: 2.22
- **/
+ */
enum
{
/**
* g_io_stream_is_closed:
- * @stream: a #GIOStream.
+ * @stream: a #GIOStream
*
* Checks if a stream is closed.
*
* Returns: %TRUE if the stream is closed.
*
* Since: 2.22
- **/
+ */
gboolean
g_io_stream_is_closed (GIOStream *stream)
{
/**
* g_io_stream_get_input_stream:
- * @stream: input #GIOStream.
+ * @stream: a #GIOStream
*
* Gets the input stream for this object. This is used
* for reading.
*
- * Returns: a #GInputStream, owned by the #GIOStream do not free.
+ * Returns: a #GInputStream, owned by the #GIOStream. Do not free.
*
* Since: 2.22
- **/
+ */
GInputStream *
-g_io_stream_get_input_stream (GIOStream *io_stream)
+g_io_stream_get_input_stream (GIOStream *stream)
{
GIOStreamClass *klass;
- klass = G_IO_STREAM_GET_CLASS (io_stream);
+ klass = G_IO_STREAM_GET_CLASS (stream);
g_assert (klass->get_input_stream != NULL);
- return klass->get_input_stream (io_stream);
+ return klass->get_input_stream (stream);
}
/**
* g_io_stream_get_output_stream:
- * @stream: input #GIOStream.
+ * @stream: a #GIOStream
*
* Gets the output stream for this object. This is used for
* writing.
*
- * Returns: a #GOutputStream, owned by the #GIOStream do not free.
+ * Returns: a #GOutputStream, owned by the #GIOStream. Do not free.
*
* Since: 2.22
- **/
+ */
GOutputStream *
-g_io_stream_get_output_stream (GIOStream *io_stream)
+g_io_stream_get_output_stream (GIOStream *stream)
{
GIOStreamClass *klass;
- klass = G_IO_STREAM_GET_CLASS (io_stream);
+ klass = G_IO_STREAM_GET_CLASS (stream);
g_assert (klass->get_output_stream != NULL);
- return klass->get_output_stream (io_stream);
+ return klass->get_output_stream (stream);
}
/**
* g_io_stream_has_pending:
- * @stream: a #GIOStream.
+ * @stream: a #GIOStream
*
* Checks if a stream has pending actions.
*
- * Returns: %TRUE if @stream has pending actions.
+ * Returns: %TRUE if @stream has pending actions.
*
* Since: 2.22
**/
/**
* g_io_stream_set_pending:
- * @stream: a #GIOStream.
- * @error: a #GError location to store the error occuring, or %NULL to
- * ignore.
+ * @stream: a #GIOStream
+ * @error: a #GError location to store the error occuring, or %NULL to
+ * ignore
*
* Sets @stream to have actions pending. If the pending flag is
* already set or @stream is closed, it will return %FALSE and set
* Return value: %TRUE if pending was previously unset and is now set.
*
* Since: 2.22
- **/
+ */
gboolean
-g_io_stream_set_pending (GIOStream *stream,
- GError **error)
+g_io_stream_set_pending (GIOStream *stream,
+ GError **error)
{
g_return_val_if_fail (G_IS_IO_STREAM (stream), FALSE);
/**
* g_io_stream_clear_pending:
- * @stream: output stream
+ * @stream: a #GIOStream
*
* Clears the pending flag on @stream.
*
* Since: 2.22
- **/
+ */
void
g_io_stream_clear_pending (GIOStream *stream)
{
}
static gboolean
-g_io_stream_real_close (GIOStream *stream,
- GCancellable *cancellable,
- GError **error)
+g_io_stream_real_close (GIOStream *stream,
+ GCancellable *cancellable,
+ GError **error)
{
gboolean res;
/**
* g_io_stream_close:
- * @stream: A #GIOStream.
- * @cancellable: optional #GCancellable object, %NULL to ignore.
+ * @stream: a #GIOStream
+ * @cancellable: optional #GCancellable object, %NULL to ignore
* @error: location to store the error occuring, or %NULL to ignore
*
* Closes the stream, releasing resources related to it. This will also
* closes the individual input and output streams, if they are not already
* closed.
*
- * Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED.
- * Closing a stream multiple times will not return an error.
+ * Once the stream is closed, all other operations will return
+ * %G_IO_ERROR_CLOSED. Closing a stream multiple times will not
+ * return an error.
*
- * Closing a stream will automatically flush any outstanding buffers in the
- * stream.
+ * Closing a stream will automatically flush any outstanding buffers
+ * in the stream.
*
* Streams will be automatically closed when the last reference
* is dropped, but you might want to call this function to make sure
* resources are released as early as possible.
*
- * Some streams might keep the backing store of the stream (e.g. a file descriptor)
- * open after the stream is closed. See the documentation for the individual
- * stream for details.
+ * Some streams might keep the backing store of the stream (e.g. a file
+ * descriptor) open after the stream is closed. See the documentation for
+ * the individual stream for details.
*
- * On failure the first error that happened will be reported, but the close
- * operation will finish as much as possible. A stream that failed to
- * close will still return %G_IO_ERROR_CLOSED for all operations. Still, it
- * is important to check and report the error to the user, otherwise
- * there might be a loss of data as all data might not be written.
+ * On failure the first error that happened will be reported, but the
+ * close operation will finish as much as possible. A stream that failed
+ * to close will still return %G_IO_ERROR_CLOSED for all operations.
+ * Still, it is important to check and report the error to the user,
+ * otherwise there might be a loss of data as all data might not be written.
*
* If @cancellable is not NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* Return value: %TRUE on success, %FALSE on failure
*
* Since: 2.22
- **/
+ */
gboolean
-g_io_stream_close (GIOStream *stream,
+g_io_stream_close (GIOStream *stream,
GCancellable *cancellable,
GError **error)
{
/**
* g_io_stream_close_async:
- * @stream: A #GIOStream.
- * @io_priority: the io priority of the request.
+ * @stream: a #GIOStream
+ * @io_priority: the io priority of the request
* @callback: callback to call when the request is satisfied
* @user_data: the data to pass to callback function
* @cancellable: optional cancellable object
*
* For behaviour details see g_io_stream_close().
*
- * The asyncronous methods have a default fallback that uses threads
+ * The asynchronous methods have a default fallback that uses threads
* to implement asynchronicity, so they are optional for inheriting
* classes. However, if you override one you must override all.
*
* Since: 2.22
- **/
+ */
void
g_io_stream_close_async (GIOStream *stream,
int io_priority,
/**
* g_io_stream_close_finish:
- * @stream: a #GIOStream.
- * @result: a #GAsyncResult.
+ * @stream: a #GIOStream
+ * @result: a #GAsyncResult
* @error: a #GError location to store the error occuring, or %NULL to
- * ignore.
+ * ignore
*
* Closes a stream.
*
* Returns: %TRUE if stream was successfully closed, %FALSE otherwise.
*
* Since: 2.22
- **/
+ */
gboolean
-g_io_stream_close_finish (GIOStream *stream,
- GAsyncResult *result,
- GError **error)
+g_io_stream_close_finish (GIOStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
GIOStreamClass *class;
GError *error = NULL;
gboolean result;
- /* Auto handling of cancelation disabled, and ignore
- cancellation, since we want to close things anyway, although
- possibly in a quick-n-dirty way. At least we never want to leak
- open handles */
-
+ /* Auto handling of cancelation disabled, and ignore cancellation,
+ * since we want to close things anyway, although possibly in a
+ * quick-n-dirty way. At least we never want to leak open handles
+ */
class = G_IO_STREAM_GET_CLASS (object);
if (class->close_fn)
{
}
static void
-g_io_stream_real_close_async (GIOStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_io_stream_real_close_async (GIOStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *res;
}
static gboolean
-g_io_stream_real_close_finish (GIOStream *stream,
+g_io_stream_real_close_finish (GIOStream *stream,
GAsyncResult *result,
GError **error)
{
* This is the function type of the callback used for the #GSource
* returned by g_socket_create_source().
*
- * Returns: it should return FALSE if the source should be removed.
+ * Returns: it should return %FALSE if the source should be removed.
*
* Since: 2.22
*/
/**
* GInputVector:
* @buffer: Pointer to a buffer where data will be written.
- * @size: the availible size in @buffer.
+ * @size: the available size in @buffer.
*
* Structure used for scatter/gather data input.
- * You generally pass in an array of #GInputVector<!-- -->s and the operation
- * will store the read data starting in the first buffer, switching to
- * the next as needed.
+ * You generally pass in an array of #GInputVector<!-- -->s
+ * and the operation will store the read data starting in the
+ * first buffer, switching to the next as needed.
*
* Since: 2.22
*/
* @size: the size of @buffer.
*
* Structure used for scatter/gather data output.
- * You generally pass in an array of #GOutputVector<!-- -->s and the operation
- * will use all the buffers as if they were one buffer.
+ * You generally pass in an array of #GOutputVector<!-- -->s
+ * and the operation will use all the buffers as if they were
+ * one buffer.
*
* Since: 2.22
*/
*
* See #GSocketConnectable for and example of using the connectable
* interface.
- **/
+ */
/**
* GNetworkAddress:
*
* A #GSocketConnectable for resolving a hostname and connecting to
* that host.
- **/
+ */
struct _GNetworkAddressPrivate {
gchar *hostname;
P_("Hostname"),
P_("Hostname to resolve"),
NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PORT,
g_param_spec_uint ("port",
P_("Port"),
P_("Network port"),
0, 65535, 0,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
}
static void
{
GNetworkAddress *addr = G_NETWORK_ADDRESS (object);
- switch (prop_id)
+ switch (prop_id)
{
case PROP_HOSTNAME:
if (addr->priv->hostname)
GNetworkAddress *addr = G_NETWORK_ADDRESS (object);
switch (prop_id)
- {
+ {
case PROP_HOSTNAME:
g_value_set_string (value, addr->priv->hostname);
break;
* Return value: the new #GNetworkAddress
*
* Since: 2.22
- **/
+ */
GSocketConnectable *
g_network_address_new (const gchar *hostname,
guint16 port)
*
* @host_and_port may be in any of a number of recognised formats: an IPv6
* address, an IPv4 address, or a domain name (in which case a DNS
- * lookup is performed). Quoting with [] is supported for all address
- * types. A port override may be specified in the usual way with a
- * colon. Ports may be given as decimal numbers or symbolic names (in
+ * lookup is performed). Quoting with [] is supported for all address
+ * types. A port override may be specified in the usual way with a
+ * colon. Ports may be given as decimal numbers or symbolic names (in
* which case an /etc/services lookup is performed).
*
* If no port is specified in @host_and_port then @default_port will be
* used as the port number to connect to.
*
- * In general, @host_and_port is expected to be provided by the user (allowing
- * them to give the hostname, and a port overide if necessary) and
- * @default_port is expected to be provided by the application.
+ * In general, @host_and_port is expected to be provided by the user
+ * (allowing them to give the hostname, and a port overide if necessary)
+ * and @default_port is expected to be provided by the application.
*
* Return value: the new #GNetworkAddress, or %NULL on error
*
* Since: 2.22
- **/
+ */
GSocketConnectable *
-g_network_address_parse (const char *host_and_port,
- guint16 default_port,
- GError **error)
+g_network_address_parse (const gchar *host_and_port,
+ guint16 default_port,
+ GError **error)
{
GSocketConnectable *connectable;
const gchar *port;
* Return value: @addr's hostname
*
* Since: 2.22
- **/
+ */
const gchar *
g_network_address_get_hostname (GNetworkAddress *addr)
{
*
* Gets @addr's port number
*
- * Return value: @addr's port (which may be %0)
+ * Return value: @addr's port (which may be 0)
*
* Since: 2.22
- **/
+ */
guint16
g_network_address_get_port (GNetworkAddress *addr)
{
};
-GType g_network_address_get_type (void) G_GNUC_CONST;
+GType g_network_address_get_type (void) G_GNUC_CONST;
-GSocketConnectable *g_network_address_new (const gchar *hostname,
- guint16 port);
-GSocketConnectable *g_network_address_parse (const char *host_and_port,
- guint16 default_port,
- GError **error);
-const gchar *g_network_address_get_hostname (GNetworkAddress *addr);
-guint16 g_network_address_get_port (GNetworkAddress *addr);
+GSocketConnectable *g_network_address_new (const gchar *hostname,
+ guint16 port);
+GSocketConnectable *g_network_address_parse (const gchar *host_and_port,
+ guint16 default_port,
+ GError **error);
+const gchar *g_network_address_get_hostname (GNetworkAddress *addr);
+guint16 g_network_address_get_port (GNetworkAddress *addr);
G_END_DECLS
* See #GSrvTarget for more information about SRV records, and see
* #GSocketConnectable for and example of using the connectable
* interface.
- **/
+ */
/**
* GNetworkService:
*
* A #GSocketConnectable for resolving a SRV record and connecting to
* that service.
- **/
+ */
struct _GNetworkServicePrivate
{
P_("Service"),
P_("Service name, eg \"ldap\""),
NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PROTOCOL,
g_param_spec_string ("protocol",
P_("Protocol"),
P_("Network protocol, eg \"tcp\""),
NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_DOMAIN,
g_param_spec_string ("domain",
- P_("domain"),
+ P_("Domain"),
P_("Network domain, eg, \"example.com\""),
NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
}
static void
{
GNetworkService *srv = G_NETWORK_SERVICE (object);
- switch (prop_id)
+ switch (prop_id)
{
case PROP_SERVICE:
srv->priv->service = g_value_dup_string (value);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
-
}
static void
GNetworkService *srv = G_NETWORK_SERVICE (object);
switch (prop_id)
- {
+ {
case PROP_SERVICE:
g_value_set_string (value, g_network_service_get_service (srv));
break;
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
-
}
/**
* Return value: a new #GNetworkService
*
* Since: 2.22
- **/
+ */
GSocketConnectable *
g_network_service_new (const gchar *service,
const gchar *protocol,
* Return value: @srv's service name
*
* Since: 2.22
- **/
+ */
const gchar *
g_network_service_get_service (GNetworkService *srv)
{
* Return value: @srv's protocol name
*
* Since: 2.22
- **/
+ */
const gchar *
g_network_service_get_protocol (GNetworkService *srv)
{
* Return value: @srv's domain name
*
* Since: 2.22
- **/
+ */
const gchar *
g_network_service_get_domain (GNetworkService *srv)
{
* many threads/processes, etc it should allocate for concurrent DNS
* resolutions.
*
- * Return value: the #GResolver.
+ * Return value: the default #GResolver.
*
* Since: 2.22
- **/
+ */
GResolver *
g_resolver_get_default (void)
{
* %G_IO_ERROR_CANCELLED.
*
* Return value: a hostname (either ASCII-only, or in ASCII-encoded
- * form), or %NULL on error.
+ * form), or %NULL on error.
*
* Since: 2.22
*/
* Error domain for #GResolver. Errors in this domain will be from the
* #GResolverError enumeration. See #GError for more information on
* error domains.
- **/
+ */
#define G_RESOLVER_ERROR (g_resolver_error_quark ())
GQuark g_resolver_error_quark (void);
* if it tries to write to %stdout after it has been closed.
*
* Since: 2.22
- **/
+ */
static void g_socket_initable_iface_init (GInitableIface *iface);
static gboolean g_socket_initable_init (GInitable *initable,
P_("The sockets address family"),
G_TYPE_SOCKET_FAMILY,
G_SOCKET_FAMILY_INVALID,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_TYPE,
g_param_spec_enum ("type",
P_("The sockets type"),
G_TYPE_SOCKET_TYPE,
G_SOCKET_TYPE_STREAM,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PROTOCOL,
g_param_spec_enum ("protocol",
- P_("Socket protocol"),
- P_("The id of the protocol to use, or -1 for unknown"),
+ P_("Socket protocol"),
+ P_("The id of the protocol to use, or -1 for unknown"),
G_TYPE_SOCKET_PROTOCOL,
G_SOCKET_PROTOCOL_UNKNOWN,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_FD,
g_param_spec_int ("fd",
G_MININT,
G_MAXINT,
-1,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_BLOCKING,
g_param_spec_boolean ("blocking",
P_("blocking"),
P_("Whether or not I/O on this socket is blocking"),
TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_LISTEN_BACKLOG,
g_param_spec_int ("listen-backlog",
P_("Listen backlog"),
- P_("outstanding connections in the listen queue"),
+ P_("Outstanding connections in the listen queue"),
0,
SOMAXCONN,
10,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_KEEPALIVE,
g_param_spec_boolean ("keepalive",
P_("Keep connection alive"),
P_("Keep connection alive by sending periodic pings"),
FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_LOCAL_ADDRESS,
g_param_spec_object ("local-address",
P_("Local address"),
P_("The local address the socket is bound to"),
G_TYPE_SOCKET_ADDRESS,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_REMOTE_ADDRESS,
g_param_spec_object ("remote-address",
P_("Remote address"),
P_("The remote address the socket is connected to"),
G_TYPE_SOCKET_ADDRESS,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
}
static void
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GSocket *
-g_socket_new (GSocketFamily family,
- GSocketType type,
- GSocketProtocol protocol,
- GError **error)
+g_socket_new (GSocketFamily family,
+ GSocketType type,
+ GSocketProtocol protocol,
+ GError **error)
{
return G_SOCKET (g_initable_new (G_TYPE_SOCKET,
NULL, error,
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GSocket *
-g_socket_new_from_fd (gint fd,
+g_socket_new_from_fd (gint fd,
GError **error)
{
return G_SOCKET (g_initable_new (G_TYPE_SOCKET,
* is a GSocket level feature.
*
* Since: 2.22
- **/
+ */
void
g_socket_set_blocking (GSocket *socket,
gboolean blocking)
* Returns: %TRUE if blocking I/O is used, %FALSE otherwise.
*
* Since: 2.22
- **/
+ */
gboolean
g_socket_get_blocking (GSocket *socket)
{
* remote side is disconnected, so as to avoid leaking resources forever.
*
* Since: 2.22
- **/
+ */
void
-g_socket_set_keepalive (GSocket *socket,
- gboolean keepalive)
+g_socket_set_keepalive (GSocket *socket,
+ gboolean keepalive)
{
int value;
* Returns: %TRUE if keepalive is active, %FALSE otherwise.
*
* Since: 2.22
- **/
+ */
gboolean
g_socket_get_keepalive (GSocket *socket)
{
* Returns: the maximum number of pending connections.
*
* Since: 2.22
- **/
+ */
gint
-g_socket_get_listen_backlog (GSocket *socket)
+g_socket_get_listen_backlog (GSocket *socket)
{
g_return_val_if_fail (G_IS_SOCKET (socket), 0);
* effect if called after that.
*
* Since: 2.22
- **/
+ */
void
g_socket_set_listen_backlog (GSocket *socket,
- gint backlog)
+ gint backlog)
{
g_return_if_fail (G_IS_SOCKET (socket));
g_return_if_fail (!socket->priv->listening);
* Returns: a #GSocketFamily
*
* Since: 2.22
- **/
+ */
GSocketFamily
g_socket_get_family (GSocket *socket)
{
* Returns: a #GSocketType
*
* Since: 2.22
- **/
+ */
GSocketType
g_socket_get_socket_type (GSocket *socket)
{
* Returns: a protocol id, or -1 if unknown
*
* Since: 2.22
- **/
+ */
GSocketProtocol
g_socket_get_protocol (GSocket *socket)
{
* Returns: the file descriptor of the socket.
*
* Since: 2.22
- **/
+ */
int
g_socket_get_fd (GSocket *socket)
{
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GSocketAddress *
g_socket_get_local_address (GSocket *socket,
GError **error)
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GSocketAddress *
g_socket_get_remote_address (GSocket *socket,
GError **error)
* Returns: %TRUE if socket is connected, %FALSE otherwise.
*
* Since: 2.22
- **/
+ */
gboolean
g_socket_is_connected (GSocket *socket)
{
* Returns: %TRUE on success, %FALSE on error.
*
* Since: 2.22
- **/
+ */
gboolean
g_socket_listen (GSocket *socket,
GError **error)
* Returns: %TRUE on success, %FALSE on error.
*
* Since: 2.22
- **/
+ */
gboolean
g_socket_bind (GSocket *socket,
GSocketAddress *address,
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GSocket *
g_socket_accept (GSocket *socket,
GError **error)
if (!check_socket (socket, error))
return NULL;
- while (1)
+ while (TRUE)
{
if (socket->priv->blocking &&
!g_socket_condition_wait (socket,
* the default address for g_socket_send() and discards all incoming datagrams
* from other sources.
*
- * Generally connection oriented sockets can only connect once, but connection-less
- * sockets can connect multiple times to change the default address.
+ * Generally connection oriented sockets can only connect once, but
+ * connection-less sockets can connect multiple times to change the
+ * default address.
*
* If the connect call needs to do network I/O it will block, unless
* non-blocking I/O is enabled. Then %G_IO_ERROR_PENDING is returned
* Returns: %TRUE if connected, %FALSE on error.
*
* Since: 2.22
- **/
+ */
gboolean
g_socket_connect (GSocket *socket,
GSocketAddress *address,
* @socket: a #GSocket
* @error: #GError for error reporting, or %NULL to ignore.
*
- * Checks and resets the pending connect error for the socket. This is
- * used to check for errors when g_socket_connect() is used in non-blocking mode.
+ * Checks and resets the pending connect error for the socket.
+ * This is used to check for errors when g_socket_connect() is
+ * used in non-blocking mode.
*
* Returns: %TRUE if no error, %FALSE otherwise, setting @error to the error
*
* Since: 2.22
- **/
+ */
gboolean
g_socket_check_connect_result (GSocket *socket,
GError **error)
/**
* g_socket_receive:
* @socket: a #GSocket
- * @buffer: a buffer to read data into (which should be at least count bytes long).
+ * @buffer: a buffer to read data into (which should be at least @size
+ * bytes long).
* @size: the number of bytes that will be read from the stream
* @error: #GError for error reporting, or %NULL to ignore.
*
* Returns: Number of bytes read, or -1 on error
*
* Since: 2.22
- **/
+ */
gssize
-g_socket_receive (GSocket *socket,
- gchar *buffer,
- gsize size,
- GError **error)
+g_socket_receive (GSocket *socket,
+ gchar *buffer,
+ gsize size,
+ GError **error)
{
gssize ret;
* g_socket_receive_from:
* @socket: a #GSocket
* @address: a pointer to a #GSocketAddress pointer, or %NULL
- * @buffer: a buffer to read data into (which should be at least count bytes long).
+ * @buffer: a buffer to read data into (which should be at least @size
+ * bytes long).
* @size: the number of bytes that will be read from the stream
* @error: #GError for error reporting, or %NULL to ignore.
*
* Returns: Number of bytes read, or -1 on error
*
* Since: 2.22
- **/
+ */
gssize
-g_socket_receive_from (GSocket *socket,
- GSocketAddress **address,
- gchar *buffer,
- gsize size,
- GError **error)
+g_socket_receive_from (GSocket *socket,
+ GSocketAddress **address,
+ gchar *buffer,
+ gsize size,
+ GError **error)
{
GInputVector v;
* @size: the number of bytes to send
* @error: #GError for error reporting, or %NULL to ignore.
*
- * Tries to send @size bytes from @buffer on the socket. This is mainly used by
- * connection oriented sockets, it is identical to g_socket_send_to()
- * with @address set to %NULL.
+ * Tries to send @size bytes from @buffer on the socket.
+ * This is mainly used by connection oriented sockets, it is identical
+ * to g_socket_send_to() with @address set to %NULL.
*
* If the socket is in blocking mode the call will block until there is
* space for the data in the socket queue. If there is no space available
* and the socket is in non-blocking mode a %G_IO_ERROR_WOULD_BLOCK error
- * will be returned. To be notified of available space, wait for the %G_IO_OUT
- * condition.
+ * will be returned. To be notified of available space, wait for the
+ * %G_IO_OUT condition.
*
* Note that on Windows you can't rely on a %G_IO_OUT condition
* not producing a %G_IO_ERROR_WOULD_BLOCK error, as this is how Winsock
* Returns: Number of bytes read, or -1 on error
*
* Since: 2.22
- **/
+ */
gssize
g_socket_send (GSocket *socket,
const gchar *buffer,
* Returns: Number of bytes read, or -1 on error
*
* Since: 2.22
- **/
+ */
gssize
-g_socket_send_to (GSocket *socket,
- GSocketAddress *address,
- const gchar *buffer,
- gsize size,
- GError **error)
+g_socket_send_to (GSocket *socket,
+ GSocketAddress *address,
+ const gchar *buffer,
+ gsize size,
+ GError **error)
{
GOutputVector v;
* Returns: %TRUE on success, %FALSE on error
*
* Since: 2.22
- **/
+ */
gboolean
-g_socket_shutdown (GSocket *socket,
- gboolean shutdown_read,
- gboolean shutdown_write,
- GError **error)
+g_socket_shutdown (GSocket *socket,
+ gboolean shutdown_read,
+ gboolean shutdown_write,
+ GError **error)
{
int how;
*
* Closes the socket, shutting down any active connection.
*
- * Closing a socket does not wait for all outstanding I/O operations to finish,
- * so the caller should not rely on them to be guaranteed to complete even
- * if the close returns with no error.
+ * Closing a socket does not wait for all outstanding I/O operations
+ * to finish, so the caller should not rely on them to be guaranteed
+ * to complete even if the close returns with no error.
*
- * Once the socket is closed, all other operations will return %G_IO_ERROR_CLOSED.
- * Closing a stream multiple times will not return an error.
+ * Once the socket is closed, all other operations will return
+ * %G_IO_ERROR_CLOSED. Closing a stream multiple times will not
+ * return an error.
*
* Sockets will be automatically closed when the last reference
* is dropped, but you might want to call this function to make sure
* Returns: %TRUE on success, %FALSE on error
*
* Since: 2.22
- **/
+ */
gboolean
-g_socket_close (GSocket *socket,
- GError **error)
+g_socket_close (GSocket *socket,
+ GError **error)
{
int res;
* Returns: %TRUE if socket is closed, %FALSE otherwise
*
* Since: 2.22
- **/
+ */
gboolean
g_socket_is_closed (GSocket *socket)
{
#ifdef G_OS_WIN32
/* Broken source, used on errors */
static gboolean
-broken_prepare (GSource *source,
- gint *timeout)
+broken_prepare (GSource *source,
+ gint *timeout)
{
return FALSE;
}
static gboolean
-broken_check (GSource *source)
+broken_check (GSource *source)
{
return FALSE;
}
static gboolean
-broken_dispatch (GSource *source,
- GSourceFunc callback,
- gpointer user_data)
+broken_dispatch (GSource *source,
+ GSourceFunc callback,
+ gpointer user_data)
{
return TRUE;
}
}
static void
-add_condition_watch (GSocket *socket,
+add_condition_watch (GSocket *socket,
GIOCondition *condition)
{
g_assert (g_list_find (socket->priv->requested_conditions, condition) == NULL);
}
static void
-remove_condition_watch (GSocket *socket,
+remove_condition_watch (GSocket *socket,
GIOCondition *condition)
{
g_assert (g_list_find (socket->priv->requested_conditions, condition) != NULL);
} GWinsockSource;
static gboolean
-winsock_prepare (GSource *source,
- gint *timeout)
+winsock_prepare (GSource *source,
+ gint *timeout)
{
GWinsockSource *winsock_source = (GWinsockSource *)source;
GIOCondition current_condition;
}
static gboolean
-winsock_check (GSource *source)
+winsock_check (GSource *source)
{
GWinsockSource *winsock_source = (GWinsockSource *)source;
GIOCondition current_condition;
}
static gboolean
-winsock_dispatch (GSource *source,
- GSourceFunc callback,
- gpointer user_data)
+winsock_dispatch (GSource *source,
+ GSourceFunc callback,
+ gpointer user_data)
{
GSocketSourceFunc func = (GSocketSourceFunc)callback;
GWinsockSource *winsock_source = (GWinsockSource *)source;
* Returns: a newly allocated %GSource, free with g_source_unref().
*
* Since: 2.22
- **/
+ */
GSource *
g_socket_create_source (GSocket *socket,
GIOCondition condition,
* @socket: a #GSocket
* @condition: a #GIOCondition mask to check
*
- * Checks on the readiness of @socket to perform operations. The
- * operations specified in @condition are checked for and masked
- * against the currently-satisfied conditions on @socket. The result
+ * Checks on the readiness of @socket to perform operations.
+ * The operations specified in @condition are checked for and masked
+ * against the currently-satisfied conditions on @socket. The result
* is returned.
*
* It is meaningless to specify %G_IO_ERR or %G_IO_HUP in condition;
* Returns: the @GIOCondition mask of the current state
*
* Since: 2.22
- **/
+ */
GIOCondition
-g_socket_condition_check (GSocket *socket,
- GIOCondition condition)
+g_socket_condition_check (GSocket *socket,
+ GIOCondition condition)
{
if (!check_socket (socket, NULL))
return 0;
* @cancellable: a #GCancellable, or %NULL
* @error: a #GError pointer, or %NULL
*
- * Waits for @condition to become true on @socket. When the condition
- * becomes true, %TRUE is returned.
+ * Waits for @condition to become true on @socket. When the condition
+ * is met, %TRUE is returned.
*
- * If @cancellable is cancelled before the condition becomes true then
- * %FALSE is returned and @error, if non-%NULL, is set to %G_IO_ERROR_CANCELLED.
+ * If @cancellable is cancelled before the condition is met then %FALSE
+ * is returned and @error, if non-%NULL, is set to %G_IO_ERROR_CANCELLED.
*
* Returns: %TRUE if the condition was met, %FALSE otherwise
*
* Since: 2.22
- **/
+ */
gboolean
g_socket_condition_wait (GSocket *socket,
GIOCondition condition,
* If @num_vector is -1, then @vector is assumed to be terminated
* by a #GOutputVector with a %NULL buffer pointer.
*
- *
* @messages, if non-%NULL, is taken to point to an array of @num_messages
* #GSocketControlMessage instances. These correspond to the control
* messages to be sent on the socket.
* Returns: Number of bytes read, or -1 on error
*
* Since: 2.22
- **/
+ */
gssize
g_socket_send_message (GSocket *socket,
GSocketAddress *address,
* Returns: Number of bytes read, or -1 on error
*
* Since: 2.22
- **/
+ */
gssize
g_socket_receive_message (GSocket *socket,
GSocketAddress **address,
* in the BSD sockets API. This is an abstract class; use
* #GInetSocketAddress for internet sockets, or #GUnixSocketAddress
* for UNIX domain sockets.
- **/
+ */
/**
* GSocketAddress:
*
* A socket endpoint address, corresponding to <type>struct sockaddr</type>
* or one of its subtypes.
- **/
+ */
enum
{
P_("The family of the socket address"),
G_TYPE_SOCKET_FAMILY,
G_SOCKET_FAMILY_INVALID,
- G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
}
static void
* g_socket_address_to_native().
*
* Returns: the size of the native <type>struct sockaddr</type> that
- * @address represents
+ * @address represents
*
* Since: 2.22
*/
* Since: 2.22
*/
gboolean
-g_socket_address_to_native (GSocketAddress *address,
- gpointer dest,
- gsize destlen,
- GError **error)
+g_socket_address_to_native (GSocketAddress *address,
+ gpointer dest,
+ gsize destlen,
+ GError **error)
{
g_return_val_if_fail (G_IS_SOCKET_ADDRESS (address), FALSE);
* ignored.
*
* Return value: a #GSocketAddress (owned by the caller), or %NULL on
- * error (in which case *@error will be set) or if there are no more
- * addresses.
- **/
+ * error (in which case *@error will be set) or if there are no
+ * more addresses.
+ */
GSocketAddress *
g_socket_address_enumerator_next (GSocketAddressEnumerator *enumerator,
GCancellable *cancellable,
* and so the synchronous method will never block.
*/
static void
-g_socket_address_enumerator_real_next_async (GSocketAddressEnumerator *enumerator,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_socket_address_enumerator_real_next_async (GSocketAddressEnumerator *enumerator,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *result;
GSocketAddress *address;
* Asynchronously retrieves the next #GSocketAddress from @enumerator
* and then calls @callback, which must call
* g_socket_address_enumerator_next_finish() to get the result.
- **/
+ */
void
-g_socket_address_enumerator_next_async (GSocketAddressEnumerator *enumerator,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_socket_address_enumerator_next_async (GSocketAddressEnumerator *enumerator,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSocketAddressEnumeratorClass *klass;
/**
* g_socket_address_enumerator_next_finish:
* @enumerator: a #GSocketAddressEnumerator
- * @result: a #GAsyncResult.
- * @error: a #GError.
+ * @result: a #GAsyncResult
+ * @error: a #GError
*
* Retrieves the result of a completed call to
* g_socket_address_enumerator_next_async(). See
* error handling.
*
* Return value: a #GSocketAddress (owned by the caller), or %NULL on
- * error (in which case *@error will be set) or if there are no more
- * addresses.
- **/
+ * error (in which case *@error will be set) or if there are no
+ * more addresses.
+ */
GSocketAddress *
g_socket_address_enumerator_next_finish (GSocketAddressEnumerator *enumerator,
GAsyncResult *result,
*
* Enumerator type for objects that contain or generate
* #GSocketAddress<!-- -->es.
- **/
+ */
typedef struct _GSocketAddressEnumeratorClass GSocketAddressEnumeratorClass;
struct _GSocketAddressEnumerator
* it will be a #GTcpConnection.
*
* Since: 2.22
- **/
+ */
G_DEFINE_TYPE (GSocketClient, g_socket_client, G_TYPE_OBJECT);
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GSocketClient *
g_socket_client_new (void)
{
* Returns: a #GSocketFamily
*
* Since: 2.22
- **/
+ */
GSocketFamily
g_socket_client_get_family (GSocketClient *client)
{
* be an ipv6 mapped to ipv4 address.
*
* Since: 2.22
- **/
+ */
void
g_socket_client_set_family (GSocketClient *client,
- GSocketFamily family)
+ GSocketFamily family)
{
if (client->priv->family == family)
return;
* Returns: a #GSocketFamily
*
* Since: 2.22
- **/
+ */
GSocketType
g_socket_client_get_socket_type (GSocketClient *client)
{
* as GSocketClient is used for connection oriented services.
*
* Since: 2.22
- **/
+ */
void
g_socket_client_set_socket_type (GSocketClient *client,
- GSocketType type)
+ GSocketType type)
{
if (client->priv->type == type)
return;
/**
* g_socket_client_get_protocol:
- * @client: a #GSocketClient.
+ * @client: a #GSocketClient
*
* Gets the protocol name type of the socket client.
*
* Returns: a #GSocketProtocol
*
* Since: 2.22
- **/
+ */
GSocketProtocol
g_socket_client_get_protocol (GSocketClient *client)
{
* protocol for the socket family and type.
*
* Since: 2.22
- **/
+ */
void
-g_socket_client_set_protocol (GSocketClient *client,
- GSocketProtocol protocol)
+g_socket_client_set_protocol (GSocketClient *client,
+ GSocketProtocol protocol)
{
if (client->priv->protocol == protocol)
return;
* Returns: a #GSocketAddres or %NULL. don't free
*
* Since: 2.22
- **/
+ */
GSocketAddress *
g_socket_client_get_local_address (GSocketClient *client)
{
* a specific interface.
*
* Since: 2.22
- **/
+ */
void
-g_socket_client_set_local_address (GSocketClient *client,
- GSocketAddress *address)
+g_socket_client_set_local_address (GSocketClient *client,
+ GSocketAddress *address)
{
if (address)
g_object_ref (address);
P_("The sockets address family to use for socket construction"),
G_TYPE_SOCKET_FAMILY,
G_SOCKET_FAMILY_INVALID,
- G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_TYPE,
g_param_spec_enum ("type",
P_("The sockets type to use for socket construction"),
G_TYPE_SOCKET_TYPE,
G_SOCKET_TYPE_STREAM,
- G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PROTOCOL,
g_param_spec_enum ("protocol",
P_("The protocol to use for socket construction, or 0 for default"),
G_TYPE_SOCKET_PROTOCOL,
G_SOCKET_PROTOCOL_DEFAULT,
- G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_LOCAL_ADDRESS,
g_param_spec_object ("local-address",
P_("Local address"),
P_("The local address constructed sockets will be bound to"),
G_TYPE_SOCKET_ADDRESS,
- G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
}
/**
* Returns: a #GSocketConnection on success, %NULL on error.
*
* Since: 2.22
- **/
+ */
GSocketConnection *
g_socket_client_connect (GSocketClient *client,
GSocketConnectable *connectable,
* In general, @host_and_port is expected to be provided by the user (allowing
* them to give the hostname, and a port overide if necessary) and
* @default_port is expected to be provided by the application.
-
+ *
* In the case that an IP address is given, a single connection
* attempt is made. In the case that a name is given, multiple
* connection attempts may be made, in turn and according to the
Returns: a #GSocketConnection on success, %NULL on error.
*
* Since: 2.22
- **/
+ */
GSocketConnection *
-g_socket_client_connect_to_host (GSocketClient *client,
- const char *host_and_port,
- int default_port,
- GCancellable *cancellable,
- GError **error)
+g_socket_client_connect_to_host (GSocketClient *client,
+ const gchar *host_and_port,
+ gint default_port,
+ GCancellable *cancellable,
+ GError **error)
{
GSocketConnectable *connectable;
GSocketConnection *connection;
* In the event of any failure (DNS error, service not found, no hosts
* connectable) %NULL is returned and @error (if non-%NULL) is set
* accordingly.
- **/
+ */
GSocketConnection *
g_socket_client_connect_to_service (GSocketClient *client,
- const char *domain,
- const char *service,
+ const gchar *domain,
+ const gchar *service,
GCancellable *cancellable,
GError **error)
{
* the result of the operation.
*
* Since: 2.22
- **/
+ */
void
g_socket_client_connect_async (GSocketClient *client,
GSocketConnectable *connectable,
* the result of the operation.
*
* Since: 2.22
- **/
+ */
void
g_socket_client_connect_to_host_async (GSocketClient *client,
- const char *host_and_port,
- int default_port,
+ const gchar *host_and_port,
+ gint default_port,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
*
* This is the asynchronous version of
* g_socket_client_connect_to_service().
- **/
+ *
+ * Since: 2.22
+ */
void
g_socket_client_connect_to_service_async (GSocketClient *client,
- const char *domain,
- const char *service,
+ const gchar *domain,
+ const gchar *service,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
* Returns: a #GSocketConnection on success, %NULL on error.
*
* Since: 2.22
- **/
+ */
GSocketConnection *
g_socket_client_connect_finish (GSocketClient *client,
GAsyncResult *result,
* Returns: a #GSocketConnection on success, %NULL on error.
*
* Since: 2.22
- **/
+ */
GSocketConnection *
-g_socket_client_connect_to_host_finish (GSocketClient *client,
- GAsyncResult *result,
- GError **error)
+g_socket_client_connect_to_host_finish (GSocketClient *client,
+ GAsyncResult *result,
+ GError **error)
{
return g_socket_client_connect_finish (client, result, error);
}
* Returns: a #GSocketConnection on success, %NULL on error.
*
* Since: 2.22
- **/
+ */
GSocketConnection *
-g_socket_client_connect_to_service_finish (GSocketClient *client,
- GAsyncResult *result,
- GError **error)
+g_socket_client_connect_to_service_finish (GSocketClient *client,
+ GAsyncResult *result,
+ GError **error)
{
return g_socket_client_connect_finish (client, result, error);
}
GCancellable *cancellable,
GError **error);
GSocketConnection * g_socket_client_connect_to_host (GSocketClient *client,
- const char *host_and_port,
- int default_port,
+ const gchar *host_and_port,
+ gint default_port,
GCancellable *cancellable,
GError **error);
GSocketConnection * g_socket_client_connect_to_service (GSocketClient *client,
- const char *domain,
- const char *service,
+ const gchar *domain,
+ const gchar *service,
GCancellable *cancellable,
GError **error);
void g_socket_client_connect_async (GSocketClient *client,
GAsyncResult *result,
GError **error);
void g_socket_client_connect_to_host_async (GSocketClient *client,
- const char *host_and_port,
- int default_port,
+ const gchar *host_and_port,
+ gint default_port,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GError **error);
void g_socket_client_connect_to_service_async (GSocketClient *client,
- const char *domain,
- const char *service,
+ const gchar *domain,
+ const gchar *service,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
* }
* }
* ]|
- **/
+ */
GType
g_socket_connectable_get_type (void)
* Return value: a new #GSocketAddressEnumerator.
*
* Since: 2.22
- **/
+ */
GSocketAddressEnumerator *
g_socket_connectable_enumerate (GSocketConnectable *connectable)
{
* GSocketConnectable:
*
* Interface for objects that contain or generate #GSocketAddress<!-- -->es.
- **/
+ */
typedef struct _GSocketConnectableIface GSocketConnectableIface;
/**
* @enumerate: Creates a #GSocketAddressEnumerator
*
* Provides an interface for returning a #GSocketAddressEnumerator
- **/
+ */
struct _GSocketConnectableIface
{
GTypeInterface g_iface;
* can be created either by #GSocketClient when connecting to a host,
* or by #GSocketListener when accepting a new client.
*
- * The type of the #GSocketConnection object returned from these calls depends
- * on the type of the underlying socket that is in use. For instance, for a
- * TCP/IP connection it will be a #GTcpConnection.
+ * The type of the #GSocketConnection object returned from these calls
+ * depends on the type of the underlying socket that is in use. For
+ * instance, for a TCP/IP connection it will be a #GTcpConnection.
*
- * Chosing what type of object to construct is done with the socket connection
- * factory, and it is possible for 3rd parties to register custom socket connection
- * types for specific combination of socket family/type/protocol using
- * g_socket_connection_factory_register_type().
+ * Chosing what type of object to construct is done with the socket
+ * connection factory, and it is possible for 3rd parties to register
+ * custom socket connection types for specific combination of socket
+ * family/type/protocol using g_socket_connection_factory_register_type().
*
* Since: 2.22
- **/
+ */
G_DEFINE_TYPE (GSocketConnection,
g_socket_connection, G_TYPE_IO_STREAM);
/**
* g_socket_connection_get_socket:
- * @connection: a #GSocketConnection.
+ * @connection: a #GSocketConnection
*
* Gets the underlying #GSocket object of the connection.
* This can be useful if you want to do something unusual on it
* Returns: a #GSocketAddress or %NULL on error.
*
* Since: 2.22
- **/
+ */
GSocket *
g_socket_connection_get_socket (GSocketConnection *connection)
{
/**
* g_socket_connection_get_local_address:
- * @connection: a #GSocketConnection.
+ * @connection: a #GSocketConnection
* @error: #GError for error reporting, or %NULL to ignore.
*
* Try to get the local address of a socket connection.
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GSocketAddress *
g_socket_connection_get_local_address (GSocketConnection *connection,
- GError **error)
+ GError **error)
{
return g_socket_get_local_address (connection->priv->socket, error);
}
/**
* g_socket_connection_get_remote_address:
- * @connection: a #GSocketConnection.
+ * @connection: a #GSocketConnection
* @error: #GError for error reporting, or %NULL to ignore.
*
* Try to get the remove address of a socket connection.
* Free the returned object with g_object_unref().
*
* Since: 2.22
- **/
+ */
GSocketAddress *
g_socket_connection_get_remote_address (GSocketConnection *connection,
- GError **error)
+ GError **error)
{
return g_socket_get_remote_address (connection->priv->socket, error);
}
static void
-g_socket_connection_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+g_socket_connection_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GSocketConnection *connection = G_SOCKET_CONNECTION (object);
}
static void
-g_socket_connection_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
+g_socket_connection_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GSocketConnection *connection = G_SOCKET_CONNECTION (object);
stream_class->close_async = g_socket_connection_close_async;
stream_class->close_finish = g_socket_connection_close_finish;
- g_object_class_install_property (gobject_class, PROP_SOCKET,
- g_param_spec_object ("socket",
- P_("Socket"),
- P_("The underlying GSocket"),
- G_TYPE_SOCKET, G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class,
+ PROP_SOCKET,
+ g_param_spec_object ("socket",
+ P_("Socket"),
+ P_("The underlying GSocket"),
+ G_TYPE_SOCKET,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
}
static void
}
static gboolean
-g_socket_connection_close (GIOStream *stream,
- GCancellable *cancellable,
- GError **error)
+g_socket_connection_close (GIOStream *stream,
+ GCancellable *cancellable,
+ GError **error)
{
GSocketConnection *connection = G_SOCKET_CONNECTION (stream);
static void
-g_socket_connection_close_async (GIOStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_socket_connection_close_async (GIOStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *res;
GIOStreamClass *class;
}
static gboolean
-g_socket_connection_close_finish (GIOStream *stream,
+g_socket_connection_close_finish (GIOStream *stream,
GAsyncResult *result,
GError **error)
{
/**
* g_socket_connection_factory_register_type:
- * @g_type: a #GType, inheriting from G_SOCKET_CONNECTION
- * @family: a #GSocketFamily.
+ * @g_type: a #GType, inheriting from %G_TYPE_SOCKET_CONNECTION
+ * @family: a #GSocketFamily
* @type: a #GSocketType
* @protocol: a protocol id
*
* If no type is registered, the #GSocketConnection base type is returned.
*
* Since: 2.22
- **/
+ */
void
-g_socket_connection_factory_register_type (GType g_type,
+g_socket_connection_factory_register_type (GType g_type,
GSocketFamily family,
- GSocketType type,
- gint protocol)
+ GSocketType type,
+ gint protocol)
{
ConnectionFactory *factory;
/**
* g_socket_connection_factory_lookup_type:
- * @family: a #GSocketFamily.
+ * @family: a #GSocketFamily
* @type: a #GSocketType
* @protocol_id: a protocol id
*
* If no type is registered, the #GSocketConnection base type is returned.
*
* Returns: a #GType
+ *
* Since: 2.22
- **/
+ */
GType
g_socket_connection_factory_lookup_type (GSocketFamily family,
- GSocketType type,
- gint protocol_id)
+ GSocketType type,
+ gint protocol_id)
{
ConnectionFactory *factory, key;
GType g_type;
/**
* g_socket_connection_factory_create_connection:
- * @socket: a #GSocket.
+ * @socket: a #GSocket
*
* Creates a #GSocketConnection subclass of the right type for
* @socket.
* Returns: a #GSocketConnection
*
* Since: 2.22
- **/
+ */
GSocketConnection *
g_socket_connection_factory_create_connection (GSocket *socket)
{
GType g_socket_connection_get_type (void) G_GNUC_CONST;
-GSocket *g_socket_connection_get_socket (GSocketConnection *connection);
-GSocketAddress *g_socket_connection_get_local_address (GSocketConnection *connection,
- GError **error);
-GSocketAddress *g_socket_connection_get_remote_address (GSocketConnection *connection,
- GError **error);
-void g_socket_connection_factory_register_type (GType g_type,
- GSocketFamily family,
- GSocketType type,
- gint protocol);
-GType g_socket_connection_factory_lookup_type (GSocketFamily family,
- GSocketType type,
- gint protocol_id);
-GSocketConnection *g_socket_connection_factory_create_connection (GSocket *socket);
+GSocket *g_socket_connection_get_socket (GSocketConnection *connection);
+GSocketAddress *g_socket_connection_get_local_address (GSocketConnection *connection,
+ GError **error);
+GSocketAddress *g_socket_connection_get_remote_address (GSocketConnection *connection,
+ GError **error);
+void g_socket_connection_factory_register_type (GType g_type,
+ GSocketFamily family,
+ GSocketType type,
+ gint protocol);
+GType g_socket_connection_factory_lookup_type (GSocketFamily family,
+ GSocketType type,
+ gint protocol_id);
+GSocketConnection *g_socket_connection_factory_create_connection (GSocket *socket);
G_END_DECLS
* @see_also: #GSocket.
*
* A #GSocketControlMessage is a special-purpose utility message that
- * can be sent to or received from a #GSocket. These types of
+ * can be sent to or received from a #GSocket. These types of
* messages are often called "ancillary data".
*
* The message can represent some sort of special instruction to or
* g_socket_receive_message() to read such a message.
*
* Since: 2.22
- **/
+ */
#include "config.h"
#include "gsocketcontrolmessage.h"
* Returns: The number of bytes required.
*
* Since: 2.22
- **/
+ */
gsize
g_socket_control_message_get_size (GSocketControlMessage *message)
{
* Returns the "level" (i.e. the originating protocol) of the control message.
* This is often SOL_SOCKET.
*
- * Returns: and int describing the level
+ * Returns: an integer describing the level
*
* Since: 2.22
- **/
+ */
int
g_socket_control_message_get_level (GSocketControlMessage *message)
{
* g_socket_control_message_get_msg_type:
* @message: a #GSocketControlMessage
*
- * Returns the protocol specify type of the control message.
- * For instance, for unix fd passing this would be SCM_RIGHTS.
+ * Returns the protocol specific type of the control message.
+ * For instance, for UNIX fd passing this would be SCM_RIGHTS.
*
- * Returns: and int describing the level
+ * Returns: an integer describing the type of control message
*
* Since: 2.22
- **/
+ */
int
g_socket_control_message_get_msg_type (GSocketControlMessage *message)
{
* object.
*
* Since: 2.22
- **/
+ */
void
g_socket_control_message_serialize (GSocketControlMessage *message,
gpointer data)
{
}
+/**
+ * g_socket_control_message_deserialize:
+ * @level:
+ * @type:
+ * @size:
+ * @data:
+ *
+ * Returns: the deserialized message
+ *
+ * Since: 2.22
+ */
GSocketControlMessage *
-g_socket_control_message_deserialize (int level,
- int type,
- gsize size,
- gpointer data)
+g_socket_control_message_deserialize (int level,
+ int type,
+ gsize size,
+ gpointer data)
{
GSocketControlMessageClass *klass;
GSocketControlMessage *message;
* Returns: a new #GSocketListener.
*
* Since: 2.22
- **/
+ */
GSocketListener *
g_socket_listener_new (void)
{
* Returns: %TRUE on success, %FALSE on error.
*
* Since: 2.22
- **/
+ */
gboolean
-g_socket_listener_add_socket (GSocketListener *listener,
- GSocket *socket,
- GObject *source_object,
- GError **error)
+g_socket_listener_add_socket (GSocketListener *listener,
+ GSocket *socket,
+ GObject *source_object,
+ GError **error)
{
if (!check_listener (listener, error))
return FALSE;
* Returns: %TRUE on success, %FALSE on error.
*
* Since: 2.22
- **/
+ */
gboolean
-g_socket_listener_add_address (GSocketListener *listener,
- GSocketAddress *address,
- GSocketType type,
- GSocketProtocol protocol,
- GObject *source_object,
- GError **error)
+g_socket_listener_add_address (GSocketListener *listener,
+ GSocketAddress *address,
+ GSocketType type,
+ GSocketProtocol protocol,
+ GObject *source_object,
+ GError **error)
{
GSocketFamily family;
GSocket *socket;
* Returns: %TRUE on success, %FALSE on error.
*
* Since: 2.22
- **/
+ */
gboolean
-g_socket_listener_add_inet_port (GSocketListener *listener,
- int port,
- GObject *source_object,
- GError **error)
+g_socket_listener_add_inet_port (GSocketListener *listener,
+ int port,
+ GObject *source_object,
+ GError **error)
{
GSocketAddress *address4, *address6;
GInetAddress *inet_address;
}
static GList *
-add_sources (GSocketListener *listener,
- GSocketSourceFunc callback,
- gpointer callback_data,
- GCancellable *cancellable,
- GMainContext *context)
+add_sources (GSocketListener *listener,
+ GSocketSourceFunc callback,
+ gpointer callback_data,
+ GCancellable *cancellable,
+ GMainContext *context)
{
GSocket *socket;
GSource *source;
};
static gboolean
-accept_callback (GSocket *socket,
- GIOCondition condition,
- gpointer user_data)
+accept_callback (GSocket *socket,
+ GIOCondition condition,
+ gpointer user_data)
{
struct AcceptData *data = user_data;
* object specified when the corresponding socket or address was added
* to the listener.
*
- * If @cancellable is not NULL, then the operation can be cancelled by
+ * If @cancellable is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
- * was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
+ * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* Returns: a #GSocket on success, %NULL on error.
*
* Since: 2.22
- **/
+ */
GSocket *
g_socket_listener_accept_socket (GSocketListener *listener,
GObject **source_object,
* object specified when the corresponding socket or address was added
* to the listener.
*
- * If @cancellable is not NULL, then the operation can be cancelled by
+ * If @cancellable is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
- * was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
+ * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* Returns: a #GSocketConnection on success, %NULL on error.
*
* Since: 2.22
- **/
+ */
GSocketConnection *
g_socket_listener_accept (GSocketListener *listener,
GObject **source_object,
};
static gboolean
-accept_ready (GSocket *accept_socket,
- GIOCondition condition,
- gpointer _data)
+accept_ready (GSocket *accept_socket,
+ GIOCondition condition,
+ gpointer _data)
{
struct AcceptAsyncData *data = _data;
GError *error = NULL;
* This is the asynchronous version of g_socket_listener_accept_socket().
*
* When the operation is finished @callback will be
- * called. You can then call g_socket_listener_accept_socket_finish() to get
- * the result of the operation.
+ * called. You can then call g_socket_listener_accept_socket_finish()
+ * to get the result of the operation.
*
* Since: 2.22
- **/
+ */
void
-g_socket_listener_accept_socket_async (GSocketListener *listener,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_socket_listener_accept_socket_async (GSocketListener *listener,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
struct AcceptAsyncData *data;
GError *error = NULL;
* Returns: a #GSocket on success, %NULL on error.
*
* Since: 2.22
- **/
+ */
GSocket *
-g_socket_listener_accept_socket_finish (GSocketListener *listener,
- GAsyncResult *result,
- GObject **source_object,
- GError **error)
+g_socket_listener_accept_socket_finish (GSocketListener *listener,
+ GAsyncResult *result,
+ GObject **source_object,
+ GError **error)
{
GSocket *socket;
GSimpleAsyncResult *simple;
* This is the asynchronous version of g_socket_listener_accept().
*
* When the operation is finished @callback will be
- * called. You can then call g_socket_listener_accept_socket() to get
- * the result of the operation.
+ * called. You can then call g_socket_listener_accept_socket()
+ * to get the result of the operation.
*
* Since: 2.22
- **/
+ */
void
g_socket_listener_accept_async (GSocketListener *listener,
GCancellable *cancellable,
* Returns: a #GSocketConnection on success, %NULL on error.
*
* Since: 2.22
- **/
+ */
GSocketConnection *
-g_socket_listener_accept_finish (GSocketListener *listener,
- GAsyncResult *result,
- GObject **source_object,
- GError **error)
+g_socket_listener_accept_finish (GSocketListener *listener,
+ GAsyncResult *result,
+ GObject **source_object,
+ GError **error)
{
GSocket *socket;
GSocketConnection *connection;
* See g_socket_set_listen_backlog() for details
*
* Since: 2.22
- **/
+ */
void
g_socket_listener_set_backlog (GSocketListener *listener,
- int listen_backlog)
+ int listen_backlog)
{
GSocket *socket;
int i;
* Closes all the sockets in the listener.
*
* Since: 2.22
- **/
+ */
void
g_socket_listener_close (GSocketListener *listener)
{
*
* A #GSocketService is an object that represents a service that is
* provided to the network or over local sockets. When a new
- * connection is made to the service the ::incoming signal is emitted.
+ * connection is made to the service the #GSocketService:incoming
+ * signal is emitted.
*
* A #GSocketService is a subclass of #GSocketListener and you need
* to add the addresses you want to accept connections on to the
* with the #GSocketListener APIs.
*
* There are two options for implementing a network service based on
- * #GSocketService. The first is to create the service using
- * g_socket_service_new() and to connect to the ::incoming signal.
- * The second is to subclass #GSocketService and override the default
- * signal handler implementation.
+ * #GSocketService. The first is to create the service using
+ * g_socket_service_new() and to connect to the #GSocketService:incoming
+ * signal. The second is to subclass #GSocketService and override the
+ * default signal handler implementation.
*
* In either case, the handler must immediately return, or else it
- * will block additional incoming connections from being serviced. If
- * you are interested in writing connection handlers that contain
+ * will block additional incoming connections from being serviced.
+ * If you are interested in writing connection handlers that contain
* blocking code then see #GThreadedSocketService.
*
* The socket service runs on the main loop in the main thread, and is
* not threadsafe in general. However, the calls to start and stop
* the service are threadsafe so these can be used from threads that
- * handle incomming clients.
+ * handle incoming clients.
*
* Since: 2.22
*/
* Returns: %TRUE if the service is active, %FALSE otherwise
*
* Since: 2.22
- **/
+ */
gboolean
g_socket_service_is_active (GSocketService *service)
{
* handling an incomming client request.
*
* Since: 2.22
- **/
+ */
void
g_socket_service_start (GSocketService *service)
{
* handling an incomming client request.
*
* Since: 2.22
- **/
+ */
void
-g_socket_service_stop (GSocketService *service)
+g_socket_service_stop (GSocketService *service)
{
G_LOCK (active);
* @returns: %TRUE if @connection has been handled.
*
* The ::incoming signal is emitted when a new incoming connection
- * to @service needs to be handled. The handler must initiate the
+ * to @service needs to be handled. The handler must initiate the
* handling of @connection, but may not block; in essence,
* asynchronous operations must be used.
*
- * If %TRUE is returned then no other handlers are called.
- **/
+ * Returns: %TRUE to stop other handlers from being called
+ *
+ * Since: 2.22
+ */
g_socket_service_incoming_signal =
g_signal_new ("incoming", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GSocketServiceClass, incoming),
* Returns: a new #GSocketService.
*
* Since: 2.22
- **/
+ */
GSocketService *
g_socket_service_new (void)
{
/**
* GSocketServiceClass:
* @incomming: signal emitted when new connections are accepted
- **/
+ */
struct _GSocketServiceClass
{
GSocketListenerClass parent_class;
* to the remote service, you can use #GNetworkService's
* #GSocketConnectable interface and not need to worry about
* #GSrvTarget at all.
- **/
+ */
struct _GSrvTarget {
gchar *hostname;
* Return value: the head of the sorted list.
*
* Since: 2.22
- */
+ */
GList *
g_srv_target_list_sort (GList *targets)
{
* Eventually, some TCP-specific socket stuff will be added.
*
* Since: 2.22
- **/
+ */
#include "config.h"
#include "gtcpconnection.h"
}
static gboolean
-g_tcp_connection_close (GIOStream *stream,
- GCancellable *cancellable,
- GError **error)
+g_tcp_connection_close (GIOStream *stream,
+ GCancellable *cancellable,
+ GError **error)
{
GTcpConnection *connection = G_TCP_CONNECTION (stream);
GSocket *socket;
}
static void
-async_close_finish (CloseAsyncData *data, GError *error, gboolean in_mainloop)
+async_close_finish (CloseAsyncData *data,
+ GError *error,
+ gboolean in_mainloop)
{
GIOStreamClass *parent = G_IO_STREAM_CLASS (g_tcp_connection_parent_class);
GIOStream *stream;
}
static gboolean
-close_read_ready (GSocket *socket,
- GIOCondition condition,
+close_read_ready (GSocket *socket,
+ GIOCondition condition,
CloseAsyncData *data)
{
GError *error = NULL;
static void
-g_tcp_connection_close_async (GIOStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_tcp_connection_close_async (GIOStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GTcpConnection *connection = G_TCP_CONNECTION (stream);
CloseAsyncData *data;
* take a while. For this reason it is disabled by default.
*
* Since: 2.22
- **/
+ */
void
g_tcp_connection_set_graceful_disconnect (GTcpConnection *connection,
gboolean graceful_disconnect)
* Returns: %TRUE if graceful disconnect is used on close, %FALSE otherwise
*
* Since: 2.22
- **/
+ */
gboolean
g_tcp_connection_get_graceful_disconnect (GTcpConnection *connection)
{
* The service automatically stops the #GSocketService from accepting
* new connections when all threads are busy.
*
- * As with #GSocketService, you may connect to ::run, or subclass and
- * override the default handler.
+ * As with #GSocketService, you may connect to #GThreadedSocketService:run,
+ * or subclass and override the default handler.
*/
#include "config.h"
* @service: the #GThreadedSocketService.
* @connection: a new #GSocketConnection object.
* @source_object: the source_object passed to g_socket_listener_add_address().
- * @returns: %TRUE if @connection has been handled.
*
* The ::run signal is emitted in a worker thread in response to an
- * incoming connection. This thread is dedicated to handling
- * @connection and may perform blocking IO. The signal handler need
+ * incoming connection. This thread is dedicated to handling
+ * @connection and may perform blocking IO. The signal handler need
* not return until the connection is closed.
*
- * If %TRUE is returned then no other handlers are called.
- **/
+ * Returns: %TRUE to stope further signal handlers from being called
+ */
g_threaded_socket_service_run_signal =
g_signal_new ("run", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GThreadedSocketServiceClass, run),
/**
* g_threaded_socket_service_new:
- * @returns: a new #GSocketService.
* @max_threads: the maximal number of threads to execute concurrently
- * handling incomming clients, -1 means no limit
+ * handling incoming clients, -1 means no limit
*
- * Creates a new #GThreadedSocketService with no listeners. Listeners
+ * Creates a new #GThreadedSocketService with no listeners. Listeners
* must be added with g_socket_service_add_listeners().
- **/
+ *
+ * Returns: a new #GSocketService.
+ *
+ * Since: 2.22
+ */
GSocketService *
g_threaded_socket_service_new (int max_threads)
{
* functionallity like passing file descriptors.
*
* Since: 2.22
- **/
+ */
#include <gio/gsocketcontrolmessage.h>
#include <gio/gunixfdmessage.h>
/**
* g_unix_connection_send_fd:
- * @connection: a #GUnixConnection.
+ * @connection: a #GUnixConnection
* @fd: a file descriptor
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting, or %NULL to ignore.
* Returns: a %TRUE on success, %NULL on error.
*
* Since: 2.22
- **/
+ */
gboolean
g_unix_connection_send_fd (GUnixConnection *connection,
gint fd,
/**
* g_unix_connection_receive_fd:
- * @connection: a #GUnixConnection.
- * @cancellable: optional #GCancellable object, %NULL to ignore.
- * @error: #GError for error reporting, or %NULL to ignore.
+ * @connection: a #GUnixConnection
+ * @cancellable: optional #GCancellable object, %NULL to ignore
+ * @error: #GError for error reporting, or %NULL to ignore
*
- * Recieves a file descriptor from the sending end of the
- * connection. The sending end has to call g_unix_connection_send_fd()
- * for this to work.
+ * Receives a file descriptor from the sending end of the connection.
+ * The sending end has to call g_unix_connection_send_fd() for this
+ * to work.
*
* As well as reading the fd this also reads a single byte from the
* stream, as this is required for fd passing to work on some
* Returns: a file descriptor on success, -1 on error.
*
* Since: 2.22
- **/
+ */
gint
g_unix_connection_receive_fd (GUnixConnection *connection,
GCancellable *cancellable,
* A #GSocketConnection for UNIX domain socket connections.
*
* Since: 2.22
- **/
+ */
typedef struct _GUnixConnection GUnixConnection;
typedef struct _GUnixConnectionPrivate GUnixConnectionPrivate;
typedef struct _GUnixConnectionClass GUnixConnectionClass;
* For an easier way to send and receive file descriptors over
* stream-oriented UNIX sockets, see g_unix_connection_send_fd() and
* g_unix_connection_receive_fd().
- **/
+ */
#include "config.h"
}
static GSocketControlMessage *
-g_unix_fd_message_deserialize (int level,
- int type,
- gsize size,
+g_unix_fd_message_deserialize (int level,
+ int type,
+ gsize size,
gpointer data)
{
GUnixFDMessage *message;
/**
* g_unix_fd_message_new:
- * @returns: a new #GUnixFDMessage
*
* Creates a new #GUnixFDMessage containing no file descriptors.
- **/
+ *
+ * Returns: a new #GUnixFDMessage
+ *
+ * Since: 2.22
+ */
GSocketControlMessage *
g_unix_fd_message_new (void)
{
* g_unix_fd_message_steal_fds:
* @message: a #GUnixFDMessage
* @length: pointer to the length of the returned array, or %NULL
- * @returns: an array of file descriptors
*
* Returns the array of file descriptors that is contained in this
* object.
*
* After this call, the descriptors are no longer contained in
- * @message. Further calls will return an empty list (unless more
+ * @message. Further calls will return an empty list (unless more
* descriptors have been added).
*
* The return result of this function must be freed with g_free().
* descriptors.
*
* If @length is non-%NULL then it is set to the number of file
- * descriptors in the returned array. The returned array is also
+ * descriptors in the returned array. The returned array is also
* terminated with -1.
*
- * This function never returns NULL. In case there are no file
+ * This function never returns %NULL. In case there are no file
* descriptors contained in @message, an empty array is returned.
- **/
+ *
+ * Returns: an array of file descriptors
+ *
+ * Since: 2.22
+ */
gint *
g_unix_fd_message_steal_fds (GUnixFDMessage *message,
- gint *length)
+ gint *length)
{
gint *result;
* @message: a #GUnixFDMessage
* @fd: a valid open file descriptor
* @error: a #GError pointer
- * @returns: %TRUE in case of success, else %FALSE (and @error is set)
*
* Adds a file descriptor to @message.
*
- * The file descriptor is duplicated using dup(). You keep your copy
+ * The file descriptor is duplicated using dup(). You keep your copy
* of the descriptor and the copy contained in @message will be closed
* when @message is finalized.
*
* A possible cause of failure is exceeding the per-process or
* system-wide file descriptor limit.
- **/
+ *
+ * Returns: %TRUE in case of success, else %FALSE (and @error is set)
+ *
+ * Since: 2.22
+ */
gboolean
g_unix_fd_message_append_fd (GUnixFDMessage *message,
- gint fd,
- GError **error)
+ gint fd,
+ GError **error)
{
gint new_fd;
GType g_unix_fd_message_get_type (void) G_GNUC_CONST;
GSocketControlMessage * g_unix_fd_message_new (void);
gint * g_unix_fd_message_steal_fds (GUnixFDMessage *message,
- gint *length);
+ gint *length);
gboolean g_unix_fd_message_append_fd (GUnixFDMessage *message,
- gint fd,
- GError **error);
+ gint fd,
+ GError **error);
G_END_DECLS
* @short_description: Unix #GSocketAddress
*
* Support for UNIX-domain (aka local) sockets.
- **/
+ */
/**
* GUnixSocketAddress:
*
* A UNIX-domain (local) socket address, corresponding to a
* <type>struct sockaddr_un</type>.
- **/
+ */
G_DEFINE_TYPE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS);
enum