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> <FILE>giostream</FILE>
<TITLE>GIOStream</TITLE> <TITLE>GIOStream</TITLE>
GIOStream 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
g_io_stream_close_async g_io_stream_close_async
g_io_stream_close_finish 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_is_closed
g_io_stream_has_pending
g_io_stream_set_pending g_io_stream_set_pending
g_io_stream_clear_pending
<SUBSECTION Standard> <SUBSECTION Standard>
GIOStreamClass GIOStreamClass
G_IO_STREAM G_IO_STREAM
@ -1419,15 +1419,15 @@ g_inet_address_get_native_size
g_inet_address_to_string g_inet_address_to_string
g_inet_address_get_family g_inet_address_get_family
g_inet_address_get_is_any g_inet_address_get_is_any
g_inet_address_get_is_link_local
g_inet_address_get_is_loopback 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_link_local
g_inet_address_get_is_mc_node_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_mc_site_local
g_inet_address_get_is_multicast g_inet_address_get_is_mc_org_local
g_inet_address_get_is_site_local g_inet_address_get_is_mc_global
<SUBSECTION Standard> <SUBSECTION Standard>
GInetAddressClass GInetAddressClass
GInetAddressPrivate GInetAddressPrivate

View File

@ -79,6 +79,7 @@ g_socket_msg_flags_get_type
g_socket_protocol_get_type g_socket_protocol_get_type
g_socket_service_get_type g_socket_service_get_type
g_socket_type_get_type g_socket_type_get_type
g_srv_target_get_type
g_tcp_connection_get_type g_tcp_connection_get_type
g_themed_icon_get_type g_themed_icon_get_type
g_threaded_socket_service_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 * in all ways except that initialization is asynchronous. For more details
* see the descriptions on #GInitable. * see the descriptions on #GInitable.
* *
* A class may implement both the #GInitable and #GAsyncInitable interfaces * A class may implement both the #GInitable and #GAsyncInitable interfaces.
* or both.
* *
* Users of objects implementing this are not intended to use * Users of objects implementing this are not intended to use the interface
* the interface method directly, instead it will be used automatically * method directly, instead it will be used automatically in various ways.
* in various ways. For C applications you generally just call * For C applications you generally just call g_async_initable_new() directly,
* g_async_initable_new() directly, or indirectly via a foo_thing_new_async() wrapper. * or indirectly via a foo_thing_new_async() wrapper. This will call
* This will call g_async_initable_init() under the cover, calling back with %NULL and * g_async_initable_init() under the cover, calling back with %NULL and
* a set %GError on failure. * a set %GError on failure.
**/ */
static void g_async_initable_base_init (gpointer g_iface); static void g_async_initable_base_init (gpointer g_iface);
static void g_async_initable_real_init_async (GAsyncInitable *initable, 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 * @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: the data to pass to callback function
* *
* Starts asynchronous initialization of the object implementing the interface. * Starts asynchronous initialization of the object implementing the
* This must be done before any real use of the object after initial construction. * interface. This must be done before any real use of the object after
* If the object also implements #GInitable you can optionally call g_initable_init() * initial construction. If the object also implements #GInitable you can
* instead. * optionally call g_initable_init() instead.
* *
* When the initialization is finished, @callback will be called. You can then call * When the initialization is finished, @callback will be called. You can
* g_async_initable_init_finish() to get the result of the initialization. * then call g_async_initable_init_finish() to get the result of the
* initialization.
* *
* Implementations may also support cancellation. If @cancellable is not %NULL, * Implementations may also support cancellation. If @cancellable is not
* then initialization can be cancelled by triggering the cancellable object * %NULL, then initialization can be cancelled by triggering the cancellable
* from another thread. If the operation was cancelled, the error * object from another thread. If the operation was cancelled, the error
* %G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL and * %G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL and
* the object doesn't support cancellable initialization the error * the object doesn't support cancellable initialization the error
* %G_IO_ERROR_NOT_SUPPORTED will be returned. * %G_IO_ERROR_NOT_SUPPORTED will be returned.
@ -140,13 +140,13 @@ g_async_initable_base_init (gpointer g_iface)
* any interface methods. * any interface methods.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_async_initable_init_async (GAsyncInitable *initable, g_async_initable_init_async (GAsyncInitable *initable,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GAsyncInitableIface *iface; GAsyncInitableIface *iface;
@ -167,16 +167,15 @@ g_async_initable_init_async (GAsyncInitable *initable,
* Finishes asynchronous initialization and returns the result. * Finishes asynchronous initialization and returns the result.
* See g_async_initable_init_async(). * See g_async_initable_init_async().
* *
* Returns: %TRUE if successful. If an error * Returns: %TRUE if successful. If an error has occurred, this function
* has occurred, this function will return %FALSE and set @error * will return %FALSE and set @error appropriately if present.
* appropriately if present.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_async_initable_init_finish (GAsyncInitable *initable, g_async_initable_init_finish (GAsyncInitable *initable,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
GAsyncInitableIface *iface; GAsyncInitableIface *iface;
@ -210,11 +209,11 @@ async_init_thread (GSimpleAsyncResult *res,
} }
static void static void
g_async_initable_real_init_async (GAsyncInitable *initable, g_async_initable_real_init_async (GAsyncInitable *initable,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *res; GSimpleAsyncResult *res;
@ -228,9 +227,9 @@ g_async_initable_real_init_async (GAsyncInitable *initable,
} }
static gboolean static gboolean
g_async_initable_real_init_finish (GAsyncInitable *initable, g_async_initable_real_init_finish (GAsyncInitable *initable,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
return TRUE; /* Errors handled by base impl */ 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> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the operation. * of the operation.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @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 * @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 * @...: the value if the first property, followed by and other property
* value pairs, and ended by %NULL. * value pairs, and ended by %NULL.
* *
* Helper function for constructing #GAsyncInitiable object. This is * Helper function for constructing #GAsyncInitiable object. This is
* similar to g_object_new() but also initializes the object asyncronously. * similar to g_object_new() but also initializes the object asyncronously.
* *
* When the initialization is finished, @callback will be called. You can then call * When the initialization is finished, @callback will be called. You can
* g_async_initable_new_finish() to get new object and check for any errors. * then call g_async_initable_new_finish() to get new object and check for
* any errors.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_async_initable_new_async (GType object_type, g_async_initable_new_async (GType object_type,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data, gpointer user_data,
const gchar *first_property_name, const gchar *first_property_name,
...) ...)
{ {
va_list var_args; 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> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the operation. * of the operation.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @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 * @user_data: the data to pass to callback function
* *
* Helper function for constructing #GAsyncInitiable object. This is * Helper function for constructing #GAsyncInitiable object. This is
* similar to g_object_newv() but also initializes the object asyncronously. * similar to g_object_newv() but also initializes the object asyncronously.
* *
* When the initialization is finished, @callback will be called. You can then call * When the initialization is finished, @callback will be called. You can
* g_async_initable_new_finish() to get new object and check for any errors. * then call g_async_initable_new_finish() to get new object and check for
* any errors.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_async_initable_newv_async (GType object_type, g_async_initable_newv_async (GType object_type,
guint n_parameters, guint n_parameters,
GParameter *parameters, GParameter *parameters,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GObject *obj; 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> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the operation. * of the operation.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @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 * @user_data: the data to pass to callback function
* *
* Helper function for constructing #GAsyncInitiable object. This is * 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 * When the initialization is finished, @callback will be called. You can
* g_async_initable_new_finish() to get new object and check for any errors. * then call g_async_initable_new_finish() to get new object and check for
* any errors.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_async_initable_new_valist_async (GType object_type, g_async_initable_new_valist_async (GType object_type,
const gchar *first_property_name, const gchar *first_property_name,
va_list var_args, va_list var_args,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GObject *obj; GObject *obj;
@ -355,24 +362,26 @@ g_async_initable_new_valist_async (GType object_type,
callback, user_data); callback, user_data);
g_object_unref (obj); /* Passed ownership to async call */ g_object_unref (obj); /* Passed ownership to async call */
} }
/** /**
* g_async_initable_new_finish: * g_async_initable_new_finish:
* @initable: the #GAsyncInitable from the callback * @initable: the #GAsyncInitable from the callback
* @res: the #GAsyncResult.from the callback * @res: the #GAsyncResult.from the callback
* @error: a #GError location to store the error occuring, or %NULL to * @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, * Finishes the async construction for the various g_async_initable_new calls,
* returning the created object or %NULL on error. * 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 * Since: 2.22
**/ */
GObject * GObject *
g_async_initable_new_finish (GAsyncInitable *initable, g_async_initable_new_finish (GAsyncInitable *initable,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
if (g_async_initable_init_finish (initable, res, error)) if (g_async_initable_init_finish (initable, res, error))
return g_object_ref (initable); return g_object_ref (initable);

View File

@ -1717,10 +1717,10 @@ g_file_open_readwrite (GFile *file,
/** /**
* g_file_create_readwrite: * g_file_create_readwrite:
* @file: input #GFile. * @file: a #GFile
* @flags: a set of #GFileCreateFlags. * @flags: a set of #GFileCreateFlags
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore
* @error: a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Creates a new file and returns a stream for reading and writing to it. * Creates a new file and returns a stream for reading and writing to it.
* The file must not already exist. * 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 * 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.
* *
* If a file or directory with this name already exists the G_IO_ERROR_EXISTS * If a file or directory with this name already exists the %G_IO_ERROR_EXISTS
* error will be returned. * error will be returned. Some file systems don't allow all file names,
* Some file systems don't allow all file names, and may * and may return an %G_IO_ERROR_INVALID_FILENAME error, and if the name
* 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
* is to long G_IO_ERROR_FILENAME_TOO_LONG will be returned. * are possible too, and depend on what kind of filesystem the file is on.
* 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, * Note that in many non-local file cases read and write streams are not
* so make sure you really need to do read and write streaming, rather than * supported, so make sure you really need to do read and write streaming,
* just opening for reading or writing. * rather than just opening for reading or writing.
* *
* Returns: a #GFileIOStream for the newly created file, or * Returns: a #GFileIOStream for the newly created file, or %NULL on error.
* %NULL on error.
* Free the returned object with g_object_unref(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GFileIOStream * GFileIOStream *
g_file_create_readwrite (GFile *file, g_file_create_readwrite (GFile *file,
GFileCreateFlags flags, GFileCreateFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GFileIface *iface; GFileIface *iface;
@ -1780,37 +1777,37 @@ g_file_create_readwrite (GFile *file,
/** /**
* g_file_replace_readwrite: * g_file_replace_readwrite:
* @file: input #GFile. * @file: a #GFile
* @etag: an optional <link linkend="gfile-etag">entity tag</link> for the * @etag: an optional <link linkend="gfile-etag">entity tag</link> for the
* current #GFile, or #NULL to ignore. * current #GFile, or #NULL to ignore
* @make_backup: %TRUE if a backup should be created. * @make_backup: %TRUE if a backup should be created
* @flags: a set of #GFileCreateFlags. * @flags: a set of #GFileCreateFlags
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore
* @error: a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Returns an output stream for overwriting the file in readwrite mode, * 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, * possibly creating a backup copy of the file first. If the file doesn't
* it will be created. * exist, it will be created.
* *
* For details about the behaviour, see g_file_replace() which does the same * For details about the behaviour, see g_file_replace() which does the same
* thing but returns an output stream only. * thing but returns an output stream only.
* *
* Note that in many non-local file cases read and write streams are not supported, * Note that in many non-local file cases read and write streams are not
* so make sure you really need to do read and write streaming, rather than * supported, so make sure you really need to do read and write streaming,
* just opening for reading or writing. * rather than just opening for reading or writing.
* *
* Returns: a #GFileIOStream or %NULL on error. * Returns: a #GFileIOStream or %NULL on error.
* Free the returned object with g_object_unref(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GFileIOStream * GFileIOStream *
g_file_replace_readwrite (GFile *file, g_file_replace_readwrite (GFile *file,
const char *etag, const char *etag,
gboolean make_backup, gboolean make_backup,
GFileCreateFlags flags, GFileCreateFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GFileIface *iface; GFileIface *iface;
@ -1834,9 +1831,9 @@ g_file_replace_readwrite (GFile *file,
/** /**
* g_file_read_async: * g_file_read_async:
* @file: input #GFile. * @file: input #GFile
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @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: * g_file_create_readwrite_async:
* @file: input #GFile. * @file: input #GFile
* @flags: a set of #GFileCreateFlags. * @flags: a set of #GFileCreateFlags
* @io_priority: the <link linkend="io-priority">I/O priority</link> * @io_priority: the <link linkend="io-priority">I/O priority</link>
* of the request. * of the request
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: the data to pass to callback function
* *
* Asynchronously creates a new file and returns a stream for reading and writing * Asynchronously creates a new file and returns a stream for reading and
* to it. The file must not already exist. * writing to it. The file must not already exist.
* *
* For more details, see g_file_create_readwrite() which is * For more details, see g_file_create_readwrite() which is
* the synchronous version of this call. * the synchronous version of this call.
* *
* When the operation is finished, @callback will be called. You can then call * When the operation is finished, @callback will be called. You can then
* g_file_create_readwrite_finish() to get the result of the operation. * call g_file_create_readwrite_finish() to get the result of the operation.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_file_create_readwrite_async (GFile *file, g_file_create_readwrite_async (GFile *file,
GFileCreateFlags flags, GFileCreateFlags flags,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GFileIface *iface; GFileIface *iface;
@ -2245,8 +2242,8 @@ g_file_create_readwrite_async (GFile *file,
/** /**
* g_file_create_readwrite_finish: * g_file_create_readwrite_finish:
* @file: input #GFile. * @file: input #GFile
* @res: a #GAsyncResult. * @res: a #GAsyncResult
* @error: a #GError, or %NULL * @error: a #GError, or %NULL
* *
* Finishes an asynchronous file create operation started with * Finishes an asynchronous file create operation started with
@ -2258,9 +2255,9 @@ g_file_create_readwrite_async (GFile *file,
* Since: 2.22 * Since: 2.22
**/ **/
GFileIOStream * GFileIOStream *
g_file_create_readwrite_finish (GFile *file, g_file_create_readwrite_finish (GFile *file,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
GFileIface *iface; GFileIface *iface;
@ -2291,26 +2288,26 @@ g_file_create_readwrite_finish (GFile *file,
* @callback: a #GAsyncReadyCallback to call when the request is satisfied * @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: the data to pass to callback function
* *
* Asynchronously overwrites the file in read-write mode, replacing the contents, * Asynchronously overwrites the file in read-write mode, replacing the
* possibly creating a backup copy of the file first. * contents, possibly creating a backup copy of the file first.
* *
* For more details, see g_file_replace_readwrite() which is * For more details, see g_file_replace_readwrite() which is
* the synchronous version of this call. * the synchronous version of this call.
* *
* When the operation is finished, @callback will be called. You can then call * When the operation is finished, @callback will be called. You can then
* g_file_replace_readwrite_finish() to get the result of the operation. * call g_file_replace_readwrite_finish() to get the result of the operation.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_file_replace_readwrite_async (GFile *file, g_file_replace_readwrite_async (GFile *file,
const char *etag, const char *etag,
gboolean make_backup, gboolean make_backup,
GFileCreateFlags flags, GFileCreateFlags flags,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GFileIface *iface; GFileIface *iface;
@ -2340,11 +2337,11 @@ g_file_replace_readwrite_async (GFile *file,
* Free the returned object with g_object_unref(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GFileIOStream * GFileIOStream *
g_file_replace_readwrite_finish (GFile *file, g_file_replace_readwrite_finish (GFile *file,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
GFileIface *iface; GFileIface *iface;

View File

@ -49,13 +49,13 @@
* To actually connect to a remote host, you will need a * To actually connect to a remote host, you will need a
* #GInetSocketAddress (which includes a #GInetAddress as well as a * #GInetSocketAddress (which includes a #GInetAddress as well as a
* port number). * port number).
**/ */
/** /**
* GInetAddress: * GInetAddress:
* *
* An IPv4 or IPv6 internet address. * An IPv4 or IPv6 internet address.
**/ */
/* Networking initialization function, called from inside the g_once of /* Networking initialization function, called from inside the g_once of
* g_inet_address_get_type() * g_inet_address_get_type()
@ -107,7 +107,7 @@ g_inet_address_set_property (GObject *object,
{ {
GInetAddress *address = G_INET_ADDRESS (object); GInetAddress *address = G_INET_ADDRESS (object);
switch (prop_id) switch (prop_id)
{ {
case PROP_FAMILY: case PROP_FAMILY:
address->priv->family = g_value_get_enum (value); 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)"), P_("The address family (IPv4 or IPv6)"),
G_TYPE_SOCKET_FAMILY, G_TYPE_SOCKET_FAMILY,
G_SOCKET_FAMILY_INVALID, 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_object_class_install_property (gobject_class, PROP_BYTES,
g_param_spec_pointer ("bytes", g_param_spec_pointer ("bytes",
P_("Bytes"), P_("Bytes"),
P_("The raw address data"), 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_object_class_install_property (gobject_class, PROP_IS_ANY,
g_param_spec_boolean ("is-any", g_param_spec_boolean ("is-any",
P_("Is any"), P_("Is any"),
P_("See g_inet_address_get_is_any()"), P_("Whether this is the \"any\" address for its family"),
FALSE, 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_object_class_install_property (gobject_class, PROP_IS_LINK_LOCAL,
g_param_spec_boolean ("is-link-local", g_param_spec_boolean ("is-link-local",
P_("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, 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_object_class_install_property (gobject_class, PROP_IS_LOOPBACK,
g_param_spec_boolean ("is-loopback", g_param_spec_boolean ("is-loopback",
P_("Is loopback"), P_("Is loopback"),
P_("See g_inet_address_get_is_loopback()"), P_("Whether this is the loopback address for its family"),
FALSE, 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_object_class_install_property (gobject_class, PROP_IS_SITE_LOCAL,
g_param_spec_boolean ("is-site-local", g_param_spec_boolean ("is-site-local",
P_("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, 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_object_class_install_property (gobject_class, PROP_IS_MULTICAST,
g_param_spec_boolean ("is-multicast", g_param_spec_boolean ("is-multicast",
P_("Is multicast"), P_("Is multicast"),
P_("See g_inet_address_get_is_multicast()"), P_("Whether this is a multicast address"),
FALSE, 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_object_class_install_property (gobject_class, PROP_IS_MC_GLOBAL,
g_param_spec_boolean ("is-mc-global", g_param_spec_boolean ("is-mc-global",
P_("Is multicast global"), P_("Is multicast global"),
P_("See g_inet_address_get_is_mc_global()"), P_("Whether this is a global multicast address"),
FALSE, 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_object_class_install_property (gobject_class, PROP_IS_MC_LINK_LOCAL,
g_param_spec_boolean ("is-mc-link-local", g_param_spec_boolean ("is-mc-link-local",
P_("Is multicast 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, 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_object_class_install_property (gobject_class, PROP_IS_MC_NODE_LOCAL,
g_param_spec_boolean ("is-mc-node-local", g_param_spec_boolean ("is-mc-node-local",
P_("Is multicast 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, 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_object_class_install_property (gobject_class, PROP_IS_MC_ORG_LOCAL,
g_param_spec_boolean ("is-mc-org-local", g_param_spec_boolean ("is-mc-org-local",
P_("Is multicast 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, 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_object_class_install_property (gobject_class, PROP_IS_MC_SITE_LOCAL,
g_param_spec_boolean ("is-mc-site-local", g_param_spec_boolean ("is-mc-site-local",
P_("Is multicast 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, 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 static void

View File

@ -39,14 +39,14 @@
* *
* An IPv4 or IPv6 socket address; that is, the combination of a * An IPv4 or IPv6 socket address; that is, the combination of a
* #GInetAddress and a port number. * #GInetAddress and a port number.
**/ */
/** /**
* GInetSocketAddress: * GInetSocketAddress:
* *
* An IPv4 or IPv6 socket address, corresponding to a <type>struct * An IPv4 or IPv6 socket address, corresponding to a <type>struct
* sockaddr_in</type> or <type>struct sockaddr_in6</type>. * sockaddr_in</type> or <type>struct sockaddr_in6</type>.
**/ */
G_DEFINE_TYPE (GInetSocketAddress, g_inet_socket_address, G_TYPE_SOCKET_ADDRESS); G_DEFINE_TYPE (GInetSocketAddress, g_inet_socket_address, G_TYPE_SOCKET_ADDRESS);
enum { enum {
@ -159,10 +159,10 @@ g_inet_socket_address_get_native_size (GSocketAddress *address)
} }
static gboolean static gboolean
g_inet_socket_address_to_native (GSocketAddress *address, g_inet_socket_address_to_native (GSocketAddress *address,
gpointer dest, gpointer dest,
gsize destlen, gsize destlen,
GError **error) GError **error)
{ {
GInetSocketAddress *addr; GInetSocketAddress *addr;
GSocketFamily family; GSocketFamily family;
@ -233,19 +233,23 @@ g_inet_socket_address_class_init (GInetSocketAddressClass *klass)
g_object_class_install_property (gobject_class, PROP_ADDRESS, g_object_class_install_property (gobject_class, PROP_ADDRESS,
g_param_spec_object ("address", g_param_spec_object ("address",
"address", P_("Address"),
"address", P_("The address"),
G_TYPE_INET_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_object_class_install_property (gobject_class, PROP_PORT,
g_param_spec_uint ("port", g_param_spec_uint ("port",
"port", P_("Port"),
"port", P_("The port"),
0, 0,
65535, 65535,
0, 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 static void

View File

@ -50,7 +50,7 @@
* exceptions the binding could check for objects implemention %GInitable * exceptions the binding could check for objects implemention %GInitable
* during normal construction and automatically initialize them, throwing * during normal construction and automatically initialize them, throwing
* an exception on failure. * an exception on failure.
**/ */
GType GType
g_initable_get_type (void) 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 * of the first call. This is so that its safe to implement the singleton
* pattern in the GObject constructor function. * pattern in the GObject constructor function.
* *
* Returns: %TRUE if successful. If an error * Returns: %TRUE if successful. If an error has occurred, this function will
* has occurred, this function will return %FALSE and set @error * return %FALSE and set @error appropriately if present.
* appropriately if present.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_initable_init (GInitable *initable, g_initable_init (GInitable *initable,
GCancellable *cancellable, GCancellable *cancellable,
@ -136,7 +135,8 @@ g_initable_init (GInitable *initable,
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * 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 * @...: the value if the first property, followed by and other property
* value pairs, and ended by %NULL. * 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 * Return value: a newly allocated #GObject, or %NULL on error
* *
* Since: 2.22 * Since: 2.22
**/ */
gpointer gpointer
g_initable_new (GType object_type, g_initable_new (GType object_type,
GCancellable *cancellable, GCancellable *cancellable,
@ -174,7 +174,7 @@ g_initable_new (GType object_type,
* @parameters: the parameters to use to construct the object * @parameters: the parameters to use to construct the object
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore.
* *
* Helper function for constructing #GInitiable object. This is * Helper function for constructing #GInitiable object. This is
* similar to g_object_newv() but also initializes the object * 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 * Return value: a newly allocated #GObject, or %NULL on error
* *
* Since: 2.22 * Since: 2.22
**/ */
gpointer gpointer
g_initable_newv (GType object_type, g_initable_newv (GType object_type,
guint n_parameters, guint n_parameters,
@ -214,7 +214,7 @@ g_initable_newv (GType object_type,
* @var_args: The var args list generated from @first_property_name. * @var_args: The var args list generated from @first_property_name.
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore.
* *
* Helper function for constructing #GInitiable object. This is * Helper function for constructing #GInitiable object. This is
* similar to g_object_new_valist() but also initializes the object * 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 * Return value: a newly allocated #GObject, or %NULL on error
* *
* Since: 2.22 * Since: 2.22
**/ */
GObject* GObject*
g_initable_new_valist (GType object_type, g_initable_new_valist (GType object_type,
const gchar *first_property_name, const gchar *first_property_name,

View File

@ -51,7 +51,8 @@ typedef struct _GInitableIface GInitableIface;
* @g_iface: The parent interface. * @g_iface: The parent interface.
* @init: Initializes the object. * @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 * Since: 2.22
**/ **/

View File

@ -482,12 +482,16 @@ typedef enum {
/** /**
* GResolverError: * GResolverError:
* @G_RESOLVER_ERROR_NOT_FOUND: the requested name/address/service was not found * @G_RESOLVER_ERROR_NOT_FOUND: the requested name/address/service was not
* @G_RESOLVER_ERROR_TEMPORARY_FAILURE: the requested information could not be looked up due to a network error or similar problem * 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 * @G_RESOLVER_ERROR_INTERNAL: unknown error
* *
* An error code used with %G_RESOLVER_ERROR in a #GError returned * An error code used with %G_RESOLVER_ERROR in a #GError returned
* from a #GResolver routine. * from a #GResolver routine.
*
* Since: 2.22
*/ */
typedef enum { typedef enum {
G_RESOLVER_ERROR_NOT_FOUND, G_RESOLVER_ERROR_NOT_FOUND,
@ -505,6 +509,8 @@ typedef enum {
* The protocol family of a #GSocketAddress. (These values are * The protocol family of a #GSocketAddress. (These values are
* identical to the system defines %AF_INET, %AF_INET6 and %AF_UNIX, * identical to the system defines %AF_INET, %AF_INET6 and %AF_UNIX,
* if available.) * if available.)
*
* Since: 2.22
*/ */
typedef enum { typedef enum {
G_SOCKET_FAMILY_INVALID, G_SOCKET_FAMILY_INVALID,
@ -519,10 +525,13 @@ typedef enum {
* GSocketType: * GSocketType:
* @G_SOCKET_TYPE_INVALID: Type unknown or wrong * @G_SOCKET_TYPE_INVALID: Type unknown or wrong
* @G_SOCKET_TYPE_STREAM: Reliable connection-based byte streams (e.g. TCP). * @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_DATAGRAM: Connectionless, unreliable datagram passing.
* @G_SOCKET_TYPE_SEQPACKET: Reliable connection-based passing of datagrams of fixed maximum length (e.g. SCTP). * (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 * Since: 2.22
*/ */
@ -538,13 +547,16 @@ typedef enum
* GSocketMsgFlags: * GSocketMsgFlags:
* @G_SOCKET_MSG_NONE: No flags. * @G_SOCKET_MSG_NONE: No flags.
* @G_SOCKET_MSG_OOB: Request to send/receive out of band data. * @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_PEEK: Read data from the socket without removing it from
* @G_SOCKET_MSG_DONTROUTE: Don't use a gateway to send out the packet, only send to hosts on directly connected networks. * 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 * Flags used in g_socket_receive_message() and g_socket_send_message().
* some commonly available flags, but the values used for them are the same as on the platform, and any other * The flags listed in the enum are some commonly available flags, but the
* flags are passed in/out as is. So to use a platform specific flag, just include the right system header and * values used for them are the same as on the platform, and any other flags
* pass in the flag. * 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 * Since: 2.22
*/ */
@ -560,15 +572,17 @@ typedef enum
* GSocketProtocol: * GSocketProtocol:
* @G_SOCKET_PROTOCOL_UNKNOWN: The protocol type is unknown * @G_SOCKET_PROTOCOL_UNKNOWN: The protocol type is unknown
* @G_SOCKET_PROTOCOL_DEFAULT: The default protocol for the family/type * @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_UDP: UDP over IP
* @G_SOCKET_PROTOCOL_SCTP: SCTP over IP * @G_SOCKET_PROTOCOL_SCTP: SCTP over IP
* *
* A protocol identifier is specified when creating a #GSocket, which is a family/type * A protocol identifier is specified when creating a #GSocket, which is a
* specific identifier, where 0 means the default protocol for the particular family/type. * family/type specific identifier, where 0 means the default protocol for
* This enum contains a set of commonly availible and used protocols. You can also * the particular family/type.
* pass any other identifiers handled by the platform in order to use protocols not *
* listed here. * 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 * Since: 2.22
*/ */

View File

@ -66,7 +66,7 @@ G_DEFINE_TYPE (GIOStream, g_io_stream, G_TYPE_OBJECT);
* is actually shut down. * is actually shut down.
* *
* Since: 2.22 * Since: 2.22
**/ */
enum enum
{ {
@ -204,14 +204,14 @@ g_io_stream_class_init (GIOStreamClass *klass)
/** /**
* g_io_stream_is_closed: * g_io_stream_is_closed:
* @stream: a #GIOStream. * @stream: a #GIOStream
* *
* Checks if a stream is closed. * Checks if a stream is closed.
* *
* Returns: %TRUE if the stream is closed. * Returns: %TRUE if the stream is closed.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_io_stream_is_closed (GIOStream *stream) g_io_stream_is_closed (GIOStream *stream)
{ {
@ -222,56 +222,56 @@ g_io_stream_is_closed (GIOStream *stream)
/** /**
* g_io_stream_get_input_stream: * g_io_stream_get_input_stream:
* @stream: input #GIOStream. * @stream: a #GIOStream
* *
* Gets the input stream for this object. This is used * Gets the input stream for this object. This is used
* for reading. * 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 * Since: 2.22
**/ */
GInputStream * GInputStream *
g_io_stream_get_input_stream (GIOStream *io_stream) g_io_stream_get_input_stream (GIOStream *stream)
{ {
GIOStreamClass *klass; GIOStreamClass *klass;
klass = G_IO_STREAM_GET_CLASS (io_stream); klass = G_IO_STREAM_GET_CLASS (stream);
g_assert (klass->get_input_stream != NULL); 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: * g_io_stream_get_output_stream:
* @stream: input #GIOStream. * @stream: a #GIOStream
* *
* Gets the output stream for this object. This is used for * Gets the output stream for this object. This is used for
* writing. * writing.
* *
* Returns: a #GOutputStream, owned by the #GIOStream do not free. * Returns: a #GOutputStream, owned by the #GIOStream. Do not free.
* *
* Since: 2.22 * Since: 2.22
**/ */
GOutputStream * GOutputStream *
g_io_stream_get_output_stream (GIOStream *io_stream) g_io_stream_get_output_stream (GIOStream *stream)
{ {
GIOStreamClass *klass; GIOStreamClass *klass;
klass = G_IO_STREAM_GET_CLASS (io_stream); klass = G_IO_STREAM_GET_CLASS (stream);
g_assert (klass->get_output_stream != NULL); 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: * g_io_stream_has_pending:
* @stream: a #GIOStream. * @stream: a #GIOStream
* *
* Checks if a stream has pending actions. * Checks if a stream has pending actions.
* *
* Returns: %TRUE if @stream has pending actions. * Returns: %TRUE if @stream has pending actions.
* *
* Since: 2.22 * Since: 2.22
**/ **/
@ -285,9 +285,9 @@ g_io_stream_has_pending (GIOStream *stream)
/** /**
* g_io_stream_set_pending: * g_io_stream_set_pending:
* @stream: a #GIOStream. * @stream: a #GIOStream
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore
* *
* Sets @stream to have actions pending. If the pending flag is * Sets @stream to have actions pending. If the pending flag is
* already set or @stream is closed, it will return %FALSE and set * 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. * Return value: %TRUE if pending was previously unset and is now set.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_io_stream_set_pending (GIOStream *stream, g_io_stream_set_pending (GIOStream *stream,
GError **error) GError **error)
{ {
g_return_val_if_fail (G_IS_IO_STREAM (stream), FALSE); 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: * g_io_stream_clear_pending:
* @stream: output stream * @stream: a #GIOStream
* *
* Clears the pending flag on @stream. * Clears the pending flag on @stream.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_io_stream_clear_pending (GIOStream *stream) g_io_stream_clear_pending (GIOStream *stream)
{ {
@ -341,9 +341,9 @@ g_io_stream_clear_pending (GIOStream *stream)
} }
static gboolean static gboolean
g_io_stream_real_close (GIOStream *stream, g_io_stream_real_close (GIOStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean res; gboolean res;
@ -363,33 +363,34 @@ g_io_stream_real_close (GIOStream *stream,
/** /**
* g_io_stream_close: * g_io_stream_close:
* @stream: A #GIOStream. * @stream: a #GIOStream
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore
* @error: location to store the error occuring, or %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 stream, releasing resources related to it. This will also
* closes the individual input and output streams, if they are not already * closes the individual input and output streams, if they are not already
* closed. * closed.
* *
* Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED. * Once the stream is closed, all other operations will return
* Closing a stream multiple times will not return an error. * %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 * Closing a stream will automatically flush any outstanding buffers
* stream. * in the stream.
* *
* Streams will be automatically closed when the last reference * Streams will be automatically closed when the last reference
* is dropped, but you might want to call this function to make sure * is dropped, but you might want to call this function to make sure
* resources are released as early as possible. * resources are released as early as possible.
* *
* Some streams might keep the backing store of the stream (e.g. a file descriptor) * Some streams might keep the backing store of the stream (e.g. a file
* open after the stream is closed. See the documentation for the individual * descriptor) open after the stream is closed. See the documentation for
* stream for details. * the individual stream for details.
* *
* On failure the first error that happened will be reported, but the close * On failure the first error that happened will be reported, but the
* operation will finish as much as possible. A stream that failed to * close operation will finish as much as possible. A stream that failed
* close will still return %G_IO_ERROR_CLOSED for all operations. Still, it * to close will still return %G_IO_ERROR_CLOSED for all operations.
* is important to check and report the error to the user, otherwise * Still, it is important to check and report the error to the user,
* there might be a loss of data as all data might not be written. * 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 * If @cancellable is not NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation * 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 * Return value: %TRUE on success, %FALSE on failure
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_io_stream_close (GIOStream *stream, g_io_stream_close (GIOStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
@ -454,8 +455,8 @@ async_ready_close_callback_wrapper (GObject *source_object,
/** /**
* g_io_stream_close_async: * g_io_stream_close_async:
* @stream: A #GIOStream. * @stream: a #GIOStream
* @io_priority: the io priority of the request. * @io_priority: the io priority of the request
* @callback: callback to call when the request is satisfied * @callback: callback to call when the request is satisfied
* @user_data: the data to pass to callback function * @user_data: the data to pass to callback function
* @cancellable: optional cancellable object * @cancellable: optional cancellable object
@ -467,12 +468,12 @@ async_ready_close_callback_wrapper (GObject *source_object,
* *
* For behaviour details see g_io_stream_close(). * 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 * to implement asynchronicity, so they are optional for inheriting
* classes. However, if you override one you must override all. * classes. However, if you override one you must override all.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_io_stream_close_async (GIOStream *stream, g_io_stream_close_async (GIOStream *stream,
int io_priority, int io_priority,
@ -516,21 +517,21 @@ g_io_stream_close_async (GIOStream *stream,
/** /**
* g_io_stream_close_finish: * g_io_stream_close_finish:
* @stream: a #GIOStream. * @stream: a #GIOStream
* @result: a #GAsyncResult. * @result: a #GAsyncResult
* @error: a #GError location to store the error occuring, or %NULL to * @error: a #GError location to store the error occuring, or %NULL to
* ignore. * ignore
* *
* Closes a stream. * Closes a stream.
* *
* Returns: %TRUE if stream was successfully closed, %FALSE otherwise. * Returns: %TRUE if stream was successfully closed, %FALSE otherwise.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_io_stream_close_finish (GIOStream *stream, g_io_stream_close_finish (GIOStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
GIOStreamClass *class; GIOStreamClass *class;
@ -563,11 +564,10 @@ close_async_thread (GSimpleAsyncResult *res,
GError *error = NULL; GError *error = NULL;
gboolean result; gboolean result;
/* Auto handling of cancelation disabled, and ignore /* Auto handling of cancelation disabled, and ignore cancellation,
cancellation, since we want to close things anyway, although * since we want to close things anyway, although possibly in a
possibly in a quick-n-dirty way. At least we never want to leak * quick-n-dirty way. At least we never want to leak open handles
open handles */ */
class = G_IO_STREAM_GET_CLASS (object); class = G_IO_STREAM_GET_CLASS (object);
if (class->close_fn) if (class->close_fn)
{ {
@ -581,11 +581,11 @@ close_async_thread (GSimpleAsyncResult *res,
} }
static void static void
g_io_stream_real_close_async (GIOStream *stream, g_io_stream_real_close_async (GIOStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *res; GSimpleAsyncResult *res;
@ -604,7 +604,7 @@ g_io_stream_real_close_async (GIOStream *stream,
} }
static gboolean static gboolean
g_io_stream_real_close_finish (GIOStream *stream, g_io_stream_real_close_finish (GIOStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) 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 * This is the function type of the callback used for the #GSource
* returned by g_socket_create_source(). * 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 * Since: 2.22
*/ */
@ -291,12 +291,12 @@ typedef gboolean (*GSocketSourceFunc) (GSocket *socket,
/** /**
* GInputVector: * GInputVector:
* @buffer: Pointer to a buffer where data will be written. * @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. * Structure used for scatter/gather data input.
* You generally pass in an array of #GInputVector<!-- -->s and the operation * You generally pass in an array of #GInputVector<!-- -->s
* will store the read data starting in the first buffer, switching to * and the operation will store the read data starting in the
* the next as needed. * first buffer, switching to the next as needed.
* *
* Since: 2.22 * Since: 2.22
*/ */
@ -313,8 +313,9 @@ struct _GInputVector {
* @size: the size of @buffer. * @size: the size of @buffer.
* *
* Structure used for scatter/gather data output. * Structure used for scatter/gather data output.
* You generally pass in an array of #GOutputVector<!-- -->s and the operation * You generally pass in an array of #GOutputVector<!-- -->s
* will use all the buffers as if they were one buffer. * and the operation will use all the buffers as if they were
* one buffer.
* *
* Since: 2.22 * Since: 2.22
*/ */

View File

@ -57,14 +57,14 @@
* *
* See #GSocketConnectable for and example of using the connectable * See #GSocketConnectable for and example of using the connectable
* interface. * interface.
**/ */
/** /**
* GNetworkAddress: * GNetworkAddress:
* *
* A #GSocketConnectable for resolving a hostname and connecting to * A #GSocketConnectable for resolving a hostname and connecting to
* that host. * that host.
**/ */
struct _GNetworkAddressPrivate { struct _GNetworkAddressPrivate {
gchar *hostname; gchar *hostname;
@ -129,13 +129,17 @@ g_network_address_class_init (GNetworkAddressClass *klass)
P_("Hostname"), P_("Hostname"),
P_("Hostname to resolve"), P_("Hostname to resolve"),
NULL, 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_object_class_install_property (gobject_class, PROP_PORT,
g_param_spec_uint ("port", g_param_spec_uint ("port",
P_("Port"), P_("Port"),
P_("Network port"), P_("Network port"),
0, 65535, 0, 0, 65535, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
} }
static void static void
@ -159,7 +163,7 @@ g_network_address_set_property (GObject *object,
{ {
GNetworkAddress *addr = G_NETWORK_ADDRESS (object); GNetworkAddress *addr = G_NETWORK_ADDRESS (object);
switch (prop_id) switch (prop_id)
{ {
case PROP_HOSTNAME: case PROP_HOSTNAME:
if (addr->priv->hostname) if (addr->priv->hostname)
@ -187,7 +191,7 @@ g_network_address_get_property (GObject *object,
GNetworkAddress *addr = G_NETWORK_ADDRESS (object); GNetworkAddress *addr = G_NETWORK_ADDRESS (object);
switch (prop_id) switch (prop_id)
{ {
case PROP_HOSTNAME: case PROP_HOSTNAME:
g_value_set_string (value, addr->priv->hostname); g_value_set_string (value, addr->priv->hostname);
break; break;
@ -233,7 +237,7 @@ g_network_address_set_addresses (GNetworkAddress *addr,
* Return value: the new #GNetworkAddress * Return value: the new #GNetworkAddress
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnectable * GSocketConnectable *
g_network_address_new (const gchar *hostname, g_network_address_new (const gchar *hostname,
guint16 port) 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 * @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 * address, an IPv4 address, or a domain name (in which case a DNS
* lookup is performed). Quoting with [] is supported for all address * lookup is performed). Quoting with [] is supported for all address
* types. A port override may be specified in the usual way with a * 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 * colon. Ports may be given as decimal numbers or symbolic names (in
* which case an /etc/services lookup is performed). * which case an /etc/services lookup is performed).
* *
* If no port is specified in @host_and_port then @default_port will be * If no port is specified in @host_and_port then @default_port will be
* used as the port number to connect to. * used as the port number to connect to.
* *
* In general, @host_and_port is expected to be provided by the user (allowing * In general, @host_and_port is expected to be provided by the user
* them to give the hostname, and a port overide if necessary) and * (allowing them to give the hostname, and a port overide if necessary)
* @default_port is expected to be provided by the application. * and @default_port is expected to be provided by the application.
* *
* Return value: the new #GNetworkAddress, or %NULL on error * Return value: the new #GNetworkAddress, or %NULL on error
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnectable * GSocketConnectable *
g_network_address_parse (const char *host_and_port, g_network_address_parse (const gchar *host_and_port,
guint16 default_port, guint16 default_port,
GError **error) GError **error)
{ {
GSocketConnectable *connectable; GSocketConnectable *connectable;
const gchar *port; const gchar *port;
@ -410,7 +414,7 @@ g_network_address_parse (const char *host_and_port,
* Return value: @addr's hostname * Return value: @addr's hostname
* *
* Since: 2.22 * Since: 2.22
**/ */
const gchar * const gchar *
g_network_address_get_hostname (GNetworkAddress *addr) g_network_address_get_hostname (GNetworkAddress *addr)
{ {
@ -425,10 +429,10 @@ g_network_address_get_hostname (GNetworkAddress *addr)
* *
* Gets @addr's port number * 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 * Since: 2.22
**/ */
guint16 guint16
g_network_address_get_port (GNetworkAddress *addr) 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, GSocketConnectable *g_network_address_new (const gchar *hostname,
guint16 port); guint16 port);
GSocketConnectable *g_network_address_parse (const char *host_and_port, GSocketConnectable *g_network_address_parse (const gchar *host_and_port,
guint16 default_port, guint16 default_port,
GError **error); GError **error);
const gchar *g_network_address_get_hostname (GNetworkAddress *addr); const gchar *g_network_address_get_hostname (GNetworkAddress *addr);
guint16 g_network_address_get_port (GNetworkAddress *addr); guint16 g_network_address_get_port (GNetworkAddress *addr);
G_END_DECLS G_END_DECLS

View File

@ -53,14 +53,14 @@
* See #GSrvTarget for more information about SRV records, and see * See #GSrvTarget for more information about SRV records, and see
* #GSocketConnectable for and example of using the connectable * #GSocketConnectable for and example of using the connectable
* interface. * interface.
**/ */
/** /**
* GNetworkService: * GNetworkService:
* *
* A #GSocketConnectable for resolving a SRV record and connecting to * A #GSocketConnectable for resolving a SRV record and connecting to
* that service. * that service.
**/ */
struct _GNetworkServicePrivate struct _GNetworkServicePrivate
{ {
@ -122,19 +122,25 @@ g_network_service_class_init (GNetworkServiceClass *klass)
P_("Service"), P_("Service"),
P_("Service name, eg \"ldap\""), P_("Service name, eg \"ldap\""),
NULL, 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_object_class_install_property (gobject_class, PROP_PROTOCOL,
g_param_spec_string ("protocol", g_param_spec_string ("protocol",
P_("Protocol"), P_("Protocol"),
P_("Network protocol, eg \"tcp\""), P_("Network protocol, eg \"tcp\""),
NULL, 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_object_class_install_property (gobject_class, PROP_DOMAIN,
g_param_spec_string ("domain", g_param_spec_string ("domain",
P_("domain"), P_("Domain"),
P_("Network domain, eg, \"example.com\""), P_("Network domain, eg, \"example.com\""),
NULL, NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
} }
static void static void
@ -158,7 +164,7 @@ g_network_service_set_property (GObject *object,
{ {
GNetworkService *srv = G_NETWORK_SERVICE (object); GNetworkService *srv = G_NETWORK_SERVICE (object);
switch (prop_id) switch (prop_id)
{ {
case PROP_SERVICE: case PROP_SERVICE:
srv->priv->service = g_value_dup_string (value); 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); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
} }
} }
static void static void
@ -188,7 +193,7 @@ g_network_service_get_property (GObject *object,
GNetworkService *srv = G_NETWORK_SERVICE (object); GNetworkService *srv = G_NETWORK_SERVICE (object);
switch (prop_id) switch (prop_id)
{ {
case PROP_SERVICE: case PROP_SERVICE:
g_value_set_string (value, g_network_service_get_service (srv)); g_value_set_string (value, g_network_service_get_service (srv));
break; break;
@ -205,7 +210,6 @@ g_network_service_get_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
} }
} }
/** /**
@ -221,7 +225,7 @@ g_network_service_get_property (GObject *object,
* Return value: a new #GNetworkService * Return value: a new #GNetworkService
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnectable * GSocketConnectable *
g_network_service_new (const gchar *service, g_network_service_new (const gchar *service,
const gchar *protocol, const gchar *protocol,
@ -243,7 +247,7 @@ g_network_service_new (const gchar *service,
* Return value: @srv's service name * Return value: @srv's service name
* *
* Since: 2.22 * Since: 2.22
**/ */
const gchar * const gchar *
g_network_service_get_service (GNetworkService *srv) g_network_service_get_service (GNetworkService *srv)
{ {
@ -261,7 +265,7 @@ g_network_service_get_service (GNetworkService *srv)
* Return value: @srv's protocol name * Return value: @srv's protocol name
* *
* Since: 2.22 * Since: 2.22
**/ */
const gchar * const gchar *
g_network_service_get_protocol (GNetworkService *srv) g_network_service_get_protocol (GNetworkService *srv)
{ {
@ -280,7 +284,7 @@ g_network_service_get_protocol (GNetworkService *srv)
* Return value: @srv's domain name * Return value: @srv's domain name
* *
* Since: 2.22 * Since: 2.22
**/ */
const gchar * const gchar *
g_network_service_get_domain (GNetworkService *srv) 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 * many threads/processes, etc it should allocate for concurrent DNS
* resolutions. * resolutions.
* *
* Return value: the #GResolver. * Return value: the default #GResolver.
* *
* Since: 2.22 * Since: 2.22
**/ */
GResolver * GResolver *
g_resolver_get_default (void) g_resolver_get_default (void)
{ {
@ -353,7 +353,7 @@ g_resolver_free_addresses (GList *addresses)
* %G_IO_ERROR_CANCELLED. * %G_IO_ERROR_CANCELLED.
* *
* Return value: a hostname (either ASCII-only, or in ASCII-encoded * Return value: a hostname (either ASCII-only, or in ASCII-encoded
* form), or %NULL on error. * form), or %NULL on error.
* *
* Since: 2.22 * 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 * Error domain for #GResolver. Errors in this domain will be from the
* #GResolverError enumeration. See #GError for more information on * #GResolverError enumeration. See #GError for more information on
* error domains. * error domains.
**/ */
#define G_RESOLVER_ERROR (g_resolver_error_quark ()) #define G_RESOLVER_ERROR (g_resolver_error_quark ())
GQuark g_resolver_error_quark (void); GQuark g_resolver_error_quark (void);

View File

@ -111,7 +111,7 @@
* if it tries to write to %stdout after it has been closed. * if it tries to write to %stdout after it has been closed.
* *
* Since: 2.22 * Since: 2.22
**/ */
static void g_socket_initable_iface_init (GInitableIface *iface); static void g_socket_initable_iface_init (GInitableIface *iface);
static gboolean g_socket_initable_init (GInitable *initable, static gboolean g_socket_initable_init (GInitable *initable,
@ -645,7 +645,9 @@ g_socket_class_init (GSocketClass *klass)
P_("The sockets address family"), P_("The sockets address family"),
G_TYPE_SOCKET_FAMILY, G_TYPE_SOCKET_FAMILY,
G_SOCKET_FAMILY_INVALID, 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_object_class_install_property (gobject_class, PROP_TYPE,
g_param_spec_enum ("type", g_param_spec_enum ("type",
@ -653,15 +655,19 @@ g_socket_class_init (GSocketClass *klass)
P_("The sockets type"), P_("The sockets type"),
G_TYPE_SOCKET_TYPE, G_TYPE_SOCKET_TYPE,
G_SOCKET_TYPE_STREAM, 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_object_class_install_property (gobject_class, PROP_PROTOCOL,
g_param_spec_enum ("protocol", g_param_spec_enum ("protocol",
P_("Socket protocol"), P_("Socket protocol"),
P_("The id of the protocol to use, or -1 for unknown"), P_("The id of the protocol to use, or -1 for unknown"),
G_TYPE_SOCKET_PROTOCOL, G_TYPE_SOCKET_PROTOCOL,
G_SOCKET_PROTOCOL_UNKNOWN, 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_object_class_install_property (gobject_class, PROP_FD,
g_param_spec_int ("fd", g_param_spec_int ("fd",
@ -670,44 +676,51 @@ g_socket_class_init (GSocketClass *klass)
G_MININT, G_MININT,
G_MAXINT, G_MAXINT,
-1, -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_object_class_install_property (gobject_class, PROP_BLOCKING,
g_param_spec_boolean ("blocking", g_param_spec_boolean ("blocking",
P_("blocking"), P_("blocking"),
P_("Whether or not I/O on this socket is blocking"), P_("Whether or not I/O on this socket is blocking"),
TRUE, 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_object_class_install_property (gobject_class, PROP_LISTEN_BACKLOG,
g_param_spec_int ("listen-backlog", g_param_spec_int ("listen-backlog",
P_("Listen backlog"), P_("Listen backlog"),
P_("outstanding connections in the listen queue"), P_("Outstanding connections in the listen queue"),
0, 0,
SOMAXCONN, SOMAXCONN,
10, 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_object_class_install_property (gobject_class, PROP_KEEPALIVE,
g_param_spec_boolean ("keepalive", g_param_spec_boolean ("keepalive",
P_("Keep connection alive"), P_("Keep connection alive"),
P_("Keep connection alive by sending periodic pings"), P_("Keep connection alive by sending periodic pings"),
FALSE, 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_object_class_install_property (gobject_class, PROP_LOCAL_ADDRESS,
g_param_spec_object ("local-address", g_param_spec_object ("local-address",
P_("Local address"), P_("Local address"),
P_("The local address the socket is bound to"), P_("The local address the socket is bound to"),
G_TYPE_SOCKET_ADDRESS, 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_object_class_install_property (gobject_class, PROP_REMOTE_ADDRESS,
g_param_spec_object ("remote-address", g_param_spec_object ("remote-address",
P_("Remote address"), P_("Remote address"),
P_("The remote address the socket is connected to"), P_("The remote address the socket is connected to"),
G_TYPE_SOCKET_ADDRESS, G_TYPE_SOCKET_ADDRESS,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
} }
static void static void
@ -786,12 +799,12 @@ g_socket_initable_init (GInitable *initable,
* Free the returned object with g_object_unref(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocket * GSocket *
g_socket_new (GSocketFamily family, g_socket_new (GSocketFamily family,
GSocketType type, GSocketType type,
GSocketProtocol protocol, GSocketProtocol protocol,
GError **error) GError **error)
{ {
return G_SOCKET (g_initable_new (G_TYPE_SOCKET, return G_SOCKET (g_initable_new (G_TYPE_SOCKET,
NULL, error, NULL, error,
@ -818,9 +831,9 @@ g_socket_new (GSocketFamily family,
* Free the returned object with g_object_unref(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocket * GSocket *
g_socket_new_from_fd (gint fd, g_socket_new_from_fd (gint fd,
GError **error) GError **error)
{ {
return G_SOCKET (g_initable_new (G_TYPE_SOCKET, 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. * is a GSocket level feature.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_set_blocking (GSocket *socket, g_socket_set_blocking (GSocket *socket,
gboolean blocking) gboolean blocking)
@ -870,7 +883,7 @@ g_socket_set_blocking (GSocket *socket,
* Returns: %TRUE if blocking I/O is used, %FALSE otherwise. * Returns: %TRUE if blocking I/O is used, %FALSE otherwise.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_get_blocking (GSocket *socket) 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. * remote side is disconnected, so as to avoid leaking resources forever.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_set_keepalive (GSocket *socket, g_socket_set_keepalive (GSocket *socket,
gboolean keepalive) gboolean keepalive)
{ {
int value; int value;
@ -934,7 +947,7 @@ g_socket_set_keepalive (GSocket *socket,
* Returns: %TRUE if keepalive is active, %FALSE otherwise. * Returns: %TRUE if keepalive is active, %FALSE otherwise.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_get_keepalive (GSocket *socket) g_socket_get_keepalive (GSocket *socket)
{ {
@ -953,9 +966,9 @@ g_socket_get_keepalive (GSocket *socket)
* Returns: the maximum number of pending connections. * Returns: the maximum number of pending connections.
* *
* Since: 2.22 * Since: 2.22
**/ */
gint 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); 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. * effect if called after that.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_set_listen_backlog (GSocket *socket, g_socket_set_listen_backlog (GSocket *socket,
gint backlog) gint backlog)
{ {
g_return_if_fail (G_IS_SOCKET (socket)); g_return_if_fail (G_IS_SOCKET (socket));
g_return_if_fail (!socket->priv->listening); g_return_if_fail (!socket->priv->listening);
@ -1000,7 +1013,7 @@ g_socket_set_listen_backlog (GSocket *socket,
* Returns: a #GSocketFamily * Returns: a #GSocketFamily
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketFamily GSocketFamily
g_socket_get_family (GSocket *socket) g_socket_get_family (GSocket *socket)
{ {
@ -1018,7 +1031,7 @@ g_socket_get_family (GSocket *socket)
* Returns: a #GSocketType * Returns: a #GSocketType
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketType GSocketType
g_socket_get_socket_type (GSocket *socket) 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 * Returns: a protocol id, or -1 if unknown
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketProtocol GSocketProtocol
g_socket_get_protocol (GSocket *socket) g_socket_get_protocol (GSocket *socket)
{ {
@ -1059,7 +1072,7 @@ g_socket_get_protocol (GSocket *socket)
* Returns: the file descriptor of the socket. * Returns: the file descriptor of the socket.
* *
* Since: 2.22 * Since: 2.22
**/ */
int int
g_socket_get_fd (GSocket *socket) g_socket_get_fd (GSocket *socket)
{ {
@ -1081,7 +1094,7 @@ g_socket_get_fd (GSocket *socket)
* Free the returned object with g_object_unref(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketAddress * GSocketAddress *
g_socket_get_local_address (GSocket *socket, g_socket_get_local_address (GSocket *socket,
GError **error) GError **error)
@ -1114,7 +1127,7 @@ g_socket_get_local_address (GSocket *socket,
* Free the returned object with g_object_unref(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketAddress * GSocketAddress *
g_socket_get_remote_address (GSocket *socket, g_socket_get_remote_address (GSocket *socket,
GError **error) GError **error)
@ -1145,7 +1158,7 @@ g_socket_get_remote_address (GSocket *socket,
* Returns: %TRUE if socket is connected, %FALSE otherwise. * Returns: %TRUE if socket is connected, %FALSE otherwise.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_is_connected (GSocket *socket) g_socket_is_connected (GSocket *socket)
{ {
@ -1171,7 +1184,7 @@ g_socket_is_connected (GSocket *socket)
* Returns: %TRUE on success, %FALSE on error. * Returns: %TRUE on success, %FALSE on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_listen (GSocket *socket, g_socket_listen (GSocket *socket,
GError **error) GError **error)
@ -1222,7 +1235,7 @@ g_socket_listen (GSocket *socket,
* Returns: %TRUE on success, %FALSE on error. * Returns: %TRUE on success, %FALSE on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_bind (GSocket *socket, g_socket_bind (GSocket *socket,
GSocketAddress *address, GSocketAddress *address,
@ -1286,7 +1299,7 @@ g_socket_bind (GSocket *socket,
* Free the returned object with g_object_unref(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocket * GSocket *
g_socket_accept (GSocket *socket, g_socket_accept (GSocket *socket,
GError **error) GError **error)
@ -1299,7 +1312,7 @@ g_socket_accept (GSocket *socket,
if (!check_socket (socket, error)) if (!check_socket (socket, error))
return NULL; return NULL;
while (1) while (TRUE)
{ {
if (socket->priv->blocking && if (socket->priv->blocking &&
!g_socket_condition_wait (socket, !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 * the default address for g_socket_send() and discards all incoming datagrams
* from other sources. * from other sources.
* *
* Generally connection oriented sockets can only connect once, but connection-less * Generally connection oriented sockets can only connect once, but
* sockets can connect multiple times to change the default address. * 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 * 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 * 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. * Returns: %TRUE if connected, %FALSE on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_connect (GSocket *socket, g_socket_connect (GSocket *socket,
GSocketAddress *address, GSocketAddress *address,
@ -1466,13 +1480,14 @@ g_socket_connect (GSocket *socket,
* @socket: a #GSocket * @socket: a #GSocket
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Checks and resets the pending connect error for the socket. This is * Checks and resets the pending connect error for the socket.
* used to check for errors when g_socket_connect() is used in non-blocking mode. * 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 * Returns: %TRUE if no error, %FALSE otherwise, setting @error to the error
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_check_connect_result (GSocket *socket, g_socket_check_connect_result (GSocket *socket,
GError **error) GError **error)
@ -1502,7 +1517,8 @@ g_socket_check_connect_result (GSocket *socket,
/** /**
* g_socket_receive: * g_socket_receive:
* @socket: a #GSocket * @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 * @size: the number of bytes that will be read from the stream
* @error: #GError for error reporting, or %NULL to ignore. * @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 * Returns: Number of bytes read, or -1 on error
* *
* Since: 2.22 * Since: 2.22
**/ */
gssize gssize
g_socket_receive (GSocket *socket, g_socket_receive (GSocket *socket,
gchar *buffer, gchar *buffer,
gsize size, gsize size,
GError **error) GError **error)
{ {
gssize ret; gssize ret;
@ -1584,7 +1600,8 @@ g_socket_receive (GSocket *socket,
* g_socket_receive_from: * g_socket_receive_from:
* @socket: a #GSocket * @socket: a #GSocket
* @address: a pointer to a #GSocketAddress pointer, or %NULL * @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 * @size: the number of bytes that will be read from the stream
* @error: #GError for error reporting, or %NULL to ignore. * @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 * Returns: Number of bytes read, or -1 on error
* *
* Since: 2.22 * Since: 2.22
**/ */
gssize gssize
g_socket_receive_from (GSocket *socket, g_socket_receive_from (GSocket *socket,
GSocketAddress **address, GSocketAddress **address,
gchar *buffer, gchar *buffer,
gsize size, gsize size,
GError **error) GError **error)
{ {
GInputVector v; GInputVector v;
@ -1632,15 +1649,15 @@ g_socket_receive_from (GSocket *socket,
* @size: the number of bytes to send * @size: the number of bytes to send
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Tries to send @size bytes from @buffer on the socket. This is mainly used by * Tries to send @size bytes from @buffer on the socket.
* connection oriented sockets, it is identical to g_socket_send_to() * This is mainly used by connection oriented sockets, it is identical
* with @address set to %NULL. * to g_socket_send_to() with @address set to %NULL.
* *
* If the socket is in blocking mode the call will block until there is * 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 * 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 * 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 * will be returned. To be notified of available space, wait for the
* condition. * %G_IO_OUT condition.
* *
* Note that on Windows you can't rely on a %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 * 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 * Returns: Number of bytes read, or -1 on error
* *
* Since: 2.22 * Since: 2.22
**/ */
gssize gssize
g_socket_send (GSocket *socket, g_socket_send (GSocket *socket,
const gchar *buffer, const gchar *buffer,
@ -1736,13 +1753,13 @@ g_socket_send (GSocket *socket,
* Returns: Number of bytes read, or -1 on error * Returns: Number of bytes read, or -1 on error
* *
* Since: 2.22 * Since: 2.22
**/ */
gssize gssize
g_socket_send_to (GSocket *socket, g_socket_send_to (GSocket *socket,
GSocketAddress *address, GSocketAddress *address,
const gchar *buffer, const gchar *buffer,
gsize size, gsize size,
GError **error) GError **error)
{ {
GOutputVector v; GOutputVector v;
@ -1780,12 +1797,12 @@ g_socket_send_to (GSocket *socket,
* Returns: %TRUE on success, %FALSE on error * Returns: %TRUE on success, %FALSE on error
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_shutdown (GSocket *socket, g_socket_shutdown (GSocket *socket,
gboolean shutdown_read, gboolean shutdown_read,
gboolean shutdown_write, gboolean shutdown_write,
GError **error) GError **error)
{ {
int how; int how;
@ -1835,12 +1852,13 @@ g_socket_shutdown (GSocket *socket,
* *
* Closes the socket, shutting down any active connection. * Closes the socket, shutting down any active connection.
* *
* Closing a socket does not wait for all outstanding I/O operations to finish, * Closing a socket does not wait for all outstanding I/O operations
* so the caller should not rely on them to be guaranteed to complete even * to finish, so the caller should not rely on them to be guaranteed
* if the close returns with no error. * to complete even if the close returns with no error.
* *
* Once the socket is closed, all other operations will return %G_IO_ERROR_CLOSED. * Once the socket is closed, all other operations will return
* Closing a stream multiple times will not return an error. * %G_IO_ERROR_CLOSED. Closing a stream multiple times will not
* return an error.
* *
* Sockets will be automatically closed when the last reference * Sockets will be automatically closed when the last reference
* is dropped, but you might want to call this function to make sure * 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 * Returns: %TRUE on success, %FALSE on error
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_close (GSocket *socket, g_socket_close (GSocket *socket,
GError **error) GError **error)
{ {
int res; int res;
@ -1910,7 +1928,7 @@ g_socket_close (GSocket *socket,
* Returns: %TRUE if socket is closed, %FALSE otherwise * Returns: %TRUE if socket is closed, %FALSE otherwise
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_is_closed (GSocket *socket) g_socket_is_closed (GSocket *socket)
{ {
@ -1920,22 +1938,22 @@ g_socket_is_closed (GSocket *socket)
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
/* Broken source, used on errors */ /* Broken source, used on errors */
static gboolean static gboolean
broken_prepare (GSource *source, broken_prepare (GSource *source,
gint *timeout) gint *timeout)
{ {
return FALSE; return FALSE;
} }
static gboolean static gboolean
broken_check (GSource *source) broken_check (GSource *source)
{ {
return FALSE; return FALSE;
} }
static gboolean static gboolean
broken_dispatch (GSource *source, broken_dispatch (GSource *source,
GSourceFunc callback, GSourceFunc callback,
gpointer user_data) gpointer user_data)
{ {
return TRUE; return TRUE;
} }
@ -2002,7 +2020,7 @@ update_select_events (GSocket *socket)
} }
static void static void
add_condition_watch (GSocket *socket, add_condition_watch (GSocket *socket,
GIOCondition *condition) GIOCondition *condition)
{ {
g_assert (g_list_find (socket->priv->requested_conditions, condition) == NULL); g_assert (g_list_find (socket->priv->requested_conditions, condition) == NULL);
@ -2014,7 +2032,7 @@ add_condition_watch (GSocket *socket,
} }
static void static void
remove_condition_watch (GSocket *socket, remove_condition_watch (GSocket *socket,
GIOCondition *condition) GIOCondition *condition)
{ {
g_assert (g_list_find (socket->priv->requested_conditions, condition) != NULL); g_assert (g_list_find (socket->priv->requested_conditions, condition) != NULL);
@ -2087,8 +2105,8 @@ typedef struct {
} GWinsockSource; } GWinsockSource;
static gboolean static gboolean
winsock_prepare (GSource *source, winsock_prepare (GSource *source,
gint *timeout) gint *timeout)
{ {
GWinsockSource *winsock_source = (GWinsockSource *)source; GWinsockSource *winsock_source = (GWinsockSource *)source;
GIOCondition current_condition; GIOCondition current_condition;
@ -2111,7 +2129,7 @@ winsock_prepare (GSource *source,
} }
static gboolean static gboolean
winsock_check (GSource *source) winsock_check (GSource *source)
{ {
GWinsockSource *winsock_source = (GWinsockSource *)source; GWinsockSource *winsock_source = (GWinsockSource *)source;
GIOCondition current_condition; GIOCondition current_condition;
@ -2134,9 +2152,9 @@ winsock_check (GSource *source)
} }
static gboolean static gboolean
winsock_dispatch (GSource *source, winsock_dispatch (GSource *source,
GSourceFunc callback, GSourceFunc callback,
gpointer user_data) gpointer user_data)
{ {
GSocketSourceFunc func = (GSocketSourceFunc)callback; GSocketSourceFunc func = (GSocketSourceFunc)callback;
GWinsockSource *winsock_source = (GWinsockSource *)source; GWinsockSource *winsock_source = (GWinsockSource *)source;
@ -2233,7 +2251,7 @@ winsock_source_new (GSocket *socket,
* Returns: a newly allocated %GSource, free with g_source_unref(). * Returns: a newly allocated %GSource, free with g_source_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GSource * GSource *
g_socket_create_source (GSocket *socket, g_socket_create_source (GSocket *socket,
GIOCondition condition, GIOCondition condition,
@ -2256,9 +2274,9 @@ g_socket_create_source (GSocket *socket,
* @socket: a #GSocket * @socket: a #GSocket
* @condition: a #GIOCondition mask to check * @condition: a #GIOCondition mask to check
* *
* Checks on the readiness of @socket to perform operations. The * Checks on the readiness of @socket to perform operations.
* operations specified in @condition are checked for and masked * The operations specified in @condition are checked for and masked
* against the currently-satisfied conditions on @socket. The result * against the currently-satisfied conditions on @socket. The result
* is returned. * is returned.
* *
* It is meaningless to specify %G_IO_ERR or %G_IO_HUP in condition; * 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 * Returns: the @GIOCondition mask of the current state
* *
* Since: 2.22 * Since: 2.22
**/ */
GIOCondition GIOCondition
g_socket_condition_check (GSocket *socket, g_socket_condition_check (GSocket *socket,
GIOCondition condition) GIOCondition condition)
{ {
if (!check_socket (socket, NULL)) if (!check_socket (socket, NULL))
return 0; return 0;
@ -2311,16 +2329,16 @@ g_socket_condition_check (GSocket *socket,
* @cancellable: a #GCancellable, or %NULL * @cancellable: a #GCancellable, or %NULL
* @error: a #GError pointer, or %NULL * @error: a #GError pointer, or %NULL
* *
* Waits for @condition to become true on @socket. When the condition * Waits for @condition to become true on @socket. When the condition
* becomes true, %TRUE is returned. * is met, %TRUE is returned.
* *
* If @cancellable is cancelled before the condition becomes true then * If @cancellable is cancelled before the condition is met then %FALSE
* %FALSE is returned and @error, if non-%NULL, is set to %G_IO_ERROR_CANCELLED. * is returned and @error, if non-%NULL, is set to %G_IO_ERROR_CANCELLED.
* *
* Returns: %TRUE if the condition was met, %FALSE otherwise * Returns: %TRUE if the condition was met, %FALSE otherwise
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_condition_wait (GSocket *socket, g_socket_condition_wait (GSocket *socket,
GIOCondition condition, GIOCondition condition,
@ -2431,7 +2449,6 @@ g_socket_condition_wait (GSocket *socket,
* If @num_vector is -1, then @vector is assumed to be terminated * If @num_vector is -1, then @vector is assumed to be terminated
* by a #GOutputVector with a %NULL buffer pointer. * by a #GOutputVector with a %NULL buffer pointer.
* *
*
* @messages, if non-%NULL, is taken to point to an array of @num_messages * @messages, if non-%NULL, is taken to point to an array of @num_messages
* #GSocketControlMessage instances. These correspond to the control * #GSocketControlMessage instances. These correspond to the control
* messages to be sent on the socket. * 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 * Returns: Number of bytes read, or -1 on error
* *
* Since: 2.22 * Since: 2.22
**/ */
gssize gssize
g_socket_send_message (GSocket *socket, g_socket_send_message (GSocket *socket,
GSocketAddress *address, GSocketAddress *address,
@ -2748,7 +2765,7 @@ g_socket_send_message (GSocket *socket,
* Returns: Number of bytes read, or -1 on error * Returns: Number of bytes read, or -1 on error
* *
* Since: 2.22 * Since: 2.22
**/ */
gssize gssize
g_socket_receive_message (GSocket *socket, g_socket_receive_message (GSocket *socket,
GSocketAddress **address, GSocketAddress **address,

View File

@ -48,14 +48,14 @@
* in the BSD sockets API. This is an abstract class; use * in the BSD sockets API. This is an abstract class; use
* #GInetSocketAddress for internet sockets, or #GUnixSocketAddress * #GInetSocketAddress for internet sockets, or #GUnixSocketAddress
* for UNIX domain sockets. * for UNIX domain sockets.
**/ */
/** /**
* GSocketAddress: * GSocketAddress:
* *
* A socket endpoint address, corresponding to <type>struct sockaddr</type> * A socket endpoint address, corresponding to <type>struct sockaddr</type>
* or one of its subtypes. * or one of its subtypes.
**/ */
enum enum
{ {
@ -118,7 +118,8 @@ g_socket_address_class_init (GSocketAddressClass *klass)
P_("The family of the socket address"), P_("The family of the socket address"),
G_TYPE_SOCKET_FAMILY, G_TYPE_SOCKET_FAMILY,
G_SOCKET_FAMILY_INVALID, 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 static void
@ -142,7 +143,7 @@ g_socket_address_init (GSocketAddress *address)
* g_socket_address_to_native(). * g_socket_address_to_native().
* *
* Returns: the size of the native <type>struct sockaddr</type> that * Returns: the size of the native <type>struct sockaddr</type> that
* @address represents * @address represents
* *
* Since: 2.22 * Since: 2.22
*/ */
@ -176,10 +177,10 @@ g_socket_address_get_native_size (GSocketAddress *address)
* Since: 2.22 * Since: 2.22
*/ */
gboolean gboolean
g_socket_address_to_native (GSocketAddress *address, g_socket_address_to_native (GSocketAddress *address,
gpointer dest, gpointer dest,
gsize destlen, gsize destlen,
GError **error) GError **error)
{ {
g_return_val_if_fail (G_IS_SOCKET_ADDRESS (address), FALSE); 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. * ignored.
* *
* Return value: a #GSocketAddress (owned by the caller), or %NULL on * 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 * error (in which case *@error will be set) or if there are no
* addresses. * more addresses.
**/ */
GSocketAddress * GSocketAddress *
g_socket_address_enumerator_next (GSocketAddressEnumerator *enumerator, g_socket_address_enumerator_next (GSocketAddressEnumerator *enumerator,
GCancellable *cancellable, GCancellable *cancellable,
@ -91,10 +91,10 @@ g_socket_address_enumerator_next (GSocketAddressEnumerator *enumerator,
* and so the synchronous method will never block. * and so the synchronous method will never block.
*/ */
static void static void
g_socket_address_enumerator_real_next_async (GSocketAddressEnumerator *enumerator, g_socket_address_enumerator_real_next_async (GSocketAddressEnumerator *enumerator,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
GSocketAddress *address; GSocketAddress *address;
@ -125,12 +125,12 @@ g_socket_address_enumerator_real_next_async (GSocketAddressEnumerator *enumerat
* Asynchronously retrieves the next #GSocketAddress from @enumerator * Asynchronously retrieves the next #GSocketAddress from @enumerator
* and then calls @callback, which must call * and then calls @callback, which must call
* g_socket_address_enumerator_next_finish() to get the result. * g_socket_address_enumerator_next_finish() to get the result.
**/ */
void void
g_socket_address_enumerator_next_async (GSocketAddressEnumerator *enumerator, g_socket_address_enumerator_next_async (GSocketAddressEnumerator *enumerator,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSocketAddressEnumeratorClass *klass; GSocketAddressEnumeratorClass *klass;
@ -161,8 +161,8 @@ g_socket_address_enumerator_real_next_finish (GSocketAddressEnumerator *enumera
/** /**
* g_socket_address_enumerator_next_finish: * g_socket_address_enumerator_next_finish:
* @enumerator: a #GSocketAddressEnumerator * @enumerator: a #GSocketAddressEnumerator
* @result: a #GAsyncResult. * @result: a #GAsyncResult
* @error: a #GError. * @error: a #GError
* *
* Retrieves the result of a completed call to * Retrieves the result of a completed call to
* g_socket_address_enumerator_next_async(). See * g_socket_address_enumerator_next_async(). See
@ -170,9 +170,9 @@ g_socket_address_enumerator_real_next_finish (GSocketAddressEnumerator *enumera
* error handling. * error handling.
* *
* Return value: a #GSocketAddress (owned by the caller), or %NULL on * 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 * error (in which case *@error will be set) or if there are no
* addresses. * more addresses.
**/ */
GSocketAddress * GSocketAddress *
g_socket_address_enumerator_next_finish (GSocketAddressEnumerator *enumerator, g_socket_address_enumerator_next_finish (GSocketAddressEnumerator *enumerator,
GAsyncResult *result, GAsyncResult *result,

View File

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

View File

@ -60,7 +60,7 @@
* it will be a #GTcpConnection. * it will be a #GTcpConnection.
* *
* Since: 2.22 * Since: 2.22
**/ */
G_DEFINE_TYPE (GSocketClient, g_socket_client, G_TYPE_OBJECT); 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(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketClient * GSocketClient *
g_socket_client_new (void) g_socket_client_new (void)
{ {
@ -229,7 +229,7 @@ g_socket_client_set_property (GObject *object,
* Returns: a #GSocketFamily * Returns: a #GSocketFamily
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketFamily GSocketFamily
g_socket_client_get_family (GSocketClient *client) 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. * be an ipv6 mapped to ipv4 address.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_client_set_family (GSocketClient *client, g_socket_client_set_family (GSocketClient *client,
GSocketFamily family) GSocketFamily family)
{ {
if (client->priv->family == family) if (client->priv->family == family)
return; return;
@ -274,7 +274,7 @@ g_socket_client_set_family (GSocketClient *client,
* Returns: a #GSocketFamily * Returns: a #GSocketFamily
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketType GSocketType
g_socket_client_get_socket_type (GSocketClient *client) 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. * as GSocketClient is used for connection oriented services.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_client_set_socket_type (GSocketClient *client, g_socket_client_set_socket_type (GSocketClient *client,
GSocketType type) GSocketType type)
{ {
if (client->priv->type == type) if (client->priv->type == type)
return; return;
@ -308,7 +308,7 @@ g_socket_client_set_socket_type (GSocketClient *client,
/** /**
* g_socket_client_get_protocol: * g_socket_client_get_protocol:
* @client: a #GSocketClient. * @client: a #GSocketClient
* *
* Gets the protocol name type of the socket client. * Gets the protocol name type of the socket client.
* *
@ -317,7 +317,7 @@ g_socket_client_set_socket_type (GSocketClient *client,
* Returns: a #GSocketProtocol * Returns: a #GSocketProtocol
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketProtocol GSocketProtocol
g_socket_client_get_protocol (GSocketClient *client) 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. * protocol for the socket family and type.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_client_set_protocol (GSocketClient *client, g_socket_client_set_protocol (GSocketClient *client,
GSocketProtocol protocol) GSocketProtocol protocol)
{ {
if (client->priv->protocol == protocol) if (client->priv->protocol == protocol)
return; return;
@ -360,7 +360,7 @@ g_socket_client_set_protocol (GSocketClient *client,
* Returns: a #GSocketAddres or %NULL. don't free * Returns: a #GSocketAddres or %NULL. don't free
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketAddress * GSocketAddress *
g_socket_client_get_local_address (GSocketClient *client) g_socket_client_get_local_address (GSocketClient *client)
{ {
@ -381,10 +381,10 @@ g_socket_client_get_local_address (GSocketClient *client)
* a specific interface. * a specific interface.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_client_set_local_address (GSocketClient *client, g_socket_client_set_local_address (GSocketClient *client,
GSocketAddress *address) GSocketAddress *address)
{ {
if (address) if (address)
g_object_ref (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"), P_("The sockets address family to use for socket construction"),
G_TYPE_SOCKET_FAMILY, G_TYPE_SOCKET_FAMILY,
G_SOCKET_FAMILY_INVALID, 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_object_class_install_property (gobject_class, PROP_TYPE,
g_param_spec_enum ("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"), P_("The sockets type to use for socket construction"),
G_TYPE_SOCKET_TYPE, G_TYPE_SOCKET_TYPE,
G_SOCKET_TYPE_STREAM, 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_object_class_install_property (gobject_class, PROP_PROTOCOL,
g_param_spec_enum ("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"), P_("The protocol to use for socket construction, or 0 for default"),
G_TYPE_SOCKET_PROTOCOL, G_TYPE_SOCKET_PROTOCOL,
G_SOCKET_PROTOCOL_DEFAULT, 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_object_class_install_property (gobject_class, PROP_LOCAL_ADDRESS,
g_param_spec_object ("local-address", g_param_spec_object ("local-address",
P_("Local address"), P_("Local address"),
P_("The local address constructed sockets will be bound to"), P_("The local address constructed sockets will be bound to"),
G_TYPE_SOCKET_ADDRESS, 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. * Returns: a #GSocketConnection on success, %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnection * GSocketConnection *
g_socket_client_connect (GSocketClient *client, g_socket_client_connect (GSocketClient *client,
GSocketConnectable *connectable, 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 * 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 * them to give the hostname, and a port overide if necessary) and
* @default_port is expected to be provided by the application. * @default_port is expected to be provided by the application.
*
* In the case that an IP address is given, a single connection * In the case that an IP address is given, a single connection
* attempt is made. In the case that a name is given, multiple * attempt is made. In the case that a name is given, multiple
* connection attempts may be made, in turn and according to the * 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. Returns: a #GSocketConnection on success, %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnection * GSocketConnection *
g_socket_client_connect_to_host (GSocketClient *client, g_socket_client_connect_to_host (GSocketClient *client,
const char *host_and_port, const gchar *host_and_port,
int default_port, gint default_port,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GSocketConnectable *connectable; GSocketConnectable *connectable;
GSocketConnection *connection; 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 * In the event of any failure (DNS error, service not found, no hosts
* connectable) %NULL is returned and @error (if non-%NULL) is set * connectable) %NULL is returned and @error (if non-%NULL) is set
* accordingly. * accordingly.
**/ */
GSocketConnection * GSocketConnection *
g_socket_client_connect_to_service (GSocketClient *client, g_socket_client_connect_to_service (GSocketClient *client,
const char *domain, const gchar *domain,
const char *service, const gchar *service,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
@ -823,7 +831,7 @@ g_socket_client_enumerator_callback (GObject *object,
* the result of the operation. * the result of the operation.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_client_connect_async (GSocketClient *client, g_socket_client_connect_async (GSocketClient *client,
GSocketConnectable *connectable, GSocketConnectable *connectable,
@ -869,11 +877,11 @@ g_socket_client_connect_async (GSocketClient *client,
* the result of the operation. * the result of the operation.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_client_connect_to_host_async (GSocketClient *client, g_socket_client_connect_to_host_async (GSocketClient *client,
const char *host_and_port, const gchar *host_and_port,
int default_port, gint default_port,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
@ -910,11 +918,13 @@ g_socket_client_connect_to_host_async (GSocketClient *client,
* *
* This is the asynchronous version of * This is the asynchronous version of
* g_socket_client_connect_to_service(). * g_socket_client_connect_to_service().
**/ *
* Since: 2.22
*/
void void
g_socket_client_connect_to_service_async (GSocketClient *client, g_socket_client_connect_to_service_async (GSocketClient *client,
const char *domain, const gchar *domain,
const char *service, const gchar *service,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
@ -940,7 +950,7 @@ g_socket_client_connect_to_service_async (GSocketClient *client,
* Returns: a #GSocketConnection on success, %NULL on error. * Returns: a #GSocketConnection on success, %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnection * GSocketConnection *
g_socket_client_connect_finish (GSocketClient *client, g_socket_client_connect_finish (GSocketClient *client,
GAsyncResult *result, GAsyncResult *result,
@ -966,11 +976,11 @@ g_socket_client_connect_finish (GSocketClient *client,
* Returns: a #GSocketConnection on success, %NULL on error. * Returns: a #GSocketConnection on success, %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnection * GSocketConnection *
g_socket_client_connect_to_host_finish (GSocketClient *client, g_socket_client_connect_to_host_finish (GSocketClient *client,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
return g_socket_client_connect_finish (client, result, 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. * Returns: a #GSocketConnection on success, %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnection * GSocketConnection *
g_socket_client_connect_to_service_finish (GSocketClient *client, g_socket_client_connect_to_service_finish (GSocketClient *client,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
return g_socket_client_connect_finish (client, result, error); return g_socket_client_connect_finish (client, result, error);
} }

View File

@ -88,13 +88,13 @@ GSocketConnection * g_socket_client_connect (GSocket
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
GSocketConnection * g_socket_client_connect_to_host (GSocketClient *client, GSocketConnection * g_socket_client_connect_to_host (GSocketClient *client,
const char *host_and_port, const gchar *host_and_port,
int default_port, gint default_port,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
GSocketConnection * g_socket_client_connect_to_service (GSocketClient *client, GSocketConnection * g_socket_client_connect_to_service (GSocketClient *client,
const char *domain, const gchar *domain,
const char *service, const gchar *service,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
void g_socket_client_connect_async (GSocketClient *client, void g_socket_client_connect_async (GSocketClient *client,
@ -106,8 +106,8 @@ GSocketConnection * g_socket_client_connect_finish (GSocket
GAsyncResult *result, GAsyncResult *result,
GError **error); GError **error);
void g_socket_client_connect_to_host_async (GSocketClient *client, void g_socket_client_connect_to_host_async (GSocketClient *client,
const char *host_and_port, const gchar *host_and_port,
int default_port, gint default_port,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
@ -116,8 +116,8 @@ GSocketConnection * g_socket_client_connect_to_host_finish (GSocket
GError **error); GError **error);
void g_socket_client_connect_to_service_async (GSocketClient *client, void g_socket_client_connect_to_service_async (GSocketClient *client,
const char *domain, const gchar *domain,
const char *service, const gchar *service,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);

View File

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

View File

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

View File

@ -49,17 +49,17 @@
* can be created either by #GSocketClient when connecting to a host, * can be created either by #GSocketClient when connecting to a host,
* or by #GSocketListener when accepting a new client. * or by #GSocketListener when accepting a new client.
* *
* The type of the #GSocketConnection object returned from these calls depends * The type of the #GSocketConnection object returned from these calls
* on the type of the underlying socket that is in use. For instance, for a * depends on the type of the underlying socket that is in use. For
* TCP/IP connection it will be a #GTcpConnection. * instance, for a TCP/IP connection it will be a #GTcpConnection.
* *
* Chosing what type of object to construct is done with the socket connection * Chosing what type of object to construct is done with the socket
* factory, and it is possible for 3rd parties to register custom socket connection * connection factory, and it is possible for 3rd parties to register
* types for specific combination of socket family/type/protocol using * custom socket connection types for specific combination of socket
* g_socket_connection_factory_register_type(). * family/type/protocol using g_socket_connection_factory_register_type().
* *
* Since: 2.22 * Since: 2.22
**/ */
G_DEFINE_TYPE (GSocketConnection, G_DEFINE_TYPE (GSocketConnection,
g_socket_connection, G_TYPE_IO_STREAM); 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: * g_socket_connection_get_socket:
* @connection: a #GSocketConnection. * @connection: a #GSocketConnection
* *
* Gets the underlying #GSocket object of the connection. * Gets the underlying #GSocket object of the connection.
* This can be useful if you want to do something unusual on it * 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. * Returns: a #GSocketAddress or %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocket * GSocket *
g_socket_connection_get_socket (GSocketConnection *connection) g_socket_connection_get_socket (GSocketConnection *connection)
{ {
@ -135,7 +135,7 @@ g_socket_connection_get_socket (GSocketConnection *connection)
/** /**
* g_socket_connection_get_local_address: * g_socket_connection_get_local_address:
* @connection: a #GSocketConnection. * @connection: a #GSocketConnection
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Try to get the local address of a socket connection. * 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(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketAddress * GSocketAddress *
g_socket_connection_get_local_address (GSocketConnection *connection, g_socket_connection_get_local_address (GSocketConnection *connection,
GError **error) GError **error)
{ {
return g_socket_get_local_address (connection->priv->socket, error); return g_socket_get_local_address (connection->priv->socket, error);
} }
/** /**
* g_socket_connection_get_remote_address: * g_socket_connection_get_remote_address:
* @connection: a #GSocketConnection. * @connection: a #GSocketConnection
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Try to get the remove address of a socket connection. * 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(). * Free the returned object with g_object_unref().
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketAddress * GSocketAddress *
g_socket_connection_get_remote_address (GSocketConnection *connection, g_socket_connection_get_remote_address (GSocketConnection *connection,
GError **error) GError **error)
{ {
return g_socket_get_remote_address (connection->priv->socket, error); return g_socket_get_remote_address (connection->priv->socket, error);
} }
static void static void
g_socket_connection_get_property (GObject *object, guint prop_id, g_socket_connection_get_property (GObject *object,
GValue *value, GParamSpec *pspec) guint prop_id,
GValue *value,
GParamSpec *pspec)
{ {
GSocketConnection *connection = G_SOCKET_CONNECTION (object); GSocketConnection *connection = G_SOCKET_CONNECTION (object);
@ -189,8 +191,10 @@ g_socket_connection_get_property (GObject *object, guint prop_id,
} }
static void static void
g_socket_connection_set_property (GObject *object, guint prop_id, g_socket_connection_set_property (GObject *object,
const GValue *value, GParamSpec *pspec) guint prop_id,
const GValue *value,
GParamSpec *pspec)
{ {
GSocketConnection *connection = G_SOCKET_CONNECTION (object); 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_async = g_socket_connection_close_async;
stream_class->close_finish = g_socket_connection_close_finish; stream_class->close_finish = g_socket_connection_close_finish;
g_object_class_install_property (gobject_class, PROP_SOCKET, g_object_class_install_property (gobject_class,
g_param_spec_object ("socket", PROP_SOCKET,
P_("Socket"), g_param_spec_object ("socket",
P_("The underlying GSocket"), P_("Socket"),
G_TYPE_SOCKET, G_PARAM_CONSTRUCT_ONLY | P_("The underlying GSocket"),
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_TYPE_SOCKET,
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
} }
static void static void
@ -266,9 +273,9 @@ g_socket_connection_init (GSocketConnection *connection)
} }
static gboolean static gboolean
g_socket_connection_close (GIOStream *stream, g_socket_connection_close (GIOStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GSocketConnection *connection = G_SOCKET_CONNECTION (stream); GSocketConnection *connection = G_SOCKET_CONNECTION (stream);
@ -284,11 +291,11 @@ g_socket_connection_close (GIOStream *stream,
static void static void
g_socket_connection_close_async (GIOStream *stream, g_socket_connection_close_async (GIOStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *res; GSimpleAsyncResult *res;
GIOStreamClass *class; GIOStreamClass *class;
@ -317,7 +324,7 @@ g_socket_connection_close_async (GIOStream *stream,
} }
static gboolean static gboolean
g_socket_connection_close_finish (GIOStream *stream, g_socket_connection_close_finish (GIOStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
@ -369,8 +376,8 @@ G_LOCK_DEFINE_STATIC(connection_factories);
/** /**
* g_socket_connection_factory_register_type: * g_socket_connection_factory_register_type:
* @g_type: a #GType, inheriting from G_SOCKET_CONNECTION * @g_type: a #GType, inheriting from %G_TYPE_SOCKET_CONNECTION
* @family: a #GSocketFamily. * @family: a #GSocketFamily
* @type: a #GSocketType * @type: a #GSocketType
* @protocol: a protocol id * @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. * If no type is registered, the #GSocketConnection base type is returned.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_connection_factory_register_type (GType g_type, g_socket_connection_factory_register_type (GType g_type,
GSocketFamily family, GSocketFamily family,
GSocketType type, GSocketType type,
gint protocol) gint protocol)
{ {
ConnectionFactory *factory; ConnectionFactory *factory;
@ -423,7 +430,7 @@ init_builtin_types (void)
/** /**
* g_socket_connection_factory_lookup_type: * g_socket_connection_factory_lookup_type:
* @family: a #GSocketFamily. * @family: a #GSocketFamily
* @type: a #GSocketType * @type: a #GSocketType
* @protocol_id: a protocol id * @protocol_id: a protocol id
* *
@ -433,12 +440,13 @@ init_builtin_types (void)
* If no type is registered, the #GSocketConnection base type is returned. * If no type is registered, the #GSocketConnection base type is returned.
* *
* Returns: a #GType * Returns: a #GType
*
* Since: 2.22 * Since: 2.22
**/ */
GType GType
g_socket_connection_factory_lookup_type (GSocketFamily family, g_socket_connection_factory_lookup_type (GSocketFamily family,
GSocketType type, GSocketType type,
gint protocol_id) gint protocol_id)
{ {
ConnectionFactory *factory, key; ConnectionFactory *factory, key;
GType g_type; GType g_type;
@ -467,7 +475,7 @@ g_socket_connection_factory_lookup_type (GSocketFamily family,
/** /**
* g_socket_connection_factory_create_connection: * g_socket_connection_factory_create_connection:
* @socket: a #GSocket. * @socket: a #GSocket
* *
* Creates a #GSocketConnection subclass of the right type for * Creates a #GSocketConnection subclass of the right type for
* @socket. * @socket.
@ -475,7 +483,7 @@ g_socket_connection_factory_lookup_type (GSocketFamily family,
* Returns: a #GSocketConnection * Returns: a #GSocketConnection
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnection * GSocketConnection *
g_socket_connection_factory_create_connection (GSocket *socket) 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; GType g_socket_connection_get_type (void) G_GNUC_CONST;
GSocket *g_socket_connection_get_socket (GSocketConnection *connection); GSocket *g_socket_connection_get_socket (GSocketConnection *connection);
GSocketAddress *g_socket_connection_get_local_address (GSocketConnection *connection, GSocketAddress *g_socket_connection_get_local_address (GSocketConnection *connection,
GError **error); GError **error);
GSocketAddress *g_socket_connection_get_remote_address (GSocketConnection *connection, GSocketAddress *g_socket_connection_get_remote_address (GSocketConnection *connection,
GError **error); GError **error);
void g_socket_connection_factory_register_type (GType g_type, void g_socket_connection_factory_register_type (GType g_type,
GSocketFamily family, GSocketFamily family,
GSocketType type, GSocketType type,
gint protocol); gint protocol);
GType g_socket_connection_factory_lookup_type (GSocketFamily family, GType g_socket_connection_factory_lookup_type (GSocketFamily family,
GSocketType type, GSocketType type,
gint protocol_id); gint protocol_id);
GSocketConnection *g_socket_connection_factory_create_connection (GSocket *socket); GSocketConnection *g_socket_connection_factory_create_connection (GSocket *socket);
G_END_DECLS G_END_DECLS

View File

@ -19,7 +19,7 @@
* @see_also: #GSocket. * @see_also: #GSocket.
* *
* A #GSocketControlMessage is a special-purpose utility message that * 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". * messages are often called "ancillary data".
* *
* The message can represent some sort of special instruction to or * The message can represent some sort of special instruction to or
@ -40,7 +40,7 @@
* g_socket_receive_message() to read such a message. * g_socket_receive_message() to read such a message.
* *
* Since: 2.22 * Since: 2.22
**/ */
#include "config.h" #include "config.h"
#include "gsocketcontrolmessage.h" #include "gsocketcontrolmessage.h"
@ -70,7 +70,7 @@ G_DEFINE_ABSTRACT_TYPE (GSocketControlMessage,
* Returns: The number of bytes required. * Returns: The number of bytes required.
* *
* Since: 2.22 * Since: 2.22
**/ */
gsize gsize
g_socket_control_message_get_size (GSocketControlMessage *message) 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. * Returns the "level" (i.e. the originating protocol) of the control message.
* This is often SOL_SOCKET. * This is often SOL_SOCKET.
* *
* Returns: and int describing the level * Returns: an integer describing the level
* *
* Since: 2.22 * Since: 2.22
**/ */
int int
g_socket_control_message_get_level (GSocketControlMessage *message) 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: * g_socket_control_message_get_msg_type:
* @message: a #GSocketControlMessage * @message: a #GSocketControlMessage
* *
* Returns the protocol specify type of the control message. * Returns the protocol specific type of the control message.
* For instance, for unix fd passing this would be SCM_RIGHTS. * 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 * Since: 2.22
**/ */
int int
g_socket_control_message_get_msg_type (GSocketControlMessage *message) g_socket_control_message_get_msg_type (GSocketControlMessage *message)
{ {
@ -130,7 +130,7 @@ g_socket_control_message_get_msg_type (GSocketControlMessage *message)
* object. * object.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_control_message_serialize (GSocketControlMessage *message, g_socket_control_message_serialize (GSocketControlMessage *message,
gpointer data) 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 * GSocketControlMessage *
g_socket_control_message_deserialize (int level, g_socket_control_message_deserialize (int level,
int type, int type,
gsize size, gsize size,
gpointer data) gpointer data)
{ {
GSocketControlMessageClass *klass; GSocketControlMessageClass *klass;
GSocketControlMessage *message; GSocketControlMessage *message;

View File

@ -175,7 +175,7 @@ g_socket_listener_init (GSocketListener *listener)
* Returns: a new #GSocketListener. * Returns: a new #GSocketListener.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketListener * GSocketListener *
g_socket_listener_new (void) g_socket_listener_new (void)
{ {
@ -215,12 +215,12 @@ check_listener (GSocketListener *listener,
* Returns: %TRUE on success, %FALSE on error. * Returns: %TRUE on success, %FALSE on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_listener_add_socket (GSocketListener *listener, g_socket_listener_add_socket (GSocketListener *listener,
GSocket *socket, GSocket *socket,
GObject *source_object, GObject *source_object,
GError **error) GError **error)
{ {
if (!check_listener (listener, error)) if (!check_listener (listener, error))
return FALSE; return FALSE;
@ -264,14 +264,14 @@ g_socket_listener_add_socket (GSocketListener *listener,
* Returns: %TRUE on success, %FALSE on error. * Returns: %TRUE on success, %FALSE on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_listener_add_address (GSocketListener *listener, g_socket_listener_add_address (GSocketListener *listener,
GSocketAddress *address, GSocketAddress *address,
GSocketType type, GSocketType type,
GSocketProtocol protocol, GSocketProtocol protocol,
GObject *source_object, GObject *source_object,
GError **error) GError **error)
{ {
GSocketFamily family; GSocketFamily family;
GSocket *socket; GSocket *socket;
@ -321,12 +321,12 @@ g_socket_listener_add_address (GSocketListener *listener,
* Returns: %TRUE on success, %FALSE on error. * Returns: %TRUE on success, %FALSE on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_listener_add_inet_port (GSocketListener *listener, g_socket_listener_add_inet_port (GSocketListener *listener,
int port, int port,
GObject *source_object, GObject *source_object,
GError **error) GError **error)
{ {
GSocketAddress *address4, *address6; GSocketAddress *address4, *address6;
GInetAddress *inet_address; GInetAddress *inet_address;
@ -379,11 +379,11 @@ g_socket_listener_add_inet_port (GSocketListener *listener,
} }
static GList * static GList *
add_sources (GSocketListener *listener, add_sources (GSocketListener *listener,
GSocketSourceFunc callback, GSocketSourceFunc callback,
gpointer callback_data, gpointer callback_data,
GCancellable *cancellable, GCancellable *cancellable,
GMainContext *context) GMainContext *context)
{ {
GSocket *socket; GSocket *socket;
GSource *source; GSource *source;
@ -426,9 +426,9 @@ struct AcceptData {
}; };
static gboolean static gboolean
accept_callback (GSocket *socket, accept_callback (GSocket *socket,
GIOCondition condition, GIOCondition condition,
gpointer user_data) gpointer user_data)
{ {
struct AcceptData *data = 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 * object specified when the corresponding socket or address was added
* to the listener. * 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 * 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. * Returns: a #GSocket on success, %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocket * GSocket *
g_socket_listener_accept_socket (GSocketListener *listener, g_socket_listener_accept_socket (GSocketListener *listener,
GObject **source_object, GObject **source_object,
@ -530,14 +530,14 @@ g_socket_listener_accept_socket (GSocketListener *listener,
* object specified when the corresponding socket or address was added * object specified when the corresponding socket or address was added
* to the listener. * 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 * 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. * Returns: a #GSocketConnection on success, %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnection * GSocketConnection *
g_socket_listener_accept (GSocketListener *listener, g_socket_listener_accept (GSocketListener *listener,
GObject **source_object, GObject **source_object,
@ -567,9 +567,9 @@ struct AcceptAsyncData {
}; };
static gboolean static gboolean
accept_ready (GSocket *accept_socket, accept_ready (GSocket *accept_socket,
GIOCondition condition, GIOCondition condition,
gpointer _data) gpointer _data)
{ {
struct AcceptAsyncData *data = _data; struct AcceptAsyncData *data = _data;
GError *error = NULL; GError *error = NULL;
@ -617,16 +617,16 @@ accept_ready (GSocket *accept_socket,
* This is the asynchronous version of g_socket_listener_accept_socket(). * This is the asynchronous version of g_socket_listener_accept_socket().
* *
* When the operation is finished @callback will be * When the operation is finished @callback will be
* called. You can then call g_socket_listener_accept_socket_finish() to get * called. You can then call g_socket_listener_accept_socket_finish()
* the result of the operation. * to get the result of the operation.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_listener_accept_socket_async (GSocketListener *listener, g_socket_listener_accept_socket_async (GSocketListener *listener,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
struct AcceptAsyncData *data; struct AcceptAsyncData *data;
GError *error = NULL; GError *error = NULL;
@ -665,12 +665,12 @@ g_socket_listener_accept_socket_async (GSocketListener *listener,
* Returns: a #GSocket on success, %NULL on error. * Returns: a #GSocket on success, %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocket * GSocket *
g_socket_listener_accept_socket_finish (GSocketListener *listener, g_socket_listener_accept_socket_finish (GSocketListener *listener,
GAsyncResult *result, GAsyncResult *result,
GObject **source_object, GObject **source_object,
GError **error) GError **error)
{ {
GSocket *socket; GSocket *socket;
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
@ -702,11 +702,11 @@ g_socket_listener_accept_socket_finish (GSocketListener *listener,
* This is the asynchronous version of g_socket_listener_accept(). * This is the asynchronous version of g_socket_listener_accept().
* *
* When the operation is finished @callback will be * When the operation is finished @callback will be
* called. You can then call g_socket_listener_accept_socket() to get * called. You can then call g_socket_listener_accept_socket()
* the result of the operation. * to get the result of the operation.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_listener_accept_async (GSocketListener *listener, g_socket_listener_accept_async (GSocketListener *listener,
GCancellable *cancellable, GCancellable *cancellable,
@ -732,12 +732,12 @@ g_socket_listener_accept_async (GSocketListener *listener,
* Returns: a #GSocketConnection on success, %NULL on error. * Returns: a #GSocketConnection on success, %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketConnection * GSocketConnection *
g_socket_listener_accept_finish (GSocketListener *listener, g_socket_listener_accept_finish (GSocketListener *listener,
GAsyncResult *result, GAsyncResult *result,
GObject **source_object, GObject **source_object,
GError **error) GError **error)
{ {
GSocket *socket; GSocket *socket;
GSocketConnection *connection; GSocketConnection *connection;
@ -764,10 +764,10 @@ g_socket_listener_accept_finish (GSocketListener *listener,
* See g_socket_set_listen_backlog() for details * See g_socket_set_listen_backlog() for details
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_listener_set_backlog (GSocketListener *listener, g_socket_listener_set_backlog (GSocketListener *listener,
int listen_backlog) int listen_backlog)
{ {
GSocket *socket; GSocket *socket;
int i; int i;
@ -791,7 +791,7 @@ g_socket_listener_set_backlog (GSocketListener *listener,
* Closes all the sockets in the listener. * Closes all the sockets in the listener.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_listener_close (GSocketListener *listener) g_socket_listener_close (GSocketListener *listener)
{ {

View File

@ -30,27 +30,28 @@
* *
* A #GSocketService is an object that represents a service that is * A #GSocketService is an object that represents a service that is
* provided to the network or over local sockets. When a new * 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 * A #GSocketService is a subclass of #GSocketListener and you need
* to add the addresses you want to accept connections on to the * to add the addresses you want to accept connections on to the
* with the #GSocketListener APIs. * with the #GSocketListener APIs.
* *
* There are two options for implementing a network service based on * There are two options for implementing a network service based on
* #GSocketService. The first is to create the service using * #GSocketService. The first is to create the service using
* g_socket_service_new() and to connect to the ::incoming signal. * g_socket_service_new() and to connect to the #GSocketService:incoming
* The second is to subclass #GSocketService and override the default * signal. The second is to subclass #GSocketService and override the
* signal handler implementation. * default signal handler implementation.
* *
* In either case, the handler must immediately return, or else it * In either case, the handler must immediately return, or else it
* will block additional incoming connections from being serviced. If * will block additional incoming connections from being serviced.
* you are interested in writing connection handlers that contain * If you are interested in writing connection handlers that contain
* blocking code then see #GThreadedSocketService. * blocking code then see #GThreadedSocketService.
* *
* The socket service runs on the main loop in the main thread, and is * 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 * not threadsafe in general. However, the calls to start and stop
* the service are threadsafe so these can be used from threads that * the service are threadsafe so these can be used from threads that
* handle incomming clients. * handle incoming clients.
* *
* Since: 2.22 * Since: 2.22
*/ */
@ -154,7 +155,7 @@ g_socket_service_changed (GSocketListener *listener)
* Returns: %TRUE if the service is active, %FALSE otherwise * Returns: %TRUE if the service is active, %FALSE otherwise
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_socket_service_is_active (GSocketService *service) g_socket_service_is_active (GSocketService *service)
{ {
@ -177,7 +178,7 @@ g_socket_service_is_active (GSocketService *service)
* handling an incomming client request. * handling an incomming client request.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_service_start (GSocketService *service) g_socket_service_start (GSocketService *service)
{ {
@ -207,9 +208,9 @@ g_socket_service_start (GSocketService *service)
* handling an incomming client request. * handling an incomming client request.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_socket_service_stop (GSocketService *service) g_socket_service_stop (GSocketService *service)
{ {
G_LOCK (active); G_LOCK (active);
@ -257,12 +258,14 @@ g_socket_service_class_init (GSocketServiceClass *class)
* @returns: %TRUE if @connection has been handled. * @returns: %TRUE if @connection has been handled.
* *
* The ::incoming signal is emitted when a new incoming connection * 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, * handling of @connection, but may not block; in essence,
* asynchronous operations must be used. * 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_socket_service_incoming_signal =
g_signal_new ("incoming", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, g_signal_new ("incoming", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GSocketServiceClass, incoming), G_STRUCT_OFFSET (GSocketServiceClass, incoming),
@ -318,7 +321,7 @@ g_socket_service_ready (GObject *object,
* Returns: a new #GSocketService. * Returns: a new #GSocketService.
* *
* Since: 2.22 * Since: 2.22
**/ */
GSocketService * GSocketService *
g_socket_service_new (void) g_socket_service_new (void)
{ {

View File

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

View File

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

View File

@ -25,7 +25,7 @@
* Eventually, some TCP-specific socket stuff will be added. * Eventually, some TCP-specific socket stuff will be added.
* *
* Since: 2.22 * Since: 2.22
**/ */
#include "config.h" #include "config.h"
#include "gtcpconnection.h" #include "gtcpconnection.h"
@ -149,9 +149,9 @@ g_tcp_connection_class_init (GTcpConnectionClass *class)
} }
static gboolean static gboolean
g_tcp_connection_close (GIOStream *stream, g_tcp_connection_close (GIOStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GTcpConnection *connection = G_TCP_CONNECTION (stream); GTcpConnection *connection = G_TCP_CONNECTION (stream);
GSocket *socket; GSocket *socket;
@ -223,7 +223,9 @@ close_async_data_free (CloseAsyncData *data)
} }
static void 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); GIOStreamClass *parent = G_IO_STREAM_CLASS (g_tcp_connection_parent_class);
GIOStream *stream; GIOStream *stream;
@ -255,8 +257,8 @@ async_close_finish (CloseAsyncData *data, GError *error, gboolean in_mainloop)
} }
static gboolean static gboolean
close_read_ready (GSocket *socket, close_read_ready (GSocket *socket,
GIOCondition condition, GIOCondition condition,
CloseAsyncData *data) CloseAsyncData *data)
{ {
GError *error = NULL; GError *error = NULL;
@ -295,11 +297,11 @@ close_read_ready (GSocket *socket,
static void static void
g_tcp_connection_close_async (GIOStream *stream, g_tcp_connection_close_async (GIOStream *stream,
int io_priority, int io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GTcpConnection *connection = G_TCP_CONNECTION (stream); GTcpConnection *connection = G_TCP_CONNECTION (stream);
CloseAsyncData *data; CloseAsyncData *data;
@ -363,7 +365,7 @@ g_tcp_connection_close_async (GIOStream *stream,
* take a while. For this reason it is disabled by default. * take a while. For this reason it is disabled by default.
* *
* Since: 2.22 * Since: 2.22
**/ */
void void
g_tcp_connection_set_graceful_disconnect (GTcpConnection *connection, g_tcp_connection_set_graceful_disconnect (GTcpConnection *connection,
gboolean graceful_disconnect) 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 * Returns: %TRUE if graceful disconnect is used on close, %FALSE otherwise
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_tcp_connection_get_graceful_disconnect (GTcpConnection *connection) g_tcp_connection_get_graceful_disconnect (GTcpConnection *connection)
{ {

View File

@ -41,8 +41,8 @@
* The service automatically stops the #GSocketService from accepting * The service automatically stops the #GSocketService from accepting
* new connections when all threads are busy. * new connections when all threads are busy.
* *
* As with #GSocketService, you may connect to ::run, or subclass and * As with #GSocketService, you may connect to #GThreadedSocketService:run,
* override the default handler. * or subclass and override the default handler.
*/ */
#include "config.h" #include "config.h"
@ -229,15 +229,14 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
* @service: the #GThreadedSocketService. * @service: the #GThreadedSocketService.
* @connection: a new #GSocketConnection object. * @connection: a new #GSocketConnection object.
* @source_object: the source_object passed to g_socket_listener_add_address(). * @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 * The ::run signal is emitted in a worker thread in response to an
* incoming connection. This thread is dedicated to handling * incoming connection. This thread is dedicated to handling
* @connection and may perform blocking IO. The signal handler need * @connection and may perform blocking IO. The signal handler need
* not return until the connection is closed. * 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_threaded_socket_service_run_signal =
g_signal_new ("run", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, g_signal_new ("run", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GThreadedSocketServiceClass, run), G_STRUCT_OFFSET (GThreadedSocketServiceClass, run),
@ -257,13 +256,16 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
/** /**
* g_threaded_socket_service_new: * g_threaded_socket_service_new:
* @returns: a new #GSocketService.
* @max_threads: the maximal number of threads to execute concurrently * @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(). * must be added with g_socket_service_add_listeners().
**/ *
* Returns: a new #GSocketService.
*
* Since: 2.22
*/
GSocketService * GSocketService *
g_threaded_socket_service_new (int max_threads) g_threaded_socket_service_new (int max_threads)
{ {

View File

@ -29,7 +29,7 @@
* functionallity like passing file descriptors. * functionallity like passing file descriptors.
* *
* Since: 2.22 * Since: 2.22
**/ */
#include <gio/gsocketcontrolmessage.h> #include <gio/gsocketcontrolmessage.h>
#include <gio/gunixfdmessage.h> #include <gio/gunixfdmessage.h>
@ -48,7 +48,7 @@ G_DEFINE_TYPE_WITH_CODE (GUnixConnection, g_unix_connection,
/** /**
* g_unix_connection_send_fd: * g_unix_connection_send_fd:
* @connection: a #GUnixConnection. * @connection: a #GUnixConnection
* @fd: a file descriptor * @fd: a file descriptor
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting, or %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. * Returns: a %TRUE on success, %NULL on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
gboolean gboolean
g_unix_connection_send_fd (GUnixConnection *connection, g_unix_connection_send_fd (GUnixConnection *connection,
gint fd, gint fd,
@ -104,13 +104,13 @@ g_unix_connection_send_fd (GUnixConnection *connection,
/** /**
* g_unix_connection_receive_fd: * g_unix_connection_receive_fd:
* @connection: a #GUnixConnection. * @connection: a #GUnixConnection
* @cancellable: optional #GCancellable object, %NULL to ignore. * @cancellable: optional #GCancellable object, %NULL to ignore
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore
* *
* Recieves a file descriptor from the sending end of the * Receives a file descriptor from the sending end of the connection.
* connection. The sending end has to call g_unix_connection_send_fd() * The sending end has to call g_unix_connection_send_fd() for this
* for this to work. * to work.
* *
* As well as reading the fd this also reads a single byte from the * 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 * 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. * Returns: a file descriptor on success, -1 on error.
* *
* Since: 2.22 * Since: 2.22
**/ */
gint gint
g_unix_connection_receive_fd (GUnixConnection *connection, g_unix_connection_receive_fd (GUnixConnection *connection,
GCancellable *cancellable, GCancellable *cancellable,

View File

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

View File

@ -27,7 +27,7 @@
* For an easier way to send and receive file descriptors over * For an easier way to send and receive file descriptors over
* stream-oriented UNIX sockets, see g_unix_connection_send_fd() and * stream-oriented UNIX sockets, see g_unix_connection_send_fd() and
* g_unix_connection_receive_fd(). * g_unix_connection_receive_fd().
**/ */
#include "config.h" #include "config.h"
@ -72,9 +72,9 @@ g_unix_fd_message_get_msg_type (GSocketControlMessage *message)
} }
static GSocketControlMessage * static GSocketControlMessage *
g_unix_fd_message_deserialize (int level, g_unix_fd_message_deserialize (int level,
int type, int type,
gsize size, gsize size,
gpointer data) gpointer data)
{ {
GUnixFDMessage *message; GUnixFDMessage *message;
@ -145,10 +145,13 @@ g_unix_fd_message_class_init (GUnixFDMessageClass *class)
/** /**
* g_unix_fd_message_new: * g_unix_fd_message_new:
* @returns: a new #GUnixFDMessage
* *
* Creates a new #GUnixFDMessage containing no file descriptors. * Creates a new #GUnixFDMessage containing no file descriptors.
**/ *
* Returns: a new #GUnixFDMessage
*
* Since: 2.22
*/
GSocketControlMessage * GSocketControlMessage *
g_unix_fd_message_new (void) g_unix_fd_message_new (void)
{ {
@ -159,13 +162,12 @@ g_unix_fd_message_new (void)
* g_unix_fd_message_steal_fds: * g_unix_fd_message_steal_fds:
* @message: a #GUnixFDMessage * @message: a #GUnixFDMessage
* @length: pointer to the length of the returned array, or %NULL * @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 * Returns the array of file descriptors that is contained in this
* object. * object.
* *
* After this call, the descriptors are no longer contained in * 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). * descriptors have been added).
* *
* The return result of this function must be freed with g_free(). * The return result of this function must be freed with g_free().
@ -173,15 +175,19 @@ g_unix_fd_message_new (void)
* descriptors. * descriptors.
* *
* If @length is non-%NULL then it is set to the number of file * 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. * 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. * descriptors contained in @message, an empty array is returned.
**/ *
* Returns: an array of file descriptors
*
* Since: 2.22
*/
gint * gint *
g_unix_fd_message_steal_fds (GUnixFDMessage *message, g_unix_fd_message_steal_fds (GUnixFDMessage *message,
gint *length) gint *length)
{ {
gint *result; gint *result;
@ -210,21 +216,24 @@ g_unix_fd_message_steal_fds (GUnixFDMessage *message,
* @message: a #GUnixFDMessage * @message: a #GUnixFDMessage
* @fd: a valid open file descriptor * @fd: a valid open file descriptor
* @error: a #GError pointer * @error: a #GError pointer
* @returns: %TRUE in case of success, else %FALSE (and @error is set)
* *
* Adds a file descriptor to @message. * 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 * of the descriptor and the copy contained in @message will be closed
* when @message is finalized. * when @message is finalized.
* *
* A possible cause of failure is exceeding the per-process or * A possible cause of failure is exceeding the per-process or
* system-wide file descriptor limit. * system-wide file descriptor limit.
**/ *
* Returns: %TRUE in case of success, else %FALSE (and @error is set)
*
* Since: 2.22
*/
gboolean gboolean
g_unix_fd_message_append_fd (GUnixFDMessage *message, g_unix_fd_message_append_fd (GUnixFDMessage *message,
gint fd, gint fd,
GError **error) GError **error)
{ {
gint new_fd; gint new_fd;

View File

@ -63,10 +63,10 @@ struct _GUnixFDMessage
GType g_unix_fd_message_get_type (void) G_GNUC_CONST; GType g_unix_fd_message_get_type (void) G_GNUC_CONST;
GSocketControlMessage * g_unix_fd_message_new (void); GSocketControlMessage * g_unix_fd_message_new (void);
gint * g_unix_fd_message_steal_fds (GUnixFDMessage *message, gint * g_unix_fd_message_steal_fds (GUnixFDMessage *message,
gint *length); gint *length);
gboolean g_unix_fd_message_append_fd (GUnixFDMessage *message, gboolean g_unix_fd_message_append_fd (GUnixFDMessage *message,
gint fd, gint fd,
GError **error); GError **error);
G_END_DECLS G_END_DECLS

View File

@ -38,14 +38,14 @@
* @short_description: Unix #GSocketAddress * @short_description: Unix #GSocketAddress
* *
* Support for UNIX-domain (aka local) sockets. * Support for UNIX-domain (aka local) sockets.
**/ */
/** /**
* GUnixSocketAddress: * GUnixSocketAddress:
* *
* A UNIX-domain (local) socket address, corresponding to a * A UNIX-domain (local) socket address, corresponding to a
* <type>struct sockaddr_un</type>. * <type>struct sockaddr_un</type>.
**/ */
G_DEFINE_TYPE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS); G_DEFINE_TYPE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS);
enum enum