Documentation and coding style fixups

Lots of pedanic changes.
This commit is contained in:
Matthias Clasen 2009-05-27 18:20:08 -04:00
parent eecbbb0a20
commit 06144900ec
38 changed files with 954 additions and 761 deletions

View File

@ -861,15 +861,15 @@ GUnixOutputStreamPrivate
<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
@ -1419,15 +1419,15 @@ g_inet_address_get_native_size
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

View File

@ -79,6 +79,7 @@ g_socket_msg_flags_get_type
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

View File

@ -38,16 +38,15 @@
* 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,
@ -108,17 +107,18 @@ g_async_initable_base_init (gpointer g_iface)
* @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.
@ -140,13 +140,13 @@ g_async_initable_base_init (gpointer g_iface)
* 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;
@ -167,16 +167,15 @@ g_async_initable_init_async (GAsyncInitable *initable,
* 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;
@ -210,11 +209,11 @@ async_init_thread (GSimpleAsyncResult *res,
}
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;
@ -228,9 +227,9 @@ g_async_initable_real_init_async (GAsyncInitable *initable,
}
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 */
}
@ -241,27 +240,30 @@ g_async_initable_real_init_finish (GAsyncInitable *initable,
* @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;
@ -282,25 +284,27 @@ g_async_initable_new_async (GType object_type,
* @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;
@ -322,25 +326,28 @@ g_async_initable_newv_async (GType object_type,
* @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;
@ -355,24 +362,26 @@ g_async_initable_new_valist_async (GType object_type,
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);

View File

@ -1717,10 +1717,10 @@ g_file_open_readwrite (GFile *file,
/**
* 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.
@ -1734,29 +1734,26 @@ g_file_open_readwrite (GFile *file,
* 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;
@ -1780,37 +1777,37 @@ g_file_create_readwrite (GFile *file,
/**
* 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;
@ -1834,9 +1831,9 @@ g_file_replace_readwrite (GFile *file,
/**
* 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
@ -2203,32 +2200,32 @@ g_file_open_readwrite_finish (GFile *file,
/**
* 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;
@ -2245,8 +2242,8 @@ g_file_create_readwrite_async (GFile *file,
/**
* 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
@ -2258,9 +2255,9 @@ g_file_create_readwrite_async (GFile *file,
* 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;
@ -2291,26 +2288,26 @@ g_file_create_readwrite_finish (GFile *file,
* @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;
@ -2340,11 +2337,11 @@ g_file_replace_readwrite_async (GFile *file,
* 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;

View File

@ -49,13 +49,13 @@
* 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()
@ -107,7 +107,7 @@ g_inet_address_set_property (GObject *object,
{
GInetAddress *address = G_INET_ADDRESS (object);
switch (prop_id)
switch (prop_id)
{
case PROP_FAMILY:
address->priv->family = g_value_get_enum (value);
@ -206,83 +206,178 @@ g_inet_address_class_init (GInetAddressClass *klass)
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

View File

@ -39,14 +39,14 @@
*
* 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 {
@ -159,10 +159,10 @@ g_inet_socket_address_get_native_size (GSocketAddress *address)
}
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;
@ -233,19 +233,23 @@ g_inet_socket_address_class_init (GInetSocketAddressClass *klass)
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

View File

@ -50,7 +50,7 @@
* 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)
@ -110,12 +110,11 @@ 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,
@ -136,7 +135,8 @@ g_initable_init (GInitable *initable,
* @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.
*
@ -147,7 +147,7 @@ g_initable_init (GInitable *initable,
* Return value: a newly allocated #GObject, or %NULL on error
*
* Since: 2.22
**/
*/
gpointer
g_initable_new (GType object_type,
GCancellable *cancellable,
@ -174,7 +174,7 @@ g_initable_new (GType object_type,
* @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
@ -183,7 +183,7 @@ g_initable_new (GType object_type,
* Return value: a newly allocated #GObject, or %NULL on error
*
* Since: 2.22
**/
*/
gpointer
g_initable_newv (GType object_type,
guint n_parameters,
@ -214,7 +214,7 @@ g_initable_newv (GType object_type,
* @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
@ -223,7 +223,7 @@ g_initable_newv (GType object_type,
* 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,

View File

@ -51,7 +51,8 @@ typedef struct _GInitableIface GInitableIface;
* @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
**/

View File

@ -482,12 +482,16 @@ typedef enum {
/**
* 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,
@ -505,6 +509,8 @@ typedef enum {
* 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,
@ -519,10 +525,13 @@ typedef enum {
* 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
*/
@ -538,13 +547,16 @@ typedef enum
* 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
*/
@ -560,15 +572,17 @@ typedef enum
* 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
*/

View File

@ -66,7 +66,7 @@ G_DEFINE_TYPE (GIOStream, g_io_stream, G_TYPE_OBJECT);
* is actually shut down.
*
* Since: 2.22
**/
*/
enum
{
@ -204,14 +204,14 @@ g_io_stream_class_init (GIOStreamClass *klass)
/**
* 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)
{
@ -222,56 +222,56 @@ 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
**/
@ -285,9 +285,9 @@ g_io_stream_has_pending (GIOStream *stream)
/**
* 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
@ -296,10 +296,10 @@ g_io_stream_has_pending (GIOStream *stream)
* 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);
@ -326,12 +326,12 @@ g_io_stream_set_pending (GIOStream *stream,
/**
* 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)
{
@ -341,9 +341,9 @@ 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;
@ -363,33 +363,34 @@ g_io_stream_real_close (GIOStream *stream,
/**
* 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
@ -403,9 +404,9 @@ g_io_stream_real_close (GIOStream *stream,
* 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)
{
@ -454,8 +455,8 @@ async_ready_close_callback_wrapper (GObject *source_object,
/**
* 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
@ -467,12 +468,12 @@ async_ready_close_callback_wrapper (GObject *source_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,
@ -516,21 +517,21 @@ g_io_stream_close_async (GIOStream *stream,
/**
* 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;
@ -563,11 +564,10 @@ close_async_thread (GSimpleAsyncResult *res,
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)
{
@ -581,11 +581,11 @@ close_async_thread (GSimpleAsyncResult *res,
}
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;
@ -604,7 +604,7 @@ g_io_stream_real_close_async (GIOStream *stream,
}
static gboolean
g_io_stream_real_close_finish (GIOStream *stream,
g_io_stream_real_close_finish (GIOStream *stream,
GAsyncResult *result,
GError **error)
{

View File

@ -280,7 +280,7 @@ typedef void (*GSimpleAsyncThreadFunc) (GSimpleAsyncResult *res,
* 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
*/
@ -291,12 +291,12 @@ typedef gboolean (*GSocketSourceFunc) (GSocket *socket,
/**
* 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
*/
@ -313,8 +313,9 @@ struct _GInputVector {
* @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
*/

View File

@ -57,14 +57,14 @@
*
* 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;
@ -129,13 +129,17 @@ g_network_address_class_init (GNetworkAddressClass *klass)
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
@ -159,7 +163,7 @@ g_network_address_set_property (GObject *object,
{
GNetworkAddress *addr = G_NETWORK_ADDRESS (object);
switch (prop_id)
switch (prop_id)
{
case PROP_HOSTNAME:
if (addr->priv->hostname)
@ -187,7 +191,7 @@ g_network_address_get_property (GObject *object,
GNetworkAddress *addr = G_NETWORK_ADDRESS (object);
switch (prop_id)
{
{
case PROP_HOSTNAME:
g_value_set_string (value, addr->priv->hostname);
break;
@ -233,7 +237,7 @@ g_network_address_set_addresses (GNetworkAddress *addr,
* Return value: the new #GNetworkAddress
*
* Since: 2.22
**/
*/
GSocketConnectable *
g_network_address_new (const gchar *hostname,
guint16 port)
@ -256,26 +260,26 @@ g_network_address_new (const gchar *hostname,
*
* @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;
@ -410,7 +414,7 @@ g_network_address_parse (const char *host_and_port,
* Return value: @addr's hostname
*
* Since: 2.22
**/
*/
const gchar *
g_network_address_get_hostname (GNetworkAddress *addr)
{
@ -425,10 +429,10 @@ 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)
{

View File

@ -53,15 +53,15 @@ struct _GNetworkAddressClass
};
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

View File

@ -53,14 +53,14 @@
* 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
{
@ -122,19 +122,25 @@ g_network_service_class_init (GNetworkServiceClass *klass)
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
@ -158,7 +164,7 @@ g_network_service_set_property (GObject *object,
{
GNetworkService *srv = G_NETWORK_SERVICE (object);
switch (prop_id)
switch (prop_id)
{
case PROP_SERVICE:
srv->priv->service = g_value_dup_string (value);
@ -176,7 +182,6 @@ g_network_service_set_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
@ -188,7 +193,7 @@ g_network_service_get_property (GObject *object,
GNetworkService *srv = G_NETWORK_SERVICE (object);
switch (prop_id)
{
{
case PROP_SERVICE:
g_value_set_string (value, g_network_service_get_service (srv));
break;
@ -205,7 +210,6 @@ g_network_service_get_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/**
@ -221,7 +225,7 @@ g_network_service_get_property (GObject *object,
* Return value: a new #GNetworkService
*
* Since: 2.22
**/
*/
GSocketConnectable *
g_network_service_new (const gchar *service,
const gchar *protocol,
@ -243,7 +247,7 @@ g_network_service_new (const gchar *service,
* Return value: @srv's service name
*
* Since: 2.22
**/
*/
const gchar *
g_network_service_get_service (GNetworkService *srv)
{
@ -261,7 +265,7 @@ 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)
{
@ -280,7 +284,7 @@ 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)
{

View File

@ -101,10 +101,10 @@ static GResolver *default_resolver;
* 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)
{
@ -353,7 +353,7 @@ g_resolver_free_addresses (GList *addresses)
* %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
*/

View File

@ -151,7 +151,7 @@ void g_resolver_free_targets (GList *targets);
* 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);

View File

@ -111,7 +111,7 @@
* 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,
@ -645,7 +645,9 @@ g_socket_class_init (GSocketClass *klass)
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",
@ -653,15 +655,19 @@ g_socket_class_init (GSocketClass *klass)
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",
@ -670,44 +676,51 @@ g_socket_class_init (GSocketClass *klass)
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
@ -786,12 +799,12 @@ g_socket_initable_init (GInitable *initable,
* 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,
@ -818,9 +831,9 @@ g_socket_new (GSocketFamily family,
* 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,
@ -844,7 +857,7 @@ g_socket_new_from_fd (gint fd,
* is a GSocket level feature.
*
* Since: 2.22
**/
*/
void
g_socket_set_blocking (GSocket *socket,
gboolean blocking)
@ -870,7 +883,7 @@ g_socket_set_blocking (GSocket *socket,
* Returns: %TRUE if blocking I/O is used, %FALSE otherwise.
*
* Since: 2.22
**/
*/
gboolean
g_socket_get_blocking (GSocket *socket)
{
@ -898,10 +911,10 @@ 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;
@ -934,7 +947,7 @@ g_socket_set_keepalive (GSocket *socket,
* Returns: %TRUE if keepalive is active, %FALSE otherwise.
*
* Since: 2.22
**/
*/
gboolean
g_socket_get_keepalive (GSocket *socket)
{
@ -953,9 +966,9 @@ 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);
@ -976,10 +989,10 @@ g_socket_get_listen_backlog (GSocket *socket)
* 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);
@ -1000,7 +1013,7 @@ g_socket_set_listen_backlog (GSocket *socket,
* Returns: a #GSocketFamily
*
* Since: 2.22
**/
*/
GSocketFamily
g_socket_get_family (GSocket *socket)
{
@ -1018,7 +1031,7 @@ g_socket_get_family (GSocket *socket)
* Returns: a #GSocketType
*
* Since: 2.22
**/
*/
GSocketType
g_socket_get_socket_type (GSocket *socket)
{
@ -1037,7 +1050,7 @@ 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)
{
@ -1059,7 +1072,7 @@ g_socket_get_protocol (GSocket *socket)
* Returns: the file descriptor of the socket.
*
* Since: 2.22
**/
*/
int
g_socket_get_fd (GSocket *socket)
{
@ -1081,7 +1094,7 @@ 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)
@ -1114,7 +1127,7 @@ g_socket_get_local_address (GSocket *socket,
* Free the returned object with g_object_unref().
*
* Since: 2.22
**/
*/
GSocketAddress *
g_socket_get_remote_address (GSocket *socket,
GError **error)
@ -1145,7 +1158,7 @@ g_socket_get_remote_address (GSocket *socket,
* Returns: %TRUE if socket is connected, %FALSE otherwise.
*
* Since: 2.22
**/
*/
gboolean
g_socket_is_connected (GSocket *socket)
{
@ -1171,7 +1184,7 @@ g_socket_is_connected (GSocket *socket)
* Returns: %TRUE on success, %FALSE on error.
*
* Since: 2.22
**/
*/
gboolean
g_socket_listen (GSocket *socket,
GError **error)
@ -1222,7 +1235,7 @@ g_socket_listen (GSocket *socket,
* Returns: %TRUE on success, %FALSE on error.
*
* Since: 2.22
**/
*/
gboolean
g_socket_bind (GSocket *socket,
GSocketAddress *address,
@ -1286,7 +1299,7 @@ g_socket_bind (GSocket *socket,
* Free the returned object with g_object_unref().
*
* Since: 2.22
**/
*/
GSocket *
g_socket_accept (GSocket *socket,
GError **error)
@ -1299,7 +1312,7 @@ g_socket_accept (GSocket *socket,
if (!check_socket (socket, error))
return NULL;
while (1)
while (TRUE)
{
if (socket->priv->blocking &&
!g_socket_condition_wait (socket,
@ -1388,8 +1401,9 @@ g_socket_accept (GSocket *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
@ -1400,7 +1414,7 @@ g_socket_accept (GSocket *socket,
* Returns: %TRUE if connected, %FALSE on error.
*
* Since: 2.22
**/
*/
gboolean
g_socket_connect (GSocket *socket,
GSocketAddress *address,
@ -1466,13 +1480,14 @@ g_socket_connect (GSocket *socket,
* @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)
@ -1502,7 +1517,8 @@ g_socket_check_connect_result (GSocket *socket,
/**
* 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.
*
@ -1524,12 +1540,12 @@ g_socket_check_connect_result (GSocket *socket,
* 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;
@ -1584,7 +1600,8 @@ g_socket_receive (GSocket *socket,
* 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.
*
@ -1605,13 +1622,13 @@ g_socket_receive (GSocket *socket,
* 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;
@ -1632,15 +1649,15 @@ g_socket_receive_from (GSocket *socket,
* @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
@ -1652,7 +1669,7 @@ g_socket_receive_from (GSocket *socket,
* Returns: Number of bytes read, or -1 on error
*
* Since: 2.22
**/
*/
gssize
g_socket_send (GSocket *socket,
const gchar *buffer,
@ -1736,13 +1753,13 @@ g_socket_send (GSocket *socket,
* 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;
@ -1780,12 +1797,12 @@ g_socket_send_to (GSocket *socket,
* 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;
@ -1835,12 +1852,13 @@ g_socket_shutdown (GSocket *socket,
*
* 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
@ -1849,10 +1867,10 @@ g_socket_shutdown (GSocket *socket,
* 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;
@ -1910,7 +1928,7 @@ g_socket_close (GSocket *socket,
* Returns: %TRUE if socket is closed, %FALSE otherwise
*
* Since: 2.22
**/
*/
gboolean
g_socket_is_closed (GSocket *socket)
{
@ -1920,22 +1938,22 @@ 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;
}
@ -2002,7 +2020,7 @@ update_select_events (GSocket *socket)
}
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);
@ -2014,7 +2032,7 @@ add_condition_watch (GSocket *socket,
}
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);
@ -2087,8 +2105,8 @@ typedef struct {
} GWinsockSource;
static gboolean
winsock_prepare (GSource *source,
gint *timeout)
winsock_prepare (GSource *source,
gint *timeout)
{
GWinsockSource *winsock_source = (GWinsockSource *)source;
GIOCondition current_condition;
@ -2111,7 +2129,7 @@ winsock_prepare (GSource *source,
}
static gboolean
winsock_check (GSource *source)
winsock_check (GSource *source)
{
GWinsockSource *winsock_source = (GWinsockSource *)source;
GIOCondition current_condition;
@ -2134,9 +2152,9 @@ winsock_check (GSource *source)
}
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;
@ -2233,7 +2251,7 @@ winsock_source_new (GSocket *socket,
* Returns: a newly allocated %GSource, free with g_source_unref().
*
* Since: 2.22
**/
*/
GSource *
g_socket_create_source (GSocket *socket,
GIOCondition condition,
@ -2256,9 +2274,9 @@ g_socket_create_source (GSocket *socket,
* @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;
@ -2269,10 +2287,10 @@ g_socket_create_source (GSocket *socket,
* 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;
@ -2311,16 +2329,16 @@ g_socket_condition_check (GSocket *socket,
* @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,
@ -2431,7 +2449,6 @@ g_socket_condition_wait (GSocket *socket,
* 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.
@ -2459,7 +2476,7 @@ g_socket_condition_wait (GSocket *socket,
* Returns: Number of bytes read, or -1 on error
*
* Since: 2.22
**/
*/
gssize
g_socket_send_message (GSocket *socket,
GSocketAddress *address,
@ -2748,7 +2765,7 @@ g_socket_send_message (GSocket *socket,
* Returns: Number of bytes read, or -1 on error
*
* Since: 2.22
**/
*/
gssize
g_socket_receive_message (GSocket *socket,
GSocketAddress **address,

View File

@ -48,14 +48,14 @@
* 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
{
@ -118,7 +118,8 @@ g_socket_address_class_init (GSocketAddressClass *klass)
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
@ -142,7 +143,7 @@ g_socket_address_init (GSocketAddress *address)
* g_socket_address_to_native().
*
* Returns: the size of the native <type>struct sockaddr</type> that
* @address represents
* @address represents
*
* Since: 2.22
*/
@ -176,10 +177,10 @@ g_socket_address_get_native_size (GSocketAddress *address)
* 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);

View File

@ -69,9 +69,9 @@ g_socket_address_enumerator_class_init (GSocketAddressEnumeratorClass *enumerato
* 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,
@ -91,10 +91,10 @@ g_socket_address_enumerator_next (GSocketAddressEnumerator *enumerator,
* 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;
@ -125,12 +125,12 @@ g_socket_address_enumerator_real_next_async (GSocketAddressEnumerator *enumerat
* 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;
@ -161,8 +161,8 @@ g_socket_address_enumerator_real_next_finish (GSocketAddressEnumerator *enumera
/**
* 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
@ -170,9 +170,9 @@ g_socket_address_enumerator_real_next_finish (GSocketAddressEnumerator *enumera
* 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,

View File

@ -41,7 +41,7 @@ G_BEGIN_DECLS
*
* Enumerator type for objects that contain or generate
* #GSocketAddress<!-- -->es.
**/
*/
typedef struct _GSocketAddressEnumeratorClass GSocketAddressEnumeratorClass;
struct _GSocketAddressEnumerator

View File

@ -60,7 +60,7 @@
* it will be a #GTcpConnection.
*
* Since: 2.22
**/
*/
G_DEFINE_TYPE (GSocketClient, g_socket_client, G_TYPE_OBJECT);
@ -137,7 +137,7 @@ g_socket_client_init (GSocketClient *client)
* Free the returned object with g_object_unref().
*
* Since: 2.22
**/
*/
GSocketClient *
g_socket_client_new (void)
{
@ -229,7 +229,7 @@ g_socket_client_set_property (GObject *object,
* Returns: a #GSocketFamily
*
* Since: 2.22
**/
*/
GSocketFamily
g_socket_client_get_family (GSocketClient *client)
{
@ -251,10 +251,10 @@ 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;
@ -274,7 +274,7 @@ g_socket_client_set_family (GSocketClient *client,
* Returns: a #GSocketFamily
*
* Since: 2.22
**/
*/
GSocketType
g_socket_client_get_socket_type (GSocketClient *client)
{
@ -294,10 +294,10 @@ 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;
@ -308,7 +308,7 @@ g_socket_client_set_socket_type (GSocketClient *client,
/**
* g_socket_client_get_protocol:
* @client: a #GSocketClient.
* @client: a #GSocketClient
*
* Gets the protocol name type of the socket client.
*
@ -317,7 +317,7 @@ g_socket_client_set_socket_type (GSocketClient *client,
* Returns: a #GSocketProtocol
*
* Since: 2.22
**/
*/
GSocketProtocol
g_socket_client_get_protocol (GSocketClient *client)
{
@ -337,10 +337,10 @@ 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;
@ -360,7 +360,7 @@ g_socket_client_set_protocol (GSocketClient *client,
* Returns: a #GSocketAddres or %NULL. don't free
*
* Since: 2.22
**/
*/
GSocketAddress *
g_socket_client_get_local_address (GSocketClient *client)
{
@ -381,10 +381,10 @@ 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);
@ -414,7 +414,9 @@ g_socket_client_class_init (GSocketClientClass *class)
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",
@ -422,7 +424,9 @@ g_socket_client_class_init (GSocketClientClass *class)
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",
@ -430,14 +434,18 @@ g_socket_client_class_init (GSocketClientClass *class)
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));
}
/**
@ -469,7 +477,7 @@ g_socket_client_class_init (GSocketClientClass *class)
* Returns: a #GSocketConnection on success, %NULL on error.
*
* Since: 2.22
**/
*/
GSocketConnection *
g_socket_client_connect (GSocketClient *client,
GSocketConnectable *connectable,
@ -558,7 +566,7 @@ g_socket_client_connect (GSocketClient *client,
* 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
@ -575,13 +583,13 @@ g_socket_client_connect (GSocketClient *client,
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;
@ -620,11 +628,11 @@ g_socket_client_connect_to_host (GSocketClient *client,
* 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)
{
@ -823,7 +831,7 @@ g_socket_client_enumerator_callback (GObject *object,
* the result of the operation.
*
* Since: 2.22
**/
*/
void
g_socket_client_connect_async (GSocketClient *client,
GSocketConnectable *connectable,
@ -869,11 +877,11 @@ g_socket_client_connect_async (GSocketClient *client,
* 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)
@ -910,11 +918,13 @@ g_socket_client_connect_to_host_async (GSocketClient *client,
*
* 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)
@ -940,7 +950,7 @@ g_socket_client_connect_to_service_async (GSocketClient *client,
* Returns: a #GSocketConnection on success, %NULL on error.
*
* Since: 2.22
**/
*/
GSocketConnection *
g_socket_client_connect_finish (GSocketClient *client,
GAsyncResult *result,
@ -966,11 +976,11 @@ g_socket_client_connect_finish (GSocketClient *client,
* 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);
}
@ -987,11 +997,11 @@ g_socket_client_connect_to_host_finish (GSocketClient *client,
* 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);
}

View File

@ -88,13 +88,13 @@ GSocketConnection * g_socket_client_connect (GSocket
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,
@ -106,8 +106,8 @@ GSocketConnection * g_socket_client_connect_finish (GSocket
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);
@ -116,8 +116,8 @@ GSocketConnection * g_socket_client_connect_to_host_finish (GSocket
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);

View File

@ -89,7 +89,7 @@
* }
* }
* ]|
**/
*/
GType
g_socket_connectable_get_type (void)
@ -131,7 +131,7 @@ g_socket_connectable_get_type (void)
* Return value: a new #GSocketAddressEnumerator.
*
* Since: 2.22
**/
*/
GSocketAddressEnumerator *
g_socket_connectable_enumerate (GSocketConnectable *connectable)
{

View File

@ -38,7 +38,7 @@ G_BEGIN_DECLS
* GSocketConnectable:
*
* Interface for objects that contain or generate #GSocketAddress<!-- -->es.
**/
*/
typedef struct _GSocketConnectableIface GSocketConnectableIface;
/**
@ -47,7 +47,7 @@ typedef struct _GSocketConnectableIface GSocketConnectableIface;
* @enumerate: Creates a #GSocketAddressEnumerator
*
* Provides an interface for returning a #GSocketAddressEnumerator
**/
*/
struct _GSocketConnectableIface
{
GTypeInterface g_iface;

View File

@ -49,17 +49,17 @@
* 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);
@ -115,7 +115,7 @@ g_socket_connection_get_output_stream (GIOStream *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
@ -124,7 +124,7 @@ g_socket_connection_get_output_stream (GIOStream *io_stream)
* Returns: a #GSocketAddress or %NULL on error.
*
* Since: 2.22
**/
*/
GSocket *
g_socket_connection_get_socket (GSocketConnection *connection)
{
@ -135,7 +135,7 @@ 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.
@ -144,17 +144,17 @@ g_socket_connection_get_socket (GSocketConnection *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.
@ -163,17 +163,19 @@ g_socket_connection_get_local_address (GSocketConnection *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);
@ -189,8 +191,10 @@ g_socket_connection_get_property (GObject *object, guint prop_id,
}
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);
@ -249,12 +253,15 @@ g_socket_connection_class_init (GSocketConnectionClass *klass)
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
@ -266,9 +273,9 @@ g_socket_connection_init (GSocketConnection *connection)
}
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);
@ -284,11 +291,11 @@ g_socket_connection_close (GIOStream *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;
@ -317,7 +324,7 @@ g_socket_connection_close_async (GIOStream *stream,
}
static gboolean
g_socket_connection_close_finish (GIOStream *stream,
g_socket_connection_close_finish (GIOStream *stream,
GAsyncResult *result,
GError **error)
{
@ -369,8 +376,8 @@ G_LOCK_DEFINE_STATIC(connection_factories);
/**
* 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
*
@ -380,12 +387,12 @@ G_LOCK_DEFINE_STATIC(connection_factories);
* 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;
@ -423,7 +430,7 @@ init_builtin_types (void)
/**
* g_socket_connection_factory_lookup_type:
* @family: a #GSocketFamily.
* @family: a #GSocketFamily
* @type: a #GSocketType
* @protocol_id: a protocol id
*
@ -433,12 +440,13 @@ init_builtin_types (void)
* 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;
@ -467,7 +475,7 @@ g_socket_connection_factory_lookup_type (GSocketFamily family,
/**
* g_socket_connection_factory_create_connection:
* @socket: a #GSocket.
* @socket: a #GSocket
*
* Creates a #GSocketConnection subclass of the right type for
* @socket.
@ -475,7 +483,7 @@ g_socket_connection_factory_lookup_type (GSocketFamily family,
* Returns: a #GSocketConnection
*
* Since: 2.22
**/
*/
GSocketConnection *
g_socket_connection_factory_create_connection (GSocket *socket)
{

View File

@ -72,19 +72,19 @@ struct _GSocketConnection
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

View File

@ -19,7 +19,7 @@
* @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
@ -40,7 +40,7 @@
* g_socket_receive_message() to read such a message.
*
* Since: 2.22
**/
*/
#include "config.h"
#include "gsocketcontrolmessage.h"
@ -70,7 +70,7 @@ G_DEFINE_ABSTRACT_TYPE (GSocketControlMessage,
* Returns: The number of bytes required.
*
* Since: 2.22
**/
*/
gsize
g_socket_control_message_get_size (GSocketControlMessage *message)
{
@ -86,10 +86,10 @@ 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)
{
@ -102,13 +102,13 @@ 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)
{
@ -130,7 +130,7 @@ g_socket_control_message_get_msg_type (GSocketControlMessage *message)
* object.
*
* Since: 2.22
**/
*/
void
g_socket_control_message_serialize (GSocketControlMessage *message,
gpointer data)
@ -151,11 +151,22 @@ g_socket_control_message_class_init (GSocketControlMessageClass *class)
{
}
/**
* 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;

View File

@ -175,7 +175,7 @@ g_socket_listener_init (GSocketListener *listener)
* Returns: a new #GSocketListener.
*
* Since: 2.22
**/
*/
GSocketListener *
g_socket_listener_new (void)
{
@ -215,12 +215,12 @@ check_listener (GSocketListener *listener,
* 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;
@ -264,14 +264,14 @@ g_socket_listener_add_socket (GSocketListener *listener,
* 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;
@ -321,12 +321,12 @@ g_socket_listener_add_address (GSocketListener *listener,
* 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;
@ -379,11 +379,11 @@ g_socket_listener_add_inet_port (GSocketListener *listener,
}
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;
@ -426,9 +426,9 @@ struct AcceptData {
};
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;
@ -456,14 +456,14 @@ accept_callback (GSocket *socket,
* 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,
@ -530,14 +530,14 @@ g_socket_listener_accept_socket (GSocketListener *listener,
* 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,
@ -567,9 +567,9 @@ struct AcceptAsyncData {
};
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;
@ -617,16 +617,16 @@ accept_ready (GSocket *accept_socket,
* 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;
@ -665,12 +665,12 @@ g_socket_listener_accept_socket_async (GSocketListener *listener,
* 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;
@ -702,11 +702,11 @@ g_socket_listener_accept_socket_finish (GSocketListener *listener,
* 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,
@ -732,12 +732,12 @@ g_socket_listener_accept_async (GSocketListener *listener,
* 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;
@ -764,10 +764,10 @@ g_socket_listener_accept_finish (GSocketListener *listener,
* 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;
@ -791,7 +791,7 @@ g_socket_listener_set_backlog (GSocketListener *listener,
* Closes all the sockets in the listener.
*
* Since: 2.22
**/
*/
void
g_socket_listener_close (GSocketListener *listener)
{

View File

@ -30,27 +30,28 @@
*
* 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
*/
@ -154,7 +155,7 @@ g_socket_service_changed (GSocketListener *listener)
* Returns: %TRUE if the service is active, %FALSE otherwise
*
* Since: 2.22
**/
*/
gboolean
g_socket_service_is_active (GSocketService *service)
{
@ -177,7 +178,7 @@ g_socket_service_is_active (GSocketService *service)
* handling an incomming client request.
*
* Since: 2.22
**/
*/
void
g_socket_service_start (GSocketService *service)
{
@ -207,9 +208,9 @@ 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);
@ -257,12 +258,14 @@ g_socket_service_class_init (GSocketServiceClass *class)
* @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),
@ -318,7 +321,7 @@ g_socket_service_ready (GObject *object,
* Returns: a new #GSocketService.
*
* Since: 2.22
**/
*/
GSocketService *
g_socket_service_new (void)
{

View File

@ -51,7 +51,7 @@ typedef struct _GSocketServiceClass GSocketServiceClass;
/**
* GSocketServiceClass:
* @incomming: signal emitted when new connections are accepted
**/
*/
struct _GSocketServiceClass
{
GSocketListenerClass parent_class;

View File

@ -50,7 +50,7 @@
* to the remote service, you can use #GNetworkService's
* #GSocketConnectable interface and not need to worry about
* #GSrvTarget at all.
**/
*/
struct _GSrvTarget {
gchar *hostname;
@ -249,7 +249,7 @@ compare_target (gconstpointer a, gconstpointer b)
* Return value: the head of the sorted list.
*
* Since: 2.22
*/
*/
GList *
g_srv_target_list_sort (GList *targets)
{

View File

@ -25,7 +25,7 @@
* Eventually, some TCP-specific socket stuff will be added.
*
* Since: 2.22
**/
*/
#include "config.h"
#include "gtcpconnection.h"
@ -149,9 +149,9 @@ g_tcp_connection_class_init (GTcpConnectionClass *class)
}
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;
@ -223,7 +223,9 @@ close_async_data_free (CloseAsyncData *data)
}
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;
@ -255,8 +257,8 @@ async_close_finish (CloseAsyncData *data, GError *error, gboolean in_mainloop)
}
static gboolean
close_read_ready (GSocket *socket,
GIOCondition condition,
close_read_ready (GSocket *socket,
GIOCondition condition,
CloseAsyncData *data)
{
GError *error = NULL;
@ -295,11 +297,11 @@ close_read_ready (GSocket *socket,
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;
@ -363,7 +365,7 @@ g_tcp_connection_close_async (GIOStream *stream,
* 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)
@ -386,7 +388,7 @@ g_tcp_connection_set_graceful_disconnect (GTcpConnection *connection,
* Returns: %TRUE if graceful disconnect is used on close, %FALSE otherwise
*
* Since: 2.22
**/
*/
gboolean
g_tcp_connection_get_graceful_disconnect (GTcpConnection *connection)
{

View File

@ -41,8 +41,8 @@
* 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"
@ -229,15 +229,14 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
* @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),
@ -257,13 +256,16 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
/**
* 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)
{

View File

@ -29,7 +29,7 @@
* functionallity like passing file descriptors.
*
* Since: 2.22
**/
*/
#include <gio/gsocketcontrolmessage.h>
#include <gio/gunixfdmessage.h>
@ -48,7 +48,7 @@ G_DEFINE_TYPE_WITH_CODE (GUnixConnection, g_unix_connection,
/**
* 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.
@ -64,7 +64,7 @@ G_DEFINE_TYPE_WITH_CODE (GUnixConnection, g_unix_connection,
* Returns: a %TRUE on success, %NULL on error.
*
* Since: 2.22
**/
*/
gboolean
g_unix_connection_send_fd (GUnixConnection *connection,
gint fd,
@ -104,13 +104,13 @@ g_unix_connection_send_fd (GUnixConnection *connection,
/**
* 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
@ -119,7 +119,7 @@ g_unix_connection_send_fd (GUnixConnection *connection,
* Returns: a file descriptor on success, -1 on error.
*
* Since: 2.22
**/
*/
gint
g_unix_connection_receive_fd (GUnixConnection *connection,
GCancellable *cancellable,

View File

@ -46,7 +46,7 @@ G_BEGIN_DECLS
* A #GSocketConnection for UNIX domain socket connections.
*
* Since: 2.22
**/
*/
typedef struct _GUnixConnection GUnixConnection;
typedef struct _GUnixConnectionPrivate GUnixConnectionPrivate;
typedef struct _GUnixConnectionClass GUnixConnectionClass;

View File

@ -27,7 +27,7 @@
* 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"
@ -72,9 +72,9 @@ g_unix_fd_message_get_msg_type (GSocketControlMessage *message)
}
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;
@ -145,10 +145,13 @@ g_unix_fd_message_class_init (GUnixFDMessageClass *class)
/**
* 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)
{
@ -159,13 +162,12 @@ 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().
@ -173,15 +175,19 @@ g_unix_fd_message_new (void)
* 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;
@ -210,21 +216,24 @@ g_unix_fd_message_steal_fds (GUnixFDMessage *message,
* @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;

View File

@ -63,10 +63,10 @@ struct _GUnixFDMessage
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

View File

@ -38,14 +38,14 @@
* @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