mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
Documentation and coding style fixups
Lots of pedanic changes.
This commit is contained in:
parent
eecbbb0a20
commit
06144900ec
@ -861,15 +861,15 @@ GUnixOutputStreamPrivate
|
||||
<FILE>giostream</FILE>
|
||||
<TITLE>GIOStream</TITLE>
|
||||
GIOStream
|
||||
g_io_stream_clear_pending
|
||||
g_io_stream_get_input_stream
|
||||
g_io_stream_get_output_stream
|
||||
g_io_stream_close
|
||||
g_io_stream_close_async
|
||||
g_io_stream_close_finish
|
||||
g_io_stream_get_input_stream
|
||||
g_io_stream_get_output_stream
|
||||
g_io_stream_has_pending
|
||||
g_io_stream_is_closed
|
||||
g_io_stream_has_pending
|
||||
g_io_stream_set_pending
|
||||
g_io_stream_clear_pending
|
||||
<SUBSECTION Standard>
|
||||
GIOStreamClass
|
||||
G_IO_STREAM
|
||||
@ -1419,15 +1419,15 @@ g_inet_address_get_native_size
|
||||
g_inet_address_to_string
|
||||
g_inet_address_get_family
|
||||
g_inet_address_get_is_any
|
||||
g_inet_address_get_is_link_local
|
||||
g_inet_address_get_is_loopback
|
||||
g_inet_address_get_is_mc_global
|
||||
g_inet_address_get_is_link_local
|
||||
g_inet_address_get_is_site_local
|
||||
g_inet_address_get_is_multicast
|
||||
g_inet_address_get_is_mc_link_local
|
||||
g_inet_address_get_is_mc_node_local
|
||||
g_inet_address_get_is_mc_org_local
|
||||
g_inet_address_get_is_mc_site_local
|
||||
g_inet_address_get_is_multicast
|
||||
g_inet_address_get_is_site_local
|
||||
g_inet_address_get_is_mc_org_local
|
||||
g_inet_address_get_is_mc_global
|
||||
<SUBSECTION Standard>
|
||||
GInetAddressClass
|
||||
GInetAddressPrivate
|
||||
|
@ -79,6 +79,7 @@ g_socket_msg_flags_get_type
|
||||
g_socket_protocol_get_type
|
||||
g_socket_service_get_type
|
||||
g_socket_type_get_type
|
||||
g_srv_target_get_type
|
||||
g_tcp_connection_get_type
|
||||
g_themed_icon_get_type
|
||||
g_threaded_socket_service_get_type
|
||||
|
@ -38,16 +38,15 @@
|
||||
* in all ways except that initialization is asynchronous. For more details
|
||||
* see the descriptions on #GInitable.
|
||||
*
|
||||
* A class may implement both the #GInitable and #GAsyncInitable interfaces
|
||||
* or both.
|
||||
* A class may implement both the #GInitable and #GAsyncInitable interfaces.
|
||||
*
|
||||
* Users of objects implementing this are not intended to use
|
||||
* the interface method directly, instead it will be used automatically
|
||||
* in various ways. For C applications you generally just call
|
||||
* g_async_initable_new() directly, or indirectly via a foo_thing_new_async() wrapper.
|
||||
* This will call g_async_initable_init() under the cover, calling back with %NULL and
|
||||
* Users of objects implementing this are not intended to use the interface
|
||||
* method directly, instead it will be used automatically in various ways.
|
||||
* For C applications you generally just call g_async_initable_new() directly,
|
||||
* or indirectly via a foo_thing_new_async() wrapper. This will call
|
||||
* g_async_initable_init() under the cover, calling back with %NULL and
|
||||
* a set %GError on failure.
|
||||
**/
|
||||
*/
|
||||
|
||||
static void g_async_initable_base_init (gpointer g_iface);
|
||||
static void g_async_initable_real_init_async (GAsyncInitable *initable,
|
||||
@ -108,17 +107,18 @@ g_async_initable_base_init (gpointer g_iface)
|
||||
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
|
||||
* @user_data: the data to pass to callback function
|
||||
*
|
||||
* Starts asynchronous initialization of the object implementing the interface.
|
||||
* This must be done before any real use of the object after initial construction.
|
||||
* If the object also implements #GInitable you can optionally call g_initable_init()
|
||||
* instead.
|
||||
* Starts asynchronous initialization of the object implementing the
|
||||
* interface. This must be done before any real use of the object after
|
||||
* initial construction. If the object also implements #GInitable you can
|
||||
* optionally call g_initable_init() instead.
|
||||
*
|
||||
* When the initialization is finished, @callback will be called. You can then call
|
||||
* g_async_initable_init_finish() to get the result of the initialization.
|
||||
* When the initialization is finished, @callback will be called. You can
|
||||
* then call g_async_initable_init_finish() to get the result of the
|
||||
* initialization.
|
||||
*
|
||||
* Implementations may also support cancellation. If @cancellable is not %NULL,
|
||||
* then initialization can be cancelled by triggering the cancellable object
|
||||
* from another thread. If the operation was cancelled, the error
|
||||
* Implementations may also support cancellation. If @cancellable is not
|
||||
* %NULL, then initialization can be cancelled by triggering the cancellable
|
||||
* object from another thread. If the operation was cancelled, the error
|
||||
* %G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL and
|
||||
* the object doesn't support cancellable initialization the error
|
||||
* %G_IO_ERROR_NOT_SUPPORTED will be returned.
|
||||
@ -140,7 +140,7 @@ g_async_initable_base_init (gpointer g_iface)
|
||||
* any interface methods.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_async_initable_init_async (GAsyncInitable *initable,
|
||||
int io_priority,
|
||||
@ -167,12 +167,11 @@ g_async_initable_init_async (GAsyncInitable *initable,
|
||||
* Finishes asynchronous initialization and returns the result.
|
||||
* See g_async_initable_init_async().
|
||||
*
|
||||
* Returns: %TRUE if successful. If an error
|
||||
* has occurred, this function will return %FALSE and set @error
|
||||
* appropriately if present.
|
||||
* Returns: %TRUE if successful. If an error has occurred, this function
|
||||
* will return %FALSE and set @error appropriately if present.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_async_initable_init_finish (GAsyncInitable *initable,
|
||||
GAsyncResult *res,
|
||||
@ -241,20 +240,23 @@ g_async_initable_real_init_finish (GAsyncInitable *initable,
|
||||
* @io_priority: the <link linkend="io-priority">I/O priority</link>
|
||||
* of the operation.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
* @callback: a #GAsyncReadyCallback to call when the initialization is finished
|
||||
* @callback: a #GAsyncReadyCallback to call when the initialization is
|
||||
* finished
|
||||
* @user_data: the data to pass to callback function
|
||||
* @first_property_name: the name of the first property, or %NULL if no properties
|
||||
* @first_property_name: the name of the first property, or %NULL if no
|
||||
* properties
|
||||
* @...: the value if the first property, followed by and other property
|
||||
* value pairs, and ended by %NULL.
|
||||
*
|
||||
* Helper function for constructing #GAsyncInitiable object. This is
|
||||
* similar to g_object_new() but also initializes the object asyncronously.
|
||||
*
|
||||
* When the initialization is finished, @callback will be called. You can then call
|
||||
* g_async_initable_new_finish() to get new object and check for any errors.
|
||||
* When the initialization is finished, @callback will be called. You can
|
||||
* then call g_async_initable_new_finish() to get new object and check for
|
||||
* any errors.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_async_initable_new_async (GType object_type,
|
||||
int io_priority,
|
||||
@ -282,17 +284,19 @@ g_async_initable_new_async (GType object_type,
|
||||
* @io_priority: the <link linkend="io-priority">I/O priority</link>
|
||||
* of the operation.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
* @callback: a #GAsyncReadyCallback to call when the initialization is finished
|
||||
* @callback: a #GAsyncReadyCallback to call when the initialization is
|
||||
* finished
|
||||
* @user_data: the data to pass to callback function
|
||||
*
|
||||
* Helper function for constructing #GAsyncInitiable object. This is
|
||||
* similar to g_object_newv() but also initializes the object asyncronously.
|
||||
*
|
||||
* When the initialization is finished, @callback will be called. You can then call
|
||||
* g_async_initable_new_finish() to get new object and check for any errors.
|
||||
* When the initialization is finished, @callback will be called. You can
|
||||
* then call g_async_initable_new_finish() to get new object and check for
|
||||
* any errors.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_async_initable_newv_async (GType object_type,
|
||||
guint n_parameters,
|
||||
@ -322,17 +326,20 @@ g_async_initable_newv_async (GType object_type,
|
||||
* @io_priority: the <link linkend="io-priority">I/O priority</link>
|
||||
* of the operation.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
* @callback: a #GAsyncReadyCallback to call when the initialization is finished
|
||||
* @callback: a #GAsyncReadyCallback to call when the initialization is
|
||||
* finished
|
||||
* @user_data: the data to pass to callback function
|
||||
*
|
||||
* Helper function for constructing #GAsyncInitiable object. This is
|
||||
* similar to g_object_new_valist() but also initializes the object asyncronously.
|
||||
* similar to g_object_new_valist() but also initializes the object
|
||||
* asyncronously.
|
||||
*
|
||||
* When the initialization is finished, @callback will be called. You can then call
|
||||
* g_async_initable_new_finish() to get new object and check for any errors.
|
||||
* When the initialization is finished, @callback will be called. You can
|
||||
* then call g_async_initable_new_finish() to get new object and check for
|
||||
* any errors.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_async_initable_new_valist_async (GType object_type,
|
||||
const gchar *first_property_name,
|
||||
@ -355,6 +362,7 @@ g_async_initable_new_valist_async (GType object_type,
|
||||
callback, user_data);
|
||||
g_object_unref (obj); /* Passed ownership to async call */
|
||||
}
|
||||
|
||||
/**
|
||||
* g_async_initable_new_finish:
|
||||
* @initable: the #GAsyncInitable from the callback
|
||||
@ -365,10 +373,11 @@ g_async_initable_new_valist_async (GType object_type,
|
||||
* Finishes the async construction for the various g_async_initable_new calls,
|
||||
* returning the created object or %NULL on error.
|
||||
*
|
||||
* Returns: a newly created #GObject, or %NULL on error. Free with g_object_unref().
|
||||
* Returns: a newly created #GObject, or %NULL on error. Free with
|
||||
* g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GObject *
|
||||
g_async_initable_new_finish (GAsyncInitable *initable,
|
||||
GAsyncResult *res,
|
||||
|
91
gio/gfile.c
91
gio/gfile.c
@ -1717,10 +1717,10 @@ g_file_open_readwrite (GFile *file,
|
||||
|
||||
/**
|
||||
* g_file_create_readwrite:
|
||||
* @file: input #GFile.
|
||||
* @flags: a set of #GFileCreateFlags.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
* @error: a #GError, or %NULL
|
||||
* @file: a #GFile
|
||||
* @flags: a set of #GFileCreateFlags
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore
|
||||
* @error: return location for a #GError, or %NULL
|
||||
*
|
||||
* Creates a new file and returns a stream for reading and writing to it.
|
||||
* The file must not already exist.
|
||||
@ -1734,24 +1734,21 @@ g_file_open_readwrite (GFile *file,
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
|
||||
*
|
||||
* If a file or directory with this name already exists the G_IO_ERROR_EXISTS
|
||||
* error will be returned.
|
||||
* Some file systems don't allow all file names, and may
|
||||
* return an G_IO_ERROR_INVALID_FILENAME error, and if the name
|
||||
* is to long G_IO_ERROR_FILENAME_TOO_LONG will be returned.
|
||||
* Other errors are possible too, and depend on what kind of
|
||||
* filesystem the file is on.
|
||||
* If a file or directory with this name already exists the %G_IO_ERROR_EXISTS
|
||||
* error will be returned. Some file systems don't allow all file names,
|
||||
* and may return an %G_IO_ERROR_INVALID_FILENAME error, and if the name
|
||||
* is too long, %G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors
|
||||
* are possible too, and depend on what kind of filesystem the file is on.
|
||||
*
|
||||
* Note that in many non-local file cases read and write streams are not supported,
|
||||
* so make sure you really need to do read and write streaming, rather than
|
||||
* just opening for reading or writing.
|
||||
* Note that in many non-local file cases read and write streams are not
|
||||
* supported, so make sure you really need to do read and write streaming,
|
||||
* rather than just opening for reading or writing.
|
||||
*
|
||||
* Returns: a #GFileIOStream for the newly created file, or
|
||||
* %NULL on error.
|
||||
* Returns: a #GFileIOStream for the newly created file, or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GFileIOStream *
|
||||
g_file_create_readwrite (GFile *file,
|
||||
GFileCreateFlags flags,
|
||||
@ -1780,30 +1777,30 @@ g_file_create_readwrite (GFile *file,
|
||||
|
||||
/**
|
||||
* g_file_replace_readwrite:
|
||||
* @file: input #GFile.
|
||||
* @file: a #GFile
|
||||
* @etag: an optional <link linkend="gfile-etag">entity tag</link> for the
|
||||
* current #GFile, or #NULL to ignore.
|
||||
* @make_backup: %TRUE if a backup should be created.
|
||||
* @flags: a set of #GFileCreateFlags.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
* @error: a #GError, or %NULL
|
||||
* current #GFile, or #NULL to ignore
|
||||
* @make_backup: %TRUE if a backup should be created
|
||||
* @flags: a set of #GFileCreateFlags
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore
|
||||
* @error: return location for a #GError, or %NULL
|
||||
*
|
||||
* Returns an output stream for overwriting the file in readwrite mode,
|
||||
* possibly creating a backup copy of the file first. If the file doesn't exist,
|
||||
* it will be created.
|
||||
* possibly creating a backup copy of the file first. If the file doesn't
|
||||
* exist, it will be created.
|
||||
*
|
||||
* For details about the behaviour, see g_file_replace() which does the same
|
||||
* thing but returns an output stream only.
|
||||
*
|
||||
* Note that in many non-local file cases read and write streams are not supported,
|
||||
* so make sure you really need to do read and write streaming, rather than
|
||||
* just opening for reading or writing.
|
||||
* Note that in many non-local file cases read and write streams are not
|
||||
* supported, so make sure you really need to do read and write streaming,
|
||||
* rather than just opening for reading or writing.
|
||||
*
|
||||
* Returns: a #GFileIOStream or %NULL on error.
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GFileIOStream *
|
||||
g_file_replace_readwrite (GFile *file,
|
||||
const char *etag,
|
||||
@ -1834,7 +1831,7 @@ g_file_replace_readwrite (GFile *file,
|
||||
|
||||
/**
|
||||
* g_file_read_async:
|
||||
* @file: input #GFile.
|
||||
* @file: input #GFile
|
||||
* @io_priority: the <link linkend="io-priority">I/O priority</link>
|
||||
* of the request.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
@ -2203,25 +2200,25 @@ g_file_open_readwrite_finish (GFile *file,
|
||||
|
||||
/**
|
||||
* g_file_create_readwrite_async:
|
||||
* @file: input #GFile.
|
||||
* @flags: a set of #GFileCreateFlags.
|
||||
* @file: input #GFile
|
||||
* @flags: a set of #GFileCreateFlags
|
||||
* @io_priority: the <link linkend="io-priority">I/O priority</link>
|
||||
* of the request.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
* of the request
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore
|
||||
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
|
||||
* @user_data: the data to pass to callback function
|
||||
*
|
||||
* Asynchronously creates a new file and returns a stream for reading and writing
|
||||
* to it. The file must not already exist.
|
||||
* Asynchronously creates a new file and returns a stream for reading and
|
||||
* writing to it. The file must not already exist.
|
||||
*
|
||||
* For more details, see g_file_create_readwrite() which is
|
||||
* the synchronous version of this call.
|
||||
*
|
||||
* When the operation is finished, @callback will be called. You can then call
|
||||
* g_file_create_readwrite_finish() to get the result of the operation.
|
||||
* When the operation is finished, @callback will be called. You can then
|
||||
* call g_file_create_readwrite_finish() to get the result of the operation.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_file_create_readwrite_async (GFile *file,
|
||||
GFileCreateFlags flags,
|
||||
@ -2245,8 +2242,8 @@ g_file_create_readwrite_async (GFile *file,
|
||||
|
||||
/**
|
||||
* g_file_create_readwrite_finish:
|
||||
* @file: input #GFile.
|
||||
* @res: a #GAsyncResult.
|
||||
* @file: input #GFile
|
||||
* @res: a #GAsyncResult
|
||||
* @error: a #GError, or %NULL
|
||||
*
|
||||
* Finishes an asynchronous file create operation started with
|
||||
@ -2291,17 +2288,17 @@ g_file_create_readwrite_finish (GFile *file,
|
||||
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
|
||||
* @user_data: the data to pass to callback function
|
||||
*
|
||||
* Asynchronously overwrites the file in read-write mode, replacing the contents,
|
||||
* possibly creating a backup copy of the file first.
|
||||
* Asynchronously overwrites the file in read-write mode, replacing the
|
||||
* contents, possibly creating a backup copy of the file first.
|
||||
*
|
||||
* For more details, see g_file_replace_readwrite() which is
|
||||
* the synchronous version of this call.
|
||||
*
|
||||
* When the operation is finished, @callback will be called. You can then call
|
||||
* g_file_replace_readwrite_finish() to get the result of the operation.
|
||||
* When the operation is finished, @callback will be called. You can then
|
||||
* call g_file_replace_readwrite_finish() to get the result of the operation.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_file_replace_readwrite_async (GFile *file,
|
||||
const char *etag,
|
||||
@ -2340,7 +2337,7 @@ g_file_replace_readwrite_async (GFile *file,
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GFileIOStream *
|
||||
g_file_replace_readwrite_finish (GFile *file,
|
||||
GAsyncResult *res,
|
||||
|
@ -49,13 +49,13 @@
|
||||
* To actually connect to a remote host, you will need a
|
||||
* #GInetSocketAddress (which includes a #GInetAddress as well as a
|
||||
* port number).
|
||||
**/
|
||||
*/
|
||||
|
||||
/**
|
||||
* GInetAddress:
|
||||
*
|
||||
* An IPv4 or IPv6 internet address.
|
||||
**/
|
||||
*/
|
||||
|
||||
/* Networking initialization function, called from inside the g_once of
|
||||
* g_inet_address_get_type()
|
||||
@ -206,83 +206,178 @@ g_inet_address_class_init (GInetAddressClass *klass)
|
||||
P_("The address family (IPv4 or IPv6)"),
|
||||
G_TYPE_SOCKET_FAMILY,
|
||||
G_SOCKET_FAMILY_INVALID,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_BYTES,
|
||||
g_param_spec_pointer ("bytes",
|
||||
P_("Bytes"),
|
||||
P_("The raw address data"),
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GInetAddress:is-any:
|
||||
*
|
||||
* Whether this is the "any" address for its family.
|
||||
* See g_inet_address_get_is_any().
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_IS_ANY,
|
||||
g_param_spec_boolean ("is-any",
|
||||
P_("Is any"),
|
||||
P_("See g_inet_address_get_is_any()"),
|
||||
P_("Whether this is the \"any\" address for its family"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GInetAddress:is-link-local:
|
||||
*
|
||||
* Whether this is a link-local address.
|
||||
* See g_inet_address_get_is_link_local().
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_IS_LINK_LOCAL,
|
||||
g_param_spec_boolean ("is-link-local",
|
||||
P_("Is link-local"),
|
||||
P_("See g_inet_address_get_is_link_local()"),
|
||||
P_("Whether this is a link-local address"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GInetAddress:is-loopback:
|
||||
*
|
||||
* Whether this is the loopback address for its family.
|
||||
* See g_inet_address_get_is_loopback().
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_IS_LOOPBACK,
|
||||
g_param_spec_boolean ("is-loopback",
|
||||
P_("Is loopback"),
|
||||
P_("See g_inet_address_get_is_loopback()"),
|
||||
P_("Whether this is the loopback address for its family"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GInetAddress:is-site-local:
|
||||
*
|
||||
* Whether this is a site-local address.
|
||||
* See g_inet_address_get_is_loopback().
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_IS_SITE_LOCAL,
|
||||
g_param_spec_boolean ("is-site-local",
|
||||
P_("Is site-local"),
|
||||
P_("See g_inet_address_get_is_site_local()"),
|
||||
P_("Whether this is a site-local address"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GInetAddress:is-multicast:
|
||||
*
|
||||
* Whether this is a multicast address.
|
||||
* See g_inet_address_get_is_multicast().
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_IS_MULTICAST,
|
||||
g_param_spec_boolean ("is-multicast",
|
||||
P_("Is multicast"),
|
||||
P_("See g_inet_address_get_is_multicast()"),
|
||||
P_("Whether this is a multicast address"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GInetAddress:is-mc-global:
|
||||
*
|
||||
* Whether this is a global multicast address.
|
||||
* See g_inet_address_get_is_mc_global().
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_IS_MC_GLOBAL,
|
||||
g_param_spec_boolean ("is-mc-global",
|
||||
P_("Is multicast global"),
|
||||
P_("See g_inet_address_get_is_mc_global()"),
|
||||
P_("Whether this is a global multicast address"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
|
||||
/**
|
||||
* GInetAddress:is-mc-link-local:
|
||||
*
|
||||
* Whether this is a link-local multicast address.
|
||||
* See g_inet_address_get_is_mc_link_local().
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_IS_MC_LINK_LOCAL,
|
||||
g_param_spec_boolean ("is-mc-link-local",
|
||||
P_("Is multicast link-local"),
|
||||
P_("See g_inet_address_get_is_mc_link_local()"),
|
||||
P_("Whether this is a link-local multicast address"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GInetAddress:is-mc-node-local:
|
||||
*
|
||||
* Whether this is a node-local multicast address.
|
||||
* See g_inet_address_get_is_mc_node_local().
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_IS_MC_NODE_LOCAL,
|
||||
g_param_spec_boolean ("is-mc-node-local",
|
||||
P_("Is multicast node-local"),
|
||||
P_("See g_inet_address_get_is_mc_node_local()"),
|
||||
P_("Whether this is a node-local multicast address"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GInetAddress:is-mc-org-local:
|
||||
*
|
||||
* Whether this is an organization-local multicast address.
|
||||
* See g_inet_address_get_is_mc_org_local().
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_IS_MC_ORG_LOCAL,
|
||||
g_param_spec_boolean ("is-mc-org-local",
|
||||
P_("Is multicast org-local"),
|
||||
P_("See g_inet_address_get_is_mc_org_local()"),
|
||||
P_("Whether this is an organization-local multicast address"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GInetAddress:is-mc-site-local:
|
||||
*
|
||||
* Whether this is a site-local multicast address.
|
||||
* See g_inet_address_get_is_mc_site_local().
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_IS_MC_SITE_LOCAL,
|
||||
g_param_spec_boolean ("is-mc-site-local",
|
||||
P_("Is multicast site-local"),
|
||||
P_("See g_inet_address_get_is_mc_site_local()"),
|
||||
P_("Whether this is a site-local multicast address"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -39,14 +39,14 @@
|
||||
*
|
||||
* An IPv4 or IPv6 socket address; that is, the combination of a
|
||||
* #GInetAddress and a port number.
|
||||
**/
|
||||
*/
|
||||
|
||||
/**
|
||||
* GInetSocketAddress:
|
||||
*
|
||||
* An IPv4 or IPv6 socket address, corresponding to a <type>struct
|
||||
* sockaddr_in</type> or <type>struct sockaddr_in6</type>.
|
||||
**/
|
||||
*/
|
||||
G_DEFINE_TYPE (GInetSocketAddress, g_inet_socket_address, G_TYPE_SOCKET_ADDRESS);
|
||||
|
||||
enum {
|
||||
@ -233,19 +233,23 @@ g_inet_socket_address_class_init (GInetSocketAddressClass *klass)
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_ADDRESS,
|
||||
g_param_spec_object ("address",
|
||||
"address",
|
||||
"address",
|
||||
P_("Address"),
|
||||
P_("The address"),
|
||||
G_TYPE_INET_ADDRESS,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK));
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_PORT,
|
||||
g_param_spec_uint ("port",
|
||||
"port",
|
||||
"port",
|
||||
P_("Port"),
|
||||
P_("The port"),
|
||||
0,
|
||||
65535,
|
||||
0,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK));
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -50,7 +50,7 @@
|
||||
* exceptions the binding could check for objects implemention %GInitable
|
||||
* during normal construction and automatically initialize them, throwing
|
||||
* an exception on failure.
|
||||
**/
|
||||
*/
|
||||
|
||||
GType
|
||||
g_initable_get_type (void)
|
||||
@ -110,12 +110,11 @@ g_initable_get_type (void)
|
||||
* of the first call. This is so that its safe to implement the singleton
|
||||
* pattern in the GObject constructor function.
|
||||
*
|
||||
* Returns: %TRUE if successful. If an error
|
||||
* has occurred, this function will return %FALSE and set @error
|
||||
* appropriately if present.
|
||||
* Returns: %TRUE if successful. If an error has occurred, this function will
|
||||
* return %FALSE and set @error appropriately if present.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
@ -136,7 +135,8 @@ g_initable_init (GInitable *initable,
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
* @error: a #GError location to store the error occuring, or %NULL to
|
||||
* ignore.
|
||||
* @first_property_name: the name of the first property, or %NULL if no properties
|
||||
* @first_property_name: the name of the first property, or %NULL if no
|
||||
* properties
|
||||
* @...: the value if the first property, followed by and other property
|
||||
* value pairs, and ended by %NULL.
|
||||
*
|
||||
@ -147,7 +147,7 @@ g_initable_init (GInitable *initable,
|
||||
* Return value: a newly allocated #GObject, or %NULL on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gpointer
|
||||
g_initable_new (GType object_type,
|
||||
GCancellable *cancellable,
|
||||
@ -183,7 +183,7 @@ g_initable_new (GType object_type,
|
||||
* Return value: a newly allocated #GObject, or %NULL on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gpointer
|
||||
g_initable_newv (GType object_type,
|
||||
guint n_parameters,
|
||||
@ -223,7 +223,7 @@ g_initable_newv (GType object_type,
|
||||
* Return value: a newly allocated #GObject, or %NULL on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GObject*
|
||||
g_initable_new_valist (GType object_type,
|
||||
const gchar *first_property_name,
|
||||
|
@ -51,7 +51,8 @@ typedef struct _GInitableIface GInitableIface;
|
||||
* @g_iface: The parent interface.
|
||||
* @init: Initializes the object.
|
||||
*
|
||||
* Provides an interface for initializing object such that initialization may fail.
|
||||
* Provides an interface for initializing object such that initialization
|
||||
* may fail.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
|
@ -482,12 +482,16 @@ typedef enum {
|
||||
|
||||
/**
|
||||
* GResolverError:
|
||||
* @G_RESOLVER_ERROR_NOT_FOUND: the requested name/address/service was not found
|
||||
* @G_RESOLVER_ERROR_TEMPORARY_FAILURE: the requested information could not be looked up due to a network error or similar problem
|
||||
* @G_RESOLVER_ERROR_NOT_FOUND: the requested name/address/service was not
|
||||
* found
|
||||
* @G_RESOLVER_ERROR_TEMPORARY_FAILURE: the requested information could not
|
||||
* be looked up due to a network error or similar problem
|
||||
* @G_RESOLVER_ERROR_INTERNAL: unknown error
|
||||
*
|
||||
* An error code used with %G_RESOLVER_ERROR in a #GError returned
|
||||
* from a #GResolver routine.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
typedef enum {
|
||||
G_RESOLVER_ERROR_NOT_FOUND,
|
||||
@ -505,6 +509,8 @@ typedef enum {
|
||||
* The protocol family of a #GSocketAddress. (These values are
|
||||
* identical to the system defines %AF_INET, %AF_INET6 and %AF_UNIX,
|
||||
* if available.)
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
typedef enum {
|
||||
G_SOCKET_FAMILY_INVALID,
|
||||
@ -519,10 +525,13 @@ typedef enum {
|
||||
* GSocketType:
|
||||
* @G_SOCKET_TYPE_INVALID: Type unknown or wrong
|
||||
* @G_SOCKET_TYPE_STREAM: Reliable connection-based byte streams (e.g. TCP).
|
||||
* @G_SOCKET_TYPE_DATAGRAM: Connectionless, unreliable datagram passing. (e.g. UDP)
|
||||
* @G_SOCKET_TYPE_SEQPACKET: Reliable connection-based passing of datagrams of fixed maximum length (e.g. SCTP).
|
||||
* @G_SOCKET_TYPE_DATAGRAM: Connectionless, unreliable datagram passing.
|
||||
* (e.g. UDP)
|
||||
* @G_SOCKET_TYPE_SEQPACKET: Reliable connection-based passing of datagrams
|
||||
* of fixed maximum length (e.g. SCTP).
|
||||
*
|
||||
* Flags used when creating a #GSocket. Some protocols may not implement all the socket types.
|
||||
* Flags used when creating a #GSocket. Some protocols may not implement
|
||||
* all the socket types.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -538,13 +547,16 @@ typedef enum
|
||||
* GSocketMsgFlags:
|
||||
* @G_SOCKET_MSG_NONE: No flags.
|
||||
* @G_SOCKET_MSG_OOB: Request to send/receive out of band data.
|
||||
* @G_SOCKET_MSG_PEEK: Read data from the socket without removing it from the queue.
|
||||
* @G_SOCKET_MSG_DONTROUTE: Don't use a gateway to send out the packet, only send to hosts on directly connected networks.
|
||||
* @G_SOCKET_MSG_PEEK: Read data from the socket without removing it from
|
||||
* the queue.
|
||||
* @G_SOCKET_MSG_DONTROUTE: Don't use a gateway to send out the packet,
|
||||
* only send to hosts on directly connected networks.
|
||||
*
|
||||
* Flags used in g_socket_receive_message() and g_socket_send_message(). The flags listed in the enum are
|
||||
* some commonly available flags, but the values used for them are the same as on the platform, and any other
|
||||
* flags are passed in/out as is. So to use a platform specific flag, just include the right system header and
|
||||
* pass in the flag.
|
||||
* Flags used in g_socket_receive_message() and g_socket_send_message().
|
||||
* The flags listed in the enum are some commonly available flags, but the
|
||||
* values used for them are the same as on the platform, and any other flags
|
||||
* are passed in/out as is. So to use a platform specific flag, just include
|
||||
* the right system header and pass in the flag.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -560,15 +572,17 @@ typedef enum
|
||||
* GSocketProtocol:
|
||||
* @G_SOCKET_PROTOCOL_UNKNOWN: The protocol type is unknown
|
||||
* @G_SOCKET_PROTOCOL_DEFAULT: The default protocol for the family/type
|
||||
* @G_SOCKET_PROTOCOL_TCP: Tcp over IP
|
||||
* @G_SOCKET_PROTOCOL_TCP: TCP over IP
|
||||
* @G_SOCKET_PROTOCOL_UDP: UDP over IP
|
||||
* @G_SOCKET_PROTOCOL_SCTP: SCTP over IP
|
||||
*
|
||||
* A protocol identifier is specified when creating a #GSocket, which is a family/type
|
||||
* specific identifier, where 0 means the default protocol for the particular family/type.
|
||||
* This enum contains a set of commonly availible and used protocols. You can also
|
||||
* pass any other identifiers handled by the platform in order to use protocols not
|
||||
* listed here.
|
||||
* A protocol identifier is specified when creating a #GSocket, which is a
|
||||
* family/type specific identifier, where 0 means the default protocol for
|
||||
* the particular family/type.
|
||||
*
|
||||
* This enum contains a set of commonly available and used protocols. You
|
||||
* can also pass any other identifiers handled by the platform in order to
|
||||
* use protocols not listed here.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
|
@ -66,7 +66,7 @@ G_DEFINE_TYPE (GIOStream, g_io_stream, G_TYPE_OBJECT);
|
||||
* is actually shut down.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
@ -204,14 +204,14 @@ g_io_stream_class_init (GIOStreamClass *klass)
|
||||
|
||||
/**
|
||||
* g_io_stream_is_closed:
|
||||
* @stream: a #GIOStream.
|
||||
* @stream: a #GIOStream
|
||||
*
|
||||
* Checks if a stream is closed.
|
||||
*
|
||||
* Returns: %TRUE if the stream is closed.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_io_stream_is_closed (GIOStream *stream)
|
||||
{
|
||||
@ -222,52 +222,52 @@ g_io_stream_is_closed (GIOStream *stream)
|
||||
|
||||
/**
|
||||
* g_io_stream_get_input_stream:
|
||||
* @stream: input #GIOStream.
|
||||
* @stream: a #GIOStream
|
||||
*
|
||||
* Gets the input stream for this object. This is used
|
||||
* for reading.
|
||||
*
|
||||
* Returns: a #GInputStream, owned by the #GIOStream do not free.
|
||||
* Returns: a #GInputStream, owned by the #GIOStream. Do not free.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GInputStream *
|
||||
g_io_stream_get_input_stream (GIOStream *io_stream)
|
||||
g_io_stream_get_input_stream (GIOStream *stream)
|
||||
{
|
||||
GIOStreamClass *klass;
|
||||
|
||||
klass = G_IO_STREAM_GET_CLASS (io_stream);
|
||||
klass = G_IO_STREAM_GET_CLASS (stream);
|
||||
|
||||
g_assert (klass->get_input_stream != NULL);
|
||||
|
||||
return klass->get_input_stream (io_stream);
|
||||
return klass->get_input_stream (stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_io_stream_get_output_stream:
|
||||
* @stream: input #GIOStream.
|
||||
* @stream: a #GIOStream
|
||||
*
|
||||
* Gets the output stream for this object. This is used for
|
||||
* writing.
|
||||
*
|
||||
* Returns: a #GOutputStream, owned by the #GIOStream do not free.
|
||||
* Returns: a #GOutputStream, owned by the #GIOStream. Do not free.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GOutputStream *
|
||||
g_io_stream_get_output_stream (GIOStream *io_stream)
|
||||
g_io_stream_get_output_stream (GIOStream *stream)
|
||||
{
|
||||
GIOStreamClass *klass;
|
||||
|
||||
klass = G_IO_STREAM_GET_CLASS (io_stream);
|
||||
klass = G_IO_STREAM_GET_CLASS (stream);
|
||||
|
||||
g_assert (klass->get_output_stream != NULL);
|
||||
return klass->get_output_stream (io_stream);
|
||||
return klass->get_output_stream (stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_io_stream_has_pending:
|
||||
* @stream: a #GIOStream.
|
||||
* @stream: a #GIOStream
|
||||
*
|
||||
* Checks if a stream has pending actions.
|
||||
*
|
||||
@ -285,9 +285,9 @@ g_io_stream_has_pending (GIOStream *stream)
|
||||
|
||||
/**
|
||||
* g_io_stream_set_pending:
|
||||
* @stream: a #GIOStream.
|
||||
* @stream: a #GIOStream
|
||||
* @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
|
||||
* already set or @stream is closed, it will return %FALSE and set
|
||||
@ -296,7 +296,7 @@ g_io_stream_has_pending (GIOStream *stream)
|
||||
* Return value: %TRUE if pending was previously unset and is now set.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_io_stream_set_pending (GIOStream *stream,
|
||||
GError **error)
|
||||
@ -326,12 +326,12 @@ g_io_stream_set_pending (GIOStream *stream,
|
||||
|
||||
/**
|
||||
* g_io_stream_clear_pending:
|
||||
* @stream: output stream
|
||||
* @stream: a #GIOStream
|
||||
*
|
||||
* Clears the pending flag on @stream.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_io_stream_clear_pending (GIOStream *stream)
|
||||
{
|
||||
@ -363,33 +363,34 @@ g_io_stream_real_close (GIOStream *stream,
|
||||
|
||||
/**
|
||||
* g_io_stream_close:
|
||||
* @stream: A #GIOStream.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
* @stream: a #GIOStream
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore
|
||||
* @error: location to store the error occuring, or %NULL to ignore
|
||||
*
|
||||
* Closes the stream, releasing resources related to it. This will also
|
||||
* closes the individual input and output streams, if they are not already
|
||||
* closed.
|
||||
*
|
||||
* Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED.
|
||||
* Closing a stream multiple times will not return an error.
|
||||
* Once the stream is closed, all other operations will return
|
||||
* %G_IO_ERROR_CLOSED. Closing a stream multiple times will not
|
||||
* return an error.
|
||||
*
|
||||
* Closing a stream will automatically flush any outstanding buffers in the
|
||||
* stream.
|
||||
* Closing a stream will automatically flush any outstanding buffers
|
||||
* in the stream.
|
||||
*
|
||||
* Streams will be automatically closed when the last reference
|
||||
* is dropped, but you might want to call this function to make sure
|
||||
* resources are released as early as possible.
|
||||
*
|
||||
* Some streams might keep the backing store of the stream (e.g. a file descriptor)
|
||||
* open after the stream is closed. See the documentation for the individual
|
||||
* stream for details.
|
||||
* Some streams might keep the backing store of the stream (e.g. a file
|
||||
* descriptor) open after the stream is closed. See the documentation for
|
||||
* the individual stream for details.
|
||||
*
|
||||
* On failure the first error that happened will be reported, but the close
|
||||
* operation will finish as much as possible. A stream that failed to
|
||||
* close will still return %G_IO_ERROR_CLOSED for all operations. Still, it
|
||||
* is important to check and report the error to the user, otherwise
|
||||
* there might be a loss of data as all data might not be written.
|
||||
* On failure the first error that happened will be reported, but the
|
||||
* close operation will finish as much as possible. A stream that failed
|
||||
* to close will still return %G_IO_ERROR_CLOSED for all operations.
|
||||
* Still, it is important to check and report the error to the user,
|
||||
* otherwise there might be a loss of data as all data might not be written.
|
||||
*
|
||||
* If @cancellable is not NULL, then the operation can be cancelled by
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
@ -403,7 +404,7 @@ g_io_stream_real_close (GIOStream *stream,
|
||||
* Return value: %TRUE on success, %FALSE on failure
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_io_stream_close (GIOStream *stream,
|
||||
GCancellable *cancellable,
|
||||
@ -454,8 +455,8 @@ async_ready_close_callback_wrapper (GObject *source_object,
|
||||
|
||||
/**
|
||||
* g_io_stream_close_async:
|
||||
* @stream: A #GIOStream.
|
||||
* @io_priority: the io priority of the request.
|
||||
* @stream: a #GIOStream
|
||||
* @io_priority: the io priority of the request
|
||||
* @callback: callback to call when the request is satisfied
|
||||
* @user_data: the data to pass to callback function
|
||||
* @cancellable: optional cancellable object
|
||||
@ -467,12 +468,12 @@ async_ready_close_callback_wrapper (GObject *source_object,
|
||||
*
|
||||
* For behaviour details see g_io_stream_close().
|
||||
*
|
||||
* The asyncronous methods have a default fallback that uses threads
|
||||
* The asynchronous methods have a default fallback that uses threads
|
||||
* to implement asynchronicity, so they are optional for inheriting
|
||||
* classes. However, if you override one you must override all.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_io_stream_close_async (GIOStream *stream,
|
||||
int io_priority,
|
||||
@ -516,17 +517,17 @@ g_io_stream_close_async (GIOStream *stream,
|
||||
|
||||
/**
|
||||
* g_io_stream_close_finish:
|
||||
* @stream: a #GIOStream.
|
||||
* @result: a #GAsyncResult.
|
||||
* @stream: a #GIOStream
|
||||
* @result: a #GAsyncResult
|
||||
* @error: a #GError location to store the error occuring, or %NULL to
|
||||
* ignore.
|
||||
* ignore
|
||||
*
|
||||
* Closes a stream.
|
||||
*
|
||||
* Returns: %TRUE if stream was successfully closed, %FALSE otherwise.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_io_stream_close_finish (GIOStream *stream,
|
||||
GAsyncResult *result,
|
||||
@ -563,11 +564,10 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
GError *error = NULL;
|
||||
gboolean result;
|
||||
|
||||
/* Auto handling of cancelation disabled, and ignore
|
||||
cancellation, since we want to close things anyway, although
|
||||
possibly in a quick-n-dirty way. At least we never want to leak
|
||||
open handles */
|
||||
|
||||
/* Auto handling of cancelation disabled, and ignore cancellation,
|
||||
* since we want to close things anyway, although possibly in a
|
||||
* quick-n-dirty way. At least we never want to leak open handles
|
||||
*/
|
||||
class = G_IO_STREAM_GET_CLASS (object);
|
||||
if (class->close_fn)
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ typedef void (*GSimpleAsyncThreadFunc) (GSimpleAsyncResult *res,
|
||||
* This is the function type of the callback used for the #GSource
|
||||
* returned by g_socket_create_source().
|
||||
*
|
||||
* Returns: it should return FALSE if the source should be removed.
|
||||
* Returns: it should return %FALSE if the source should be removed.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -291,12 +291,12 @@ typedef gboolean (*GSocketSourceFunc) (GSocket *socket,
|
||||
/**
|
||||
* GInputVector:
|
||||
* @buffer: Pointer to a buffer where data will be written.
|
||||
* @size: the availible size in @buffer.
|
||||
* @size: the available size in @buffer.
|
||||
*
|
||||
* Structure used for scatter/gather data input.
|
||||
* You generally pass in an array of #GInputVector<!-- -->s and the operation
|
||||
* will store the read data starting in the first buffer, switching to
|
||||
* the next as needed.
|
||||
* You generally pass in an array of #GInputVector<!-- -->s
|
||||
* and the operation will store the read data starting in the
|
||||
* first buffer, switching to the next as needed.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -313,8 +313,9 @@ struct _GInputVector {
|
||||
* @size: the size of @buffer.
|
||||
*
|
||||
* Structure used for scatter/gather data output.
|
||||
* You generally pass in an array of #GOutputVector<!-- -->s and the operation
|
||||
* will use all the buffers as if they were one buffer.
|
||||
* You generally pass in an array of #GOutputVector<!-- -->s
|
||||
* and the operation will use all the buffers as if they were
|
||||
* one buffer.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
|
@ -57,14 +57,14 @@
|
||||
*
|
||||
* See #GSocketConnectable for and example of using the connectable
|
||||
* interface.
|
||||
**/
|
||||
*/
|
||||
|
||||
/**
|
||||
* GNetworkAddress:
|
||||
*
|
||||
* A #GSocketConnectable for resolving a hostname and connecting to
|
||||
* that host.
|
||||
**/
|
||||
*/
|
||||
|
||||
struct _GNetworkAddressPrivate {
|
||||
gchar *hostname;
|
||||
@ -129,13 +129,17 @@ g_network_address_class_init (GNetworkAddressClass *klass)
|
||||
P_("Hostname"),
|
||||
P_("Hostname to resolve"),
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_PORT,
|
||||
g_param_spec_uint ("port",
|
||||
P_("Port"),
|
||||
P_("Network port"),
|
||||
0, 65535, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -233,7 +237,7 @@ g_network_address_set_addresses (GNetworkAddress *addr,
|
||||
* Return value: the new #GNetworkAddress
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnectable *
|
||||
g_network_address_new (const gchar *hostname,
|
||||
guint16 port)
|
||||
@ -264,16 +268,16 @@ g_network_address_new (const gchar *hostname,
|
||||
* If no port is specified in @host_and_port then @default_port will be
|
||||
* used as the port number to connect to.
|
||||
*
|
||||
* In general, @host_and_port is expected to be provided by the user (allowing
|
||||
* them to give the hostname, and a port overide if necessary) and
|
||||
* @default_port is expected to be provided by the application.
|
||||
* In general, @host_and_port is expected to be provided by the user
|
||||
* (allowing them to give the hostname, and a port overide if necessary)
|
||||
* and @default_port is expected to be provided by the application.
|
||||
*
|
||||
* Return value: the new #GNetworkAddress, or %NULL on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnectable *
|
||||
g_network_address_parse (const char *host_and_port,
|
||||
g_network_address_parse (const gchar *host_and_port,
|
||||
guint16 default_port,
|
||||
GError **error)
|
||||
{
|
||||
@ -410,7 +414,7 @@ g_network_address_parse (const char *host_and_port,
|
||||
* Return value: @addr's hostname
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
const gchar *
|
||||
g_network_address_get_hostname (GNetworkAddress *addr)
|
||||
{
|
||||
@ -425,10 +429,10 @@ g_network_address_get_hostname (GNetworkAddress *addr)
|
||||
*
|
||||
* Gets @addr's port number
|
||||
*
|
||||
* Return value: @addr's port (which may be %0)
|
||||
* Return value: @addr's port (which may be 0)
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
guint16
|
||||
g_network_address_get_port (GNetworkAddress *addr)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ GType g_network_address_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GSocketConnectable *g_network_address_new (const gchar *hostname,
|
||||
guint16 port);
|
||||
GSocketConnectable *g_network_address_parse (const char *host_and_port,
|
||||
GSocketConnectable *g_network_address_parse (const gchar *host_and_port,
|
||||
guint16 default_port,
|
||||
GError **error);
|
||||
const gchar *g_network_address_get_hostname (GNetworkAddress *addr);
|
||||
|
@ -53,14 +53,14 @@
|
||||
* See #GSrvTarget for more information about SRV records, and see
|
||||
* #GSocketConnectable for and example of using the connectable
|
||||
* interface.
|
||||
**/
|
||||
*/
|
||||
|
||||
/**
|
||||
* GNetworkService:
|
||||
*
|
||||
* A #GSocketConnectable for resolving a SRV record and connecting to
|
||||
* that service.
|
||||
**/
|
||||
*/
|
||||
|
||||
struct _GNetworkServicePrivate
|
||||
{
|
||||
@ -122,19 +122,25 @@ g_network_service_class_init (GNetworkServiceClass *klass)
|
||||
P_("Service"),
|
||||
P_("Service name, eg \"ldap\""),
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_PROTOCOL,
|
||||
g_param_spec_string ("protocol",
|
||||
P_("Protocol"),
|
||||
P_("Network protocol, eg \"tcp\""),
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_DOMAIN,
|
||||
g_param_spec_string ("domain",
|
||||
P_("domain"),
|
||||
P_("Domain"),
|
||||
P_("Network domain, eg, \"example.com\""),
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -176,7 +182,6 @@ g_network_service_set_property (GObject *object,
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -205,7 +210,6 @@ g_network_service_get_property (GObject *object,
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,7 +225,7 @@ g_network_service_get_property (GObject *object,
|
||||
* Return value: a new #GNetworkService
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnectable *
|
||||
g_network_service_new (const gchar *service,
|
||||
const gchar *protocol,
|
||||
@ -243,7 +247,7 @@ g_network_service_new (const gchar *service,
|
||||
* Return value: @srv's service name
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
const gchar *
|
||||
g_network_service_get_service (GNetworkService *srv)
|
||||
{
|
||||
@ -261,7 +265,7 @@ g_network_service_get_service (GNetworkService *srv)
|
||||
* Return value: @srv's protocol name
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
const gchar *
|
||||
g_network_service_get_protocol (GNetworkService *srv)
|
||||
{
|
||||
@ -280,7 +284,7 @@ g_network_service_get_protocol (GNetworkService *srv)
|
||||
* Return value: @srv's domain name
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
const gchar *
|
||||
g_network_service_get_domain (GNetworkService *srv)
|
||||
{
|
||||
|
@ -101,10 +101,10 @@ static GResolver *default_resolver;
|
||||
* many threads/processes, etc it should allocate for concurrent DNS
|
||||
* resolutions.
|
||||
*
|
||||
* Return value: the #GResolver.
|
||||
* Return value: the default #GResolver.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GResolver *
|
||||
g_resolver_get_default (void)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ void g_resolver_free_targets (GList *targets);
|
||||
* Error domain for #GResolver. Errors in this domain will be from the
|
||||
* #GResolverError enumeration. See #GError for more information on
|
||||
* error domains.
|
||||
**/
|
||||
*/
|
||||
#define G_RESOLVER_ERROR (g_resolver_error_quark ())
|
||||
GQuark g_resolver_error_quark (void);
|
||||
|
||||
|
149
gio/gsocket.c
149
gio/gsocket.c
@ -111,7 +111,7 @@
|
||||
* if it tries to write to %stdout after it has been closed.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
|
||||
static void g_socket_initable_iface_init (GInitableIface *iface);
|
||||
static gboolean g_socket_initable_init (GInitable *initable,
|
||||
@ -645,7 +645,9 @@ g_socket_class_init (GSocketClass *klass)
|
||||
P_("The sockets address family"),
|
||||
G_TYPE_SOCKET_FAMILY,
|
||||
G_SOCKET_FAMILY_INVALID,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_TYPE,
|
||||
g_param_spec_enum ("type",
|
||||
@ -653,7 +655,9 @@ g_socket_class_init (GSocketClass *klass)
|
||||
P_("The sockets type"),
|
||||
G_TYPE_SOCKET_TYPE,
|
||||
G_SOCKET_TYPE_STREAM,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_PROTOCOL,
|
||||
g_param_spec_enum ("protocol",
|
||||
@ -661,7 +665,9 @@ g_socket_class_init (GSocketClass *klass)
|
||||
P_("The id of the protocol to use, or -1 for unknown"),
|
||||
G_TYPE_SOCKET_PROTOCOL,
|
||||
G_SOCKET_PROTOCOL_UNKNOWN,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_FD,
|
||||
g_param_spec_int ("fd",
|
||||
@ -670,44 +676,51 @@ g_socket_class_init (GSocketClass *klass)
|
||||
G_MININT,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_BLOCKING,
|
||||
g_param_spec_boolean ("blocking",
|
||||
P_("blocking"),
|
||||
P_("Whether or not I/O on this socket is blocking"),
|
||||
TRUE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_LISTEN_BACKLOG,
|
||||
g_param_spec_int ("listen-backlog",
|
||||
P_("Listen backlog"),
|
||||
P_("outstanding connections in the listen queue"),
|
||||
P_("Outstanding connections in the listen queue"),
|
||||
0,
|
||||
SOMAXCONN,
|
||||
10,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_KEEPALIVE,
|
||||
g_param_spec_boolean ("keepalive",
|
||||
P_("Keep connection alive"),
|
||||
P_("Keep connection alive by sending periodic pings"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_LOCAL_ADDRESS,
|
||||
g_param_spec_object ("local-address",
|
||||
P_("Local address"),
|
||||
P_("The local address the socket is bound to"),
|
||||
G_TYPE_SOCKET_ADDRESS,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_REMOTE_ADDRESS,
|
||||
g_param_spec_object ("remote-address",
|
||||
P_("Remote address"),
|
||||
P_("The remote address the socket is connected to"),
|
||||
G_TYPE_SOCKET_ADDRESS,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -786,7 +799,7 @@ g_socket_initable_init (GInitable *initable,
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocket *
|
||||
g_socket_new (GSocketFamily family,
|
||||
GSocketType type,
|
||||
@ -818,7 +831,7 @@ g_socket_new (GSocketFamily family,
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocket *
|
||||
g_socket_new_from_fd (gint fd,
|
||||
GError **error)
|
||||
@ -844,7 +857,7 @@ g_socket_new_from_fd (gint fd,
|
||||
* is a GSocket level feature.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_set_blocking (GSocket *socket,
|
||||
gboolean blocking)
|
||||
@ -870,7 +883,7 @@ g_socket_set_blocking (GSocket *socket,
|
||||
* Returns: %TRUE if blocking I/O is used, %FALSE otherwise.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_get_blocking (GSocket *socket)
|
||||
{
|
||||
@ -898,7 +911,7 @@ g_socket_get_blocking (GSocket *socket)
|
||||
* remote side is disconnected, so as to avoid leaking resources forever.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_set_keepalive (GSocket *socket,
|
||||
gboolean keepalive)
|
||||
@ -934,7 +947,7 @@ g_socket_set_keepalive (GSocket *socket,
|
||||
* Returns: %TRUE if keepalive is active, %FALSE otherwise.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_get_keepalive (GSocket *socket)
|
||||
{
|
||||
@ -953,7 +966,7 @@ g_socket_get_keepalive (GSocket *socket)
|
||||
* Returns: the maximum number of pending connections.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gint
|
||||
g_socket_get_listen_backlog (GSocket *socket)
|
||||
{
|
||||
@ -976,7 +989,7 @@ g_socket_get_listen_backlog (GSocket *socket)
|
||||
* effect if called after that.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_set_listen_backlog (GSocket *socket,
|
||||
gint backlog)
|
||||
@ -1000,7 +1013,7 @@ g_socket_set_listen_backlog (GSocket *socket,
|
||||
* Returns: a #GSocketFamily
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketFamily
|
||||
g_socket_get_family (GSocket *socket)
|
||||
{
|
||||
@ -1018,7 +1031,7 @@ g_socket_get_family (GSocket *socket)
|
||||
* Returns: a #GSocketType
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketType
|
||||
g_socket_get_socket_type (GSocket *socket)
|
||||
{
|
||||
@ -1037,7 +1050,7 @@ g_socket_get_socket_type (GSocket *socket)
|
||||
* Returns: a protocol id, or -1 if unknown
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketProtocol
|
||||
g_socket_get_protocol (GSocket *socket)
|
||||
{
|
||||
@ -1059,7 +1072,7 @@ g_socket_get_protocol (GSocket *socket)
|
||||
* Returns: the file descriptor of the socket.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
int
|
||||
g_socket_get_fd (GSocket *socket)
|
||||
{
|
||||
@ -1081,7 +1094,7 @@ g_socket_get_fd (GSocket *socket)
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketAddress *
|
||||
g_socket_get_local_address (GSocket *socket,
|
||||
GError **error)
|
||||
@ -1114,7 +1127,7 @@ g_socket_get_local_address (GSocket *socket,
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketAddress *
|
||||
g_socket_get_remote_address (GSocket *socket,
|
||||
GError **error)
|
||||
@ -1145,7 +1158,7 @@ g_socket_get_remote_address (GSocket *socket,
|
||||
* Returns: %TRUE if socket is connected, %FALSE otherwise.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_is_connected (GSocket *socket)
|
||||
{
|
||||
@ -1171,7 +1184,7 @@ g_socket_is_connected (GSocket *socket)
|
||||
* Returns: %TRUE on success, %FALSE on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_listen (GSocket *socket,
|
||||
GError **error)
|
||||
@ -1222,7 +1235,7 @@ g_socket_listen (GSocket *socket,
|
||||
* Returns: %TRUE on success, %FALSE on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_bind (GSocket *socket,
|
||||
GSocketAddress *address,
|
||||
@ -1286,7 +1299,7 @@ g_socket_bind (GSocket *socket,
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocket *
|
||||
g_socket_accept (GSocket *socket,
|
||||
GError **error)
|
||||
@ -1299,7 +1312,7 @@ g_socket_accept (GSocket *socket,
|
||||
if (!check_socket (socket, error))
|
||||
return NULL;
|
||||
|
||||
while (1)
|
||||
while (TRUE)
|
||||
{
|
||||
if (socket->priv->blocking &&
|
||||
!g_socket_condition_wait (socket,
|
||||
@ -1388,8 +1401,9 @@ g_socket_accept (GSocket *socket,
|
||||
* the default address for g_socket_send() and discards all incoming datagrams
|
||||
* from other sources.
|
||||
*
|
||||
* Generally connection oriented sockets can only connect once, but connection-less
|
||||
* sockets can connect multiple times to change the default address.
|
||||
* Generally connection oriented sockets can only connect once, but
|
||||
* connection-less sockets can connect multiple times to change the
|
||||
* default address.
|
||||
*
|
||||
* If the connect call needs to do network I/O it will block, unless
|
||||
* non-blocking I/O is enabled. Then %G_IO_ERROR_PENDING is returned
|
||||
@ -1400,7 +1414,7 @@ g_socket_accept (GSocket *socket,
|
||||
* Returns: %TRUE if connected, %FALSE on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_connect (GSocket *socket,
|
||||
GSocketAddress *address,
|
||||
@ -1466,13 +1480,14 @@ g_socket_connect (GSocket *socket,
|
||||
* @socket: a #GSocket
|
||||
* @error: #GError for error reporting, or %NULL to ignore.
|
||||
*
|
||||
* Checks and resets the pending connect error for the socket. This is
|
||||
* used to check for errors when g_socket_connect() is used in non-blocking mode.
|
||||
* Checks and resets the pending connect error for the socket.
|
||||
* This is used to check for errors when g_socket_connect() is
|
||||
* used in non-blocking mode.
|
||||
*
|
||||
* Returns: %TRUE if no error, %FALSE otherwise, setting @error to the error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_check_connect_result (GSocket *socket,
|
||||
GError **error)
|
||||
@ -1502,7 +1517,8 @@ g_socket_check_connect_result (GSocket *socket,
|
||||
/**
|
||||
* g_socket_receive:
|
||||
* @socket: a #GSocket
|
||||
* @buffer: a buffer to read data into (which should be at least count bytes long).
|
||||
* @buffer: a buffer to read data into (which should be at least @size
|
||||
* bytes long).
|
||||
* @size: the number of bytes that will be read from the stream
|
||||
* @error: #GError for error reporting, or %NULL to ignore.
|
||||
*
|
||||
@ -1524,7 +1540,7 @@ g_socket_check_connect_result (GSocket *socket,
|
||||
* Returns: Number of bytes read, or -1 on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gssize
|
||||
g_socket_receive (GSocket *socket,
|
||||
gchar *buffer,
|
||||
@ -1584,7 +1600,8 @@ g_socket_receive (GSocket *socket,
|
||||
* g_socket_receive_from:
|
||||
* @socket: a #GSocket
|
||||
* @address: a pointer to a #GSocketAddress pointer, or %NULL
|
||||
* @buffer: a buffer to read data into (which should be at least count bytes long).
|
||||
* @buffer: a buffer to read data into (which should be at least @size
|
||||
* bytes long).
|
||||
* @size: the number of bytes that will be read from the stream
|
||||
* @error: #GError for error reporting, or %NULL to ignore.
|
||||
*
|
||||
@ -1605,7 +1622,7 @@ g_socket_receive (GSocket *socket,
|
||||
* Returns: Number of bytes read, or -1 on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gssize
|
||||
g_socket_receive_from (GSocket *socket,
|
||||
GSocketAddress **address,
|
||||
@ -1632,15 +1649,15 @@ g_socket_receive_from (GSocket *socket,
|
||||
* @size: the number of bytes to send
|
||||
* @error: #GError for error reporting, or %NULL to ignore.
|
||||
*
|
||||
* Tries to send @size bytes from @buffer on the socket. This is mainly used by
|
||||
* connection oriented sockets, it is identical to g_socket_send_to()
|
||||
* with @address set to %NULL.
|
||||
* Tries to send @size bytes from @buffer on the socket.
|
||||
* This is mainly used by connection oriented sockets, it is identical
|
||||
* to g_socket_send_to() with @address set to %NULL.
|
||||
*
|
||||
* If the socket is in blocking mode the call will block until there is
|
||||
* space for the data in the socket queue. If there is no space available
|
||||
* and the socket is in non-blocking mode a %G_IO_ERROR_WOULD_BLOCK error
|
||||
* will be returned. To be notified of available space, wait for the %G_IO_OUT
|
||||
* condition.
|
||||
* will be returned. To be notified of available space, wait for the
|
||||
* %G_IO_OUT condition.
|
||||
*
|
||||
* Note that on Windows you can't rely on a %G_IO_OUT condition
|
||||
* not producing a %G_IO_ERROR_WOULD_BLOCK error, as this is how Winsock
|
||||
@ -1652,7 +1669,7 @@ g_socket_receive_from (GSocket *socket,
|
||||
* Returns: Number of bytes read, or -1 on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gssize
|
||||
g_socket_send (GSocket *socket,
|
||||
const gchar *buffer,
|
||||
@ -1736,7 +1753,7 @@ g_socket_send (GSocket *socket,
|
||||
* Returns: Number of bytes read, or -1 on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gssize
|
||||
g_socket_send_to (GSocket *socket,
|
||||
GSocketAddress *address,
|
||||
@ -1780,7 +1797,7 @@ g_socket_send_to (GSocket *socket,
|
||||
* Returns: %TRUE on success, %FALSE on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_shutdown (GSocket *socket,
|
||||
gboolean shutdown_read,
|
||||
@ -1835,12 +1852,13 @@ g_socket_shutdown (GSocket *socket,
|
||||
*
|
||||
* Closes the socket, shutting down any active connection.
|
||||
*
|
||||
* Closing a socket does not wait for all outstanding I/O operations to finish,
|
||||
* so the caller should not rely on them to be guaranteed to complete even
|
||||
* if the close returns with no error.
|
||||
* Closing a socket does not wait for all outstanding I/O operations
|
||||
* to finish, so the caller should not rely on them to be guaranteed
|
||||
* to complete even if the close returns with no error.
|
||||
*
|
||||
* Once the socket is closed, all other operations will return %G_IO_ERROR_CLOSED.
|
||||
* Closing a stream multiple times will not return an error.
|
||||
* Once the socket is closed, all other operations will return
|
||||
* %G_IO_ERROR_CLOSED. Closing a stream multiple times will not
|
||||
* return an error.
|
||||
*
|
||||
* Sockets will be automatically closed when the last reference
|
||||
* is dropped, but you might want to call this function to make sure
|
||||
@ -1849,7 +1867,7 @@ g_socket_shutdown (GSocket *socket,
|
||||
* Returns: %TRUE on success, %FALSE on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_close (GSocket *socket,
|
||||
GError **error)
|
||||
@ -1910,7 +1928,7 @@ g_socket_close (GSocket *socket,
|
||||
* Returns: %TRUE if socket is closed, %FALSE otherwise
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_is_closed (GSocket *socket)
|
||||
{
|
||||
@ -2233,7 +2251,7 @@ winsock_source_new (GSocket *socket,
|
||||
* Returns: a newly allocated %GSource, free with g_source_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSource *
|
||||
g_socket_create_source (GSocket *socket,
|
||||
GIOCondition condition,
|
||||
@ -2256,8 +2274,8 @@ g_socket_create_source (GSocket *socket,
|
||||
* @socket: a #GSocket
|
||||
* @condition: a #GIOCondition mask to check
|
||||
*
|
||||
* Checks on the readiness of @socket to perform operations. The
|
||||
* operations specified in @condition are checked for and masked
|
||||
* Checks on the readiness of @socket to perform operations.
|
||||
* The operations specified in @condition are checked for and masked
|
||||
* against the currently-satisfied conditions on @socket. The result
|
||||
* is returned.
|
||||
*
|
||||
@ -2269,7 +2287,7 @@ g_socket_create_source (GSocket *socket,
|
||||
* Returns: the @GIOCondition mask of the current state
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GIOCondition
|
||||
g_socket_condition_check (GSocket *socket,
|
||||
GIOCondition condition)
|
||||
@ -2312,15 +2330,15 @@ g_socket_condition_check (GSocket *socket,
|
||||
* @error: a #GError pointer, or %NULL
|
||||
*
|
||||
* 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
|
||||
* %FALSE is returned and @error, if non-%NULL, is set to %G_IO_ERROR_CANCELLED.
|
||||
* If @cancellable is cancelled before the condition is met then %FALSE
|
||||
* is returned and @error, if non-%NULL, is set to %G_IO_ERROR_CANCELLED.
|
||||
*
|
||||
* Returns: %TRUE if the condition was met, %FALSE otherwise
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_condition_wait (GSocket *socket,
|
||||
GIOCondition condition,
|
||||
@ -2431,7 +2449,6 @@ g_socket_condition_wait (GSocket *socket,
|
||||
* If @num_vector is -1, then @vector is assumed to be terminated
|
||||
* by a #GOutputVector with a %NULL buffer pointer.
|
||||
*
|
||||
*
|
||||
* @messages, if non-%NULL, is taken to point to an array of @num_messages
|
||||
* #GSocketControlMessage instances. These correspond to the control
|
||||
* messages to be sent on the socket.
|
||||
@ -2459,7 +2476,7 @@ g_socket_condition_wait (GSocket *socket,
|
||||
* Returns: Number of bytes read, or -1 on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gssize
|
||||
g_socket_send_message (GSocket *socket,
|
||||
GSocketAddress *address,
|
||||
@ -2748,7 +2765,7 @@ g_socket_send_message (GSocket *socket,
|
||||
* Returns: Number of bytes read, or -1 on error
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gssize
|
||||
g_socket_receive_message (GSocket *socket,
|
||||
GSocketAddress **address,
|
||||
|
@ -48,14 +48,14 @@
|
||||
* in the BSD sockets API. This is an abstract class; use
|
||||
* #GInetSocketAddress for internet sockets, or #GUnixSocketAddress
|
||||
* for UNIX domain sockets.
|
||||
**/
|
||||
*/
|
||||
|
||||
/**
|
||||
* GSocketAddress:
|
||||
*
|
||||
* A socket endpoint address, corresponding to <type>struct sockaddr</type>
|
||||
* or one of its subtypes.
|
||||
**/
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
@ -118,7 +118,8 @@ g_socket_address_class_init (GSocketAddressClass *klass)
|
||||
P_("The family of the socket address"),
|
||||
G_TYPE_SOCKET_FAMILY,
|
||||
G_SOCKET_FAMILY_INVALID,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME));
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -69,9 +69,9 @@ g_socket_address_enumerator_class_init (GSocketAddressEnumeratorClass *enumerato
|
||||
* ignored.
|
||||
*
|
||||
* Return value: a #GSocketAddress (owned by the caller), or %NULL on
|
||||
* error (in which case *@error will be set) or if there are no more
|
||||
* addresses.
|
||||
**/
|
||||
* error (in which case *@error will be set) or if there are no
|
||||
* more addresses.
|
||||
*/
|
||||
GSocketAddress *
|
||||
g_socket_address_enumerator_next (GSocketAddressEnumerator *enumerator,
|
||||
GCancellable *cancellable,
|
||||
@ -125,7 +125,7 @@ g_socket_address_enumerator_real_next_async (GSocketAddressEnumerator *enumerat
|
||||
* Asynchronously retrieves the next #GSocketAddress from @enumerator
|
||||
* and then calls @callback, which must call
|
||||
* g_socket_address_enumerator_next_finish() to get the result.
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_address_enumerator_next_async (GSocketAddressEnumerator *enumerator,
|
||||
GCancellable *cancellable,
|
||||
@ -161,8 +161,8 @@ g_socket_address_enumerator_real_next_finish (GSocketAddressEnumerator *enumera
|
||||
/**
|
||||
* g_socket_address_enumerator_next_finish:
|
||||
* @enumerator: a #GSocketAddressEnumerator
|
||||
* @result: a #GAsyncResult.
|
||||
* @error: a #GError.
|
||||
* @result: a #GAsyncResult
|
||||
* @error: a #GError
|
||||
*
|
||||
* Retrieves the result of a completed call to
|
||||
* g_socket_address_enumerator_next_async(). See
|
||||
@ -170,9 +170,9 @@ g_socket_address_enumerator_real_next_finish (GSocketAddressEnumerator *enumera
|
||||
* error handling.
|
||||
*
|
||||
* Return value: a #GSocketAddress (owned by the caller), or %NULL on
|
||||
* error (in which case *@error will be set) or if there are no more
|
||||
* addresses.
|
||||
**/
|
||||
* error (in which case *@error will be set) or if there are no
|
||||
* more addresses.
|
||||
*/
|
||||
GSocketAddress *
|
||||
g_socket_address_enumerator_next_finish (GSocketAddressEnumerator *enumerator,
|
||||
GAsyncResult *result,
|
||||
|
@ -41,7 +41,7 @@ G_BEGIN_DECLS
|
||||
*
|
||||
* Enumerator type for objects that contain or generate
|
||||
* #GSocketAddress<!-- -->es.
|
||||
**/
|
||||
*/
|
||||
typedef struct _GSocketAddressEnumeratorClass GSocketAddressEnumeratorClass;
|
||||
|
||||
struct _GSocketAddressEnumerator
|
||||
|
@ -60,7 +60,7 @@
|
||||
* it will be a #GTcpConnection.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GSocketClient, g_socket_client, G_TYPE_OBJECT);
|
||||
@ -137,7 +137,7 @@ g_socket_client_init (GSocketClient *client)
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketClient *
|
||||
g_socket_client_new (void)
|
||||
{
|
||||
@ -229,7 +229,7 @@ g_socket_client_set_property (GObject *object,
|
||||
* Returns: a #GSocketFamily
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketFamily
|
||||
g_socket_client_get_family (GSocketClient *client)
|
||||
{
|
||||
@ -251,7 +251,7 @@ g_socket_client_get_family (GSocketClient *client)
|
||||
* be an ipv6 mapped to ipv4 address.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_client_set_family (GSocketClient *client,
|
||||
GSocketFamily family)
|
||||
@ -274,7 +274,7 @@ g_socket_client_set_family (GSocketClient *client,
|
||||
* Returns: a #GSocketFamily
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketType
|
||||
g_socket_client_get_socket_type (GSocketClient *client)
|
||||
{
|
||||
@ -294,7 +294,7 @@ g_socket_client_get_socket_type (GSocketClient *client)
|
||||
* as GSocketClient is used for connection oriented services.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_client_set_socket_type (GSocketClient *client,
|
||||
GSocketType type)
|
||||
@ -308,7 +308,7 @@ g_socket_client_set_socket_type (GSocketClient *client,
|
||||
|
||||
/**
|
||||
* g_socket_client_get_protocol:
|
||||
* @client: a #GSocketClient.
|
||||
* @client: a #GSocketClient
|
||||
*
|
||||
* Gets the protocol name type of the socket client.
|
||||
*
|
||||
@ -317,7 +317,7 @@ g_socket_client_set_socket_type (GSocketClient *client,
|
||||
* Returns: a #GSocketProtocol
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketProtocol
|
||||
g_socket_client_get_protocol (GSocketClient *client)
|
||||
{
|
||||
@ -337,7 +337,7 @@ g_socket_client_get_protocol (GSocketClient *client)
|
||||
* protocol for the socket family and type.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_client_set_protocol (GSocketClient *client,
|
||||
GSocketProtocol protocol)
|
||||
@ -360,7 +360,7 @@ g_socket_client_set_protocol (GSocketClient *client,
|
||||
* Returns: a #GSocketAddres or %NULL. don't free
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketAddress *
|
||||
g_socket_client_get_local_address (GSocketClient *client)
|
||||
{
|
||||
@ -381,7 +381,7 @@ g_socket_client_get_local_address (GSocketClient *client)
|
||||
* a specific interface.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_client_set_local_address (GSocketClient *client,
|
||||
GSocketAddress *address)
|
||||
@ -414,7 +414,9 @@ g_socket_client_class_init (GSocketClientClass *class)
|
||||
P_("The sockets address family to use for socket construction"),
|
||||
G_TYPE_SOCKET_FAMILY,
|
||||
G_SOCKET_FAMILY_INVALID,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_TYPE,
|
||||
g_param_spec_enum ("type",
|
||||
@ -422,7 +424,9 @@ g_socket_client_class_init (GSocketClientClass *class)
|
||||
P_("The sockets type to use for socket construction"),
|
||||
G_TYPE_SOCKET_TYPE,
|
||||
G_SOCKET_TYPE_STREAM,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_PROTOCOL,
|
||||
g_param_spec_enum ("protocol",
|
||||
@ -430,14 +434,18 @@ g_socket_client_class_init (GSocketClientClass *class)
|
||||
P_("The protocol to use for socket construction, or 0 for default"),
|
||||
G_TYPE_SOCKET_PROTOCOL,
|
||||
G_SOCKET_PROTOCOL_DEFAULT,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_LOCAL_ADDRESS,
|
||||
g_param_spec_object ("local-address",
|
||||
P_("Local address"),
|
||||
P_("The local address constructed sockets will be bound to"),
|
||||
G_TYPE_SOCKET_ADDRESS,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -469,7 +477,7 @@ g_socket_client_class_init (GSocketClientClass *class)
|
||||
* Returns: a #GSocketConnection on success, %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnection *
|
||||
g_socket_client_connect (GSocketClient *client,
|
||||
GSocketConnectable *connectable,
|
||||
@ -558,7 +566,7 @@ g_socket_client_connect (GSocketClient *client,
|
||||
* In general, @host_and_port is expected to be provided by the user (allowing
|
||||
* them to give the hostname, and a port overide if necessary) and
|
||||
* @default_port is expected to be provided by the application.
|
||||
|
||||
*
|
||||
* In the case that an IP address is given, a single connection
|
||||
* attempt is made. In the case that a name is given, multiple
|
||||
* connection attempts may be made, in turn and according to the
|
||||
@ -575,11 +583,11 @@ g_socket_client_connect (GSocketClient *client,
|
||||
Returns: a #GSocketConnection on success, %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnection *
|
||||
g_socket_client_connect_to_host (GSocketClient *client,
|
||||
const char *host_and_port,
|
||||
int default_port,
|
||||
const gchar *host_and_port,
|
||||
gint default_port,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
@ -620,11 +628,11 @@ g_socket_client_connect_to_host (GSocketClient *client,
|
||||
* In the event of any failure (DNS error, service not found, no hosts
|
||||
* connectable) %NULL is returned and @error (if non-%NULL) is set
|
||||
* accordingly.
|
||||
**/
|
||||
*/
|
||||
GSocketConnection *
|
||||
g_socket_client_connect_to_service (GSocketClient *client,
|
||||
const char *domain,
|
||||
const char *service,
|
||||
const gchar *domain,
|
||||
const gchar *service,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
@ -823,7 +831,7 @@ g_socket_client_enumerator_callback (GObject *object,
|
||||
* the result of the operation.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_client_connect_async (GSocketClient *client,
|
||||
GSocketConnectable *connectable,
|
||||
@ -869,11 +877,11 @@ g_socket_client_connect_async (GSocketClient *client,
|
||||
* the result of the operation.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_client_connect_to_host_async (GSocketClient *client,
|
||||
const char *host_and_port,
|
||||
int default_port,
|
||||
const gchar *host_and_port,
|
||||
gint default_port,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@ -910,11 +918,13 @@ g_socket_client_connect_to_host_async (GSocketClient *client,
|
||||
*
|
||||
* This is the asynchronous version of
|
||||
* g_socket_client_connect_to_service().
|
||||
**/
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
void
|
||||
g_socket_client_connect_to_service_async (GSocketClient *client,
|
||||
const char *domain,
|
||||
const char *service,
|
||||
const gchar *domain,
|
||||
const gchar *service,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@ -940,7 +950,7 @@ g_socket_client_connect_to_service_async (GSocketClient *client,
|
||||
* Returns: a #GSocketConnection on success, %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnection *
|
||||
g_socket_client_connect_finish (GSocketClient *client,
|
||||
GAsyncResult *result,
|
||||
@ -966,7 +976,7 @@ g_socket_client_connect_finish (GSocketClient *client,
|
||||
* Returns: a #GSocketConnection on success, %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnection *
|
||||
g_socket_client_connect_to_host_finish (GSocketClient *client,
|
||||
GAsyncResult *result,
|
||||
@ -987,7 +997,7 @@ g_socket_client_connect_to_host_finish (GSocketClient *client,
|
||||
* Returns: a #GSocketConnection on success, %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnection *
|
||||
g_socket_client_connect_to_service_finish (GSocketClient *client,
|
||||
GAsyncResult *result,
|
||||
|
@ -88,13 +88,13 @@ GSocketConnection * g_socket_client_connect (GSocket
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GSocketConnection * g_socket_client_connect_to_host (GSocketClient *client,
|
||||
const char *host_and_port,
|
||||
int default_port,
|
||||
const gchar *host_and_port,
|
||||
gint default_port,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GSocketConnection * g_socket_client_connect_to_service (GSocketClient *client,
|
||||
const char *domain,
|
||||
const char *service,
|
||||
const gchar *domain,
|
||||
const gchar *service,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
void g_socket_client_connect_async (GSocketClient *client,
|
||||
@ -106,8 +106,8 @@ GSocketConnection * g_socket_client_connect_finish (GSocket
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
void g_socket_client_connect_to_host_async (GSocketClient *client,
|
||||
const char *host_and_port,
|
||||
int default_port,
|
||||
const gchar *host_and_port,
|
||||
gint default_port,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
@ -116,8 +116,8 @@ GSocketConnection * g_socket_client_connect_to_host_finish (GSocket
|
||||
GError **error);
|
||||
|
||||
void g_socket_client_connect_to_service_async (GSocketClient *client,
|
||||
const char *domain,
|
||||
const char *service,
|
||||
const gchar *domain,
|
||||
const gchar *service,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
@ -89,7 +89,7 @@
|
||||
* }
|
||||
* }
|
||||
* ]|
|
||||
**/
|
||||
*/
|
||||
|
||||
GType
|
||||
g_socket_connectable_get_type (void)
|
||||
@ -131,7 +131,7 @@ g_socket_connectable_get_type (void)
|
||||
* Return value: a new #GSocketAddressEnumerator.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketAddressEnumerator *
|
||||
g_socket_connectable_enumerate (GSocketConnectable *connectable)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ G_BEGIN_DECLS
|
||||
* GSocketConnectable:
|
||||
*
|
||||
* Interface for objects that contain or generate #GSocketAddress<!-- -->es.
|
||||
**/
|
||||
*/
|
||||
typedef struct _GSocketConnectableIface GSocketConnectableIface;
|
||||
|
||||
/**
|
||||
@ -47,7 +47,7 @@ typedef struct _GSocketConnectableIface GSocketConnectableIface;
|
||||
* @enumerate: Creates a #GSocketAddressEnumerator
|
||||
*
|
||||
* Provides an interface for returning a #GSocketAddressEnumerator
|
||||
**/
|
||||
*/
|
||||
struct _GSocketConnectableIface
|
||||
{
|
||||
GTypeInterface g_iface;
|
||||
|
@ -49,17 +49,17 @@
|
||||
* can be created either by #GSocketClient when connecting to a host,
|
||||
* or by #GSocketListener when accepting a new client.
|
||||
*
|
||||
* The type of the #GSocketConnection object returned from these calls depends
|
||||
* on the type of the underlying socket that is in use. For instance, for a
|
||||
* TCP/IP connection it will be a #GTcpConnection.
|
||||
* The type of the #GSocketConnection object returned from these calls
|
||||
* depends on the type of the underlying socket that is in use. For
|
||||
* instance, for a TCP/IP connection it will be a #GTcpConnection.
|
||||
*
|
||||
* Chosing what type of object to construct is done with the socket connection
|
||||
* factory, and it is possible for 3rd parties to register custom socket connection
|
||||
* types for specific combination of socket family/type/protocol using
|
||||
* g_socket_connection_factory_register_type().
|
||||
* Chosing what type of object to construct is done with the socket
|
||||
* connection factory, and it is possible for 3rd parties to register
|
||||
* custom socket connection types for specific combination of socket
|
||||
* family/type/protocol using g_socket_connection_factory_register_type().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
|
||||
G_DEFINE_TYPE (GSocketConnection,
|
||||
g_socket_connection, G_TYPE_IO_STREAM);
|
||||
@ -115,7 +115,7 @@ g_socket_connection_get_output_stream (GIOStream *io_stream)
|
||||
|
||||
/**
|
||||
* g_socket_connection_get_socket:
|
||||
* @connection: a #GSocketConnection.
|
||||
* @connection: a #GSocketConnection
|
||||
*
|
||||
* Gets the underlying #GSocket object of the connection.
|
||||
* This can be useful if you want to do something unusual on it
|
||||
@ -124,7 +124,7 @@ g_socket_connection_get_output_stream (GIOStream *io_stream)
|
||||
* Returns: a #GSocketAddress or %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocket *
|
||||
g_socket_connection_get_socket (GSocketConnection *connection)
|
||||
{
|
||||
@ -135,7 +135,7 @@ g_socket_connection_get_socket (GSocketConnection *connection)
|
||||
|
||||
/**
|
||||
* g_socket_connection_get_local_address:
|
||||
* @connection: a #GSocketConnection.
|
||||
* @connection: a #GSocketConnection
|
||||
* @error: #GError for error reporting, or %NULL to ignore.
|
||||
*
|
||||
* Try to get the local address of a socket connection.
|
||||
@ -144,7 +144,7 @@ g_socket_connection_get_socket (GSocketConnection *connection)
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketAddress *
|
||||
g_socket_connection_get_local_address (GSocketConnection *connection,
|
||||
GError **error)
|
||||
@ -154,7 +154,7 @@ g_socket_connection_get_local_address (GSocketConnection *connection,
|
||||
|
||||
/**
|
||||
* g_socket_connection_get_remote_address:
|
||||
* @connection: a #GSocketConnection.
|
||||
* @connection: a #GSocketConnection
|
||||
* @error: #GError for error reporting, or %NULL to ignore.
|
||||
*
|
||||
* Try to get the remove address of a socket connection.
|
||||
@ -163,7 +163,7 @@ g_socket_connection_get_local_address (GSocketConnection *connection,
|
||||
* Free the returned object with g_object_unref().
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketAddress *
|
||||
g_socket_connection_get_remote_address (GSocketConnection *connection,
|
||||
GError **error)
|
||||
@ -172,8 +172,10 @@ g_socket_connection_get_remote_address (GSocketConnection *connection,
|
||||
}
|
||||
|
||||
static void
|
||||
g_socket_connection_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
g_socket_connection_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GSocketConnection *connection = G_SOCKET_CONNECTION (object);
|
||||
|
||||
@ -189,8 +191,10 @@ g_socket_connection_get_property (GObject *object, guint prop_id,
|
||||
}
|
||||
|
||||
static void
|
||||
g_socket_connection_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
g_socket_connection_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GSocketConnection *connection = G_SOCKET_CONNECTION (object);
|
||||
|
||||
@ -249,12 +253,15 @@ g_socket_connection_class_init (GSocketConnectionClass *klass)
|
||||
stream_class->close_async = g_socket_connection_close_async;
|
||||
stream_class->close_finish = g_socket_connection_close_finish;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_SOCKET,
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SOCKET,
|
||||
g_param_spec_object ("socket",
|
||||
P_("Socket"),
|
||||
P_("The underlying GSocket"),
|
||||
G_TYPE_SOCKET, G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
G_TYPE_SOCKET,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -369,8 +376,8 @@ G_LOCK_DEFINE_STATIC(connection_factories);
|
||||
|
||||
/**
|
||||
* g_socket_connection_factory_register_type:
|
||||
* @g_type: a #GType, inheriting from G_SOCKET_CONNECTION
|
||||
* @family: a #GSocketFamily.
|
||||
* @g_type: a #GType, inheriting from %G_TYPE_SOCKET_CONNECTION
|
||||
* @family: a #GSocketFamily
|
||||
* @type: a #GSocketType
|
||||
* @protocol: a protocol id
|
||||
*
|
||||
@ -380,7 +387,7 @@ G_LOCK_DEFINE_STATIC(connection_factories);
|
||||
* If no type is registered, the #GSocketConnection base type is returned.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_connection_factory_register_type (GType g_type,
|
||||
GSocketFamily family,
|
||||
@ -423,7 +430,7 @@ init_builtin_types (void)
|
||||
|
||||
/**
|
||||
* g_socket_connection_factory_lookup_type:
|
||||
* @family: a #GSocketFamily.
|
||||
* @family: a #GSocketFamily
|
||||
* @type: a #GSocketType
|
||||
* @protocol_id: a protocol id
|
||||
*
|
||||
@ -433,8 +440,9 @@ init_builtin_types (void)
|
||||
* If no type is registered, the #GSocketConnection base type is returned.
|
||||
*
|
||||
* Returns: a #GType
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GType
|
||||
g_socket_connection_factory_lookup_type (GSocketFamily family,
|
||||
GSocketType type,
|
||||
@ -467,7 +475,7 @@ g_socket_connection_factory_lookup_type (GSocketFamily family,
|
||||
|
||||
/**
|
||||
* g_socket_connection_factory_create_connection:
|
||||
* @socket: a #GSocket.
|
||||
* @socket: a #GSocket
|
||||
*
|
||||
* Creates a #GSocketConnection subclass of the right type for
|
||||
* @socket.
|
||||
@ -475,7 +483,7 @@ g_socket_connection_factory_lookup_type (GSocketFamily family,
|
||||
* Returns: a #GSocketConnection
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnection *
|
||||
g_socket_connection_factory_create_connection (GSocket *socket)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@
|
||||
* g_socket_receive_message() to read such a message.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gsocketcontrolmessage.h"
|
||||
@ -70,7 +70,7 @@ G_DEFINE_ABSTRACT_TYPE (GSocketControlMessage,
|
||||
* Returns: The number of bytes required.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gsize
|
||||
g_socket_control_message_get_size (GSocketControlMessage *message)
|
||||
{
|
||||
@ -86,10 +86,10 @@ g_socket_control_message_get_size (GSocketControlMessage *message)
|
||||
* Returns the "level" (i.e. the originating protocol) of the control message.
|
||||
* This is often SOL_SOCKET.
|
||||
*
|
||||
* Returns: and int describing the level
|
||||
* Returns: an integer describing the level
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
int
|
||||
g_socket_control_message_get_level (GSocketControlMessage *message)
|
||||
{
|
||||
@ -102,13 +102,13 @@ g_socket_control_message_get_level (GSocketControlMessage *message)
|
||||
* g_socket_control_message_get_msg_type:
|
||||
* @message: a #GSocketControlMessage
|
||||
*
|
||||
* Returns the protocol specify type of the control message.
|
||||
* For instance, for unix fd passing this would be SCM_RIGHTS.
|
||||
* Returns the protocol specific type of the control message.
|
||||
* For instance, for UNIX fd passing this would be SCM_RIGHTS.
|
||||
*
|
||||
* Returns: and int describing the level
|
||||
* Returns: an integer describing the type of control message
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
int
|
||||
g_socket_control_message_get_msg_type (GSocketControlMessage *message)
|
||||
{
|
||||
@ -130,7 +130,7 @@ g_socket_control_message_get_msg_type (GSocketControlMessage *message)
|
||||
* object.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_control_message_serialize (GSocketControlMessage *message,
|
||||
gpointer data)
|
||||
@ -151,6 +151,17 @@ g_socket_control_message_class_init (GSocketControlMessageClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* g_socket_control_message_deserialize:
|
||||
* @level:
|
||||
* @type:
|
||||
* @size:
|
||||
* @data:
|
||||
*
|
||||
* Returns: the deserialized message
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
GSocketControlMessage *
|
||||
g_socket_control_message_deserialize (int level,
|
||||
int type,
|
||||
|
@ -175,7 +175,7 @@ g_socket_listener_init (GSocketListener *listener)
|
||||
* Returns: a new #GSocketListener.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketListener *
|
||||
g_socket_listener_new (void)
|
||||
{
|
||||
@ -215,7 +215,7 @@ check_listener (GSocketListener *listener,
|
||||
* Returns: %TRUE on success, %FALSE on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_listener_add_socket (GSocketListener *listener,
|
||||
GSocket *socket,
|
||||
@ -264,7 +264,7 @@ g_socket_listener_add_socket (GSocketListener *listener,
|
||||
* Returns: %TRUE on success, %FALSE on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_listener_add_address (GSocketListener *listener,
|
||||
GSocketAddress *address,
|
||||
@ -321,7 +321,7 @@ g_socket_listener_add_address (GSocketListener *listener,
|
||||
* Returns: %TRUE on success, %FALSE on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_listener_add_inet_port (GSocketListener *listener,
|
||||
int port,
|
||||
@ -456,14 +456,14 @@ accept_callback (GSocket *socket,
|
||||
* object specified when the corresponding socket or address was added
|
||||
* to the listener.
|
||||
*
|
||||
* If @cancellable is not NULL, then the operation can be cancelled by
|
||||
* If @cancellable is not %NULL, then the operation can be cancelled by
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
|
||||
*
|
||||
* Returns: a #GSocket on success, %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocket *
|
||||
g_socket_listener_accept_socket (GSocketListener *listener,
|
||||
GObject **source_object,
|
||||
@ -530,14 +530,14 @@ g_socket_listener_accept_socket (GSocketListener *listener,
|
||||
* object specified when the corresponding socket or address was added
|
||||
* to the listener.
|
||||
*
|
||||
* If @cancellable is not NULL, then the operation can be cancelled by
|
||||
* If @cancellable is not %NULL, then the operation can be cancelled by
|
||||
* triggering the cancellable object from another thread. If the operation
|
||||
* was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
|
||||
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
|
||||
*
|
||||
* Returns: a #GSocketConnection on success, %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnection *
|
||||
g_socket_listener_accept (GSocketListener *listener,
|
||||
GObject **source_object,
|
||||
@ -617,11 +617,11 @@ accept_ready (GSocket *accept_socket,
|
||||
* This is the asynchronous version of g_socket_listener_accept_socket().
|
||||
*
|
||||
* When the operation is finished @callback will be
|
||||
* called. You can then call g_socket_listener_accept_socket_finish() to get
|
||||
* the result of the operation.
|
||||
* called. You can then call g_socket_listener_accept_socket_finish()
|
||||
* to get the result of the operation.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_listener_accept_socket_async (GSocketListener *listener,
|
||||
GCancellable *cancellable,
|
||||
@ -665,7 +665,7 @@ g_socket_listener_accept_socket_async (GSocketListener *listener,
|
||||
* Returns: a #GSocket on success, %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocket *
|
||||
g_socket_listener_accept_socket_finish (GSocketListener *listener,
|
||||
GAsyncResult *result,
|
||||
@ -702,11 +702,11 @@ g_socket_listener_accept_socket_finish (GSocketListener *listener,
|
||||
* This is the asynchronous version of g_socket_listener_accept().
|
||||
*
|
||||
* When the operation is finished @callback will be
|
||||
* called. You can then call g_socket_listener_accept_socket() to get
|
||||
* the result of the operation.
|
||||
* called. You can then call g_socket_listener_accept_socket()
|
||||
* to get the result of the operation.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_listener_accept_async (GSocketListener *listener,
|
||||
GCancellable *cancellable,
|
||||
@ -732,7 +732,7 @@ g_socket_listener_accept_async (GSocketListener *listener,
|
||||
* Returns: a #GSocketConnection on success, %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketConnection *
|
||||
g_socket_listener_accept_finish (GSocketListener *listener,
|
||||
GAsyncResult *result,
|
||||
@ -764,7 +764,7 @@ g_socket_listener_accept_finish (GSocketListener *listener,
|
||||
* See g_socket_set_listen_backlog() for details
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_listener_set_backlog (GSocketListener *listener,
|
||||
int listen_backlog)
|
||||
@ -791,7 +791,7 @@ g_socket_listener_set_backlog (GSocketListener *listener,
|
||||
* Closes all the sockets in the listener.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_listener_close (GSocketListener *listener)
|
||||
{
|
||||
|
@ -30,7 +30,8 @@
|
||||
*
|
||||
* A #GSocketService is an object that represents a service that is
|
||||
* provided to the network or over local sockets. When a new
|
||||
* connection is made to the service the ::incoming signal is emitted.
|
||||
* connection is made to the service the #GSocketService:incoming
|
||||
* signal is emitted.
|
||||
*
|
||||
* A #GSocketService is a subclass of #GSocketListener and you need
|
||||
* to add the addresses you want to accept connections on to the
|
||||
@ -38,19 +39,19 @@
|
||||
*
|
||||
* There are two options for implementing a network service based on
|
||||
* #GSocketService. The first is to create the service using
|
||||
* g_socket_service_new() and to connect to the ::incoming signal.
|
||||
* The second is to subclass #GSocketService and override the default
|
||||
* signal handler implementation.
|
||||
* g_socket_service_new() and to connect to the #GSocketService:incoming
|
||||
* signal. The second is to subclass #GSocketService and override the
|
||||
* default signal handler implementation.
|
||||
*
|
||||
* In either case, the handler must immediately return, or else it
|
||||
* will block additional incoming connections from being serviced. If
|
||||
* you are interested in writing connection handlers that contain
|
||||
* will block additional incoming connections from being serviced.
|
||||
* If you are interested in writing connection handlers that contain
|
||||
* blocking code then see #GThreadedSocketService.
|
||||
*
|
||||
* The socket service runs on the main loop in the main thread, and is
|
||||
* not threadsafe in general. However, the calls to start and stop
|
||||
* the service are threadsafe so these can be used from threads that
|
||||
* handle incomming clients.
|
||||
* handle incoming clients.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -154,7 +155,7 @@ g_socket_service_changed (GSocketListener *listener)
|
||||
* Returns: %TRUE if the service is active, %FALSE otherwise
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_socket_service_is_active (GSocketService *service)
|
||||
{
|
||||
@ -177,7 +178,7 @@ g_socket_service_is_active (GSocketService *service)
|
||||
* handling an incomming client request.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_service_start (GSocketService *service)
|
||||
{
|
||||
@ -207,7 +208,7 @@ g_socket_service_start (GSocketService *service)
|
||||
* handling an incomming client request.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_socket_service_stop (GSocketService *service)
|
||||
{
|
||||
@ -261,8 +262,10 @@ g_socket_service_class_init (GSocketServiceClass *class)
|
||||
* handling of @connection, but may not block; in essence,
|
||||
* asynchronous operations must be used.
|
||||
*
|
||||
* If %TRUE is returned then no other handlers are called.
|
||||
**/
|
||||
* Returns: %TRUE to stop other handlers from being called
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
g_socket_service_incoming_signal =
|
||||
g_signal_new ("incoming", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GSocketServiceClass, incoming),
|
||||
@ -318,7 +321,7 @@ g_socket_service_ready (GObject *object,
|
||||
* Returns: a new #GSocketService.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
GSocketService *
|
||||
g_socket_service_new (void)
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ typedef struct _GSocketServiceClass GSocketServiceClass;
|
||||
/**
|
||||
* GSocketServiceClass:
|
||||
* @incomming: signal emitted when new connections are accepted
|
||||
**/
|
||||
*/
|
||||
struct _GSocketServiceClass
|
||||
{
|
||||
GSocketListenerClass parent_class;
|
||||
|
@ -50,7 +50,7 @@
|
||||
* to the remote service, you can use #GNetworkService's
|
||||
* #GSocketConnectable interface and not need to worry about
|
||||
* #GSrvTarget at all.
|
||||
**/
|
||||
*/
|
||||
|
||||
struct _GSrvTarget {
|
||||
gchar *hostname;
|
||||
|
@ -25,7 +25,7 @@
|
||||
* Eventually, some TCP-specific socket stuff will be added.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gtcpconnection.h"
|
||||
@ -223,7 +223,9 @@ close_async_data_free (CloseAsyncData *data)
|
||||
}
|
||||
|
||||
static void
|
||||
async_close_finish (CloseAsyncData *data, GError *error, gboolean in_mainloop)
|
||||
async_close_finish (CloseAsyncData *data,
|
||||
GError *error,
|
||||
gboolean in_mainloop)
|
||||
{
|
||||
GIOStreamClass *parent = G_IO_STREAM_CLASS (g_tcp_connection_parent_class);
|
||||
GIOStream *stream;
|
||||
@ -363,7 +365,7 @@ g_tcp_connection_close_async (GIOStream *stream,
|
||||
* take a while. For this reason it is disabled by default.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
void
|
||||
g_tcp_connection_set_graceful_disconnect (GTcpConnection *connection,
|
||||
gboolean graceful_disconnect)
|
||||
@ -386,7 +388,7 @@ g_tcp_connection_set_graceful_disconnect (GTcpConnection *connection,
|
||||
* Returns: %TRUE if graceful disconnect is used on close, %FALSE otherwise
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_tcp_connection_get_graceful_disconnect (GTcpConnection *connection)
|
||||
{
|
||||
|
@ -41,8 +41,8 @@
|
||||
* The service automatically stops the #GSocketService from accepting
|
||||
* new connections when all threads are busy.
|
||||
*
|
||||
* As with #GSocketService, you may connect to ::run, or subclass and
|
||||
* override the default handler.
|
||||
* As with #GSocketService, you may connect to #GThreadedSocketService:run,
|
||||
* or subclass and override the default handler.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@ -229,15 +229,14 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
|
||||
* @service: the #GThreadedSocketService.
|
||||
* @connection: a new #GSocketConnection object.
|
||||
* @source_object: the source_object passed to g_socket_listener_add_address().
|
||||
* @returns: %TRUE if @connection has been handled.
|
||||
*
|
||||
* The ::run signal is emitted in a worker thread in response to an
|
||||
* incoming connection. This thread is dedicated to handling
|
||||
* @connection and may perform blocking IO. The signal handler need
|
||||
* not return until the connection is closed.
|
||||
*
|
||||
* If %TRUE is returned then no other handlers are called.
|
||||
**/
|
||||
* Returns: %TRUE to stope further signal handlers from being called
|
||||
*/
|
||||
g_threaded_socket_service_run_signal =
|
||||
g_signal_new ("run", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GThreadedSocketServiceClass, run),
|
||||
@ -257,13 +256,16 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
|
||||
|
||||
/**
|
||||
* g_threaded_socket_service_new:
|
||||
* @returns: a new #GSocketService.
|
||||
* @max_threads: the maximal number of threads to execute concurrently
|
||||
* handling incomming clients, -1 means no limit
|
||||
* handling incoming clients, -1 means no limit
|
||||
*
|
||||
* Creates a new #GThreadedSocketService with no listeners. Listeners
|
||||
* must be added with g_socket_service_add_listeners().
|
||||
**/
|
||||
*
|
||||
* Returns: a new #GSocketService.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
GSocketService *
|
||||
g_threaded_socket_service_new (int max_threads)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
* functionallity like passing file descriptors.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
|
||||
#include <gio/gsocketcontrolmessage.h>
|
||||
#include <gio/gunixfdmessage.h>
|
||||
@ -48,7 +48,7 @@ G_DEFINE_TYPE_WITH_CODE (GUnixConnection, g_unix_connection,
|
||||
|
||||
/**
|
||||
* g_unix_connection_send_fd:
|
||||
* @connection: a #GUnixConnection.
|
||||
* @connection: a #GUnixConnection
|
||||
* @fd: a file descriptor
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
* @error: #GError for error reporting, or %NULL to ignore.
|
||||
@ -64,7 +64,7 @@ G_DEFINE_TYPE_WITH_CODE (GUnixConnection, g_unix_connection,
|
||||
* Returns: a %TRUE on success, %NULL on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
g_unix_connection_send_fd (GUnixConnection *connection,
|
||||
gint fd,
|
||||
@ -104,13 +104,13 @@ g_unix_connection_send_fd (GUnixConnection *connection,
|
||||
|
||||
/**
|
||||
* g_unix_connection_receive_fd:
|
||||
* @connection: a #GUnixConnection.
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||
* @error: #GError for error reporting, or %NULL to ignore.
|
||||
* @connection: a #GUnixConnection
|
||||
* @cancellable: optional #GCancellable object, %NULL to ignore
|
||||
* @error: #GError for error reporting, or %NULL to ignore
|
||||
*
|
||||
* Recieves a file descriptor from the sending end of the
|
||||
* connection. The sending end has to call g_unix_connection_send_fd()
|
||||
* for this to work.
|
||||
* Receives a file descriptor from the sending end of the connection.
|
||||
* The sending end has to call g_unix_connection_send_fd() for this
|
||||
* to work.
|
||||
*
|
||||
* As well as reading the fd this also reads a single byte from the
|
||||
* stream, as this is required for fd passing to work on some
|
||||
@ -119,7 +119,7 @@ g_unix_connection_send_fd (GUnixConnection *connection,
|
||||
* Returns: a file descriptor on success, -1 on error.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
gint
|
||||
g_unix_connection_receive_fd (GUnixConnection *connection,
|
||||
GCancellable *cancellable,
|
||||
|
@ -46,7 +46,7 @@ G_BEGIN_DECLS
|
||||
* A #GSocketConnection for UNIX domain socket connections.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
*/
|
||||
typedef struct _GUnixConnection GUnixConnection;
|
||||
typedef struct _GUnixConnectionPrivate GUnixConnectionPrivate;
|
||||
typedef struct _GUnixConnectionClass GUnixConnectionClass;
|
||||
|
@ -27,7 +27,7 @@
|
||||
* For an easier way to send and receive file descriptors over
|
||||
* stream-oriented UNIX sockets, see g_unix_connection_send_fd() and
|
||||
* g_unix_connection_receive_fd().
|
||||
**/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
@ -145,10 +145,13 @@ g_unix_fd_message_class_init (GUnixFDMessageClass *class)
|
||||
|
||||
/**
|
||||
* g_unix_fd_message_new:
|
||||
* @returns: a new #GUnixFDMessage
|
||||
*
|
||||
* Creates a new #GUnixFDMessage containing no file descriptors.
|
||||
**/
|
||||
*
|
||||
* Returns: a new #GUnixFDMessage
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
GSocketControlMessage *
|
||||
g_unix_fd_message_new (void)
|
||||
{
|
||||
@ -159,7 +162,6 @@ g_unix_fd_message_new (void)
|
||||
* g_unix_fd_message_steal_fds:
|
||||
* @message: a #GUnixFDMessage
|
||||
* @length: pointer to the length of the returned array, or %NULL
|
||||
* @returns: an array of file descriptors
|
||||
*
|
||||
* Returns the array of file descriptors that is contained in this
|
||||
* object.
|
||||
@ -176,9 +178,13 @@ g_unix_fd_message_new (void)
|
||||
* descriptors in the returned array. The returned array is also
|
||||
* terminated with -1.
|
||||
*
|
||||
* This function never returns NULL. In case there are no file
|
||||
* This function never returns %NULL. In case there are no file
|
||||
* descriptors contained in @message, an empty array is returned.
|
||||
**/
|
||||
*
|
||||
* Returns: an array of file descriptors
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
gint *
|
||||
g_unix_fd_message_steal_fds (GUnixFDMessage *message,
|
||||
gint *length)
|
||||
@ -210,7 +216,6 @@ g_unix_fd_message_steal_fds (GUnixFDMessage *message,
|
||||
* @message: a #GUnixFDMessage
|
||||
* @fd: a valid open file descriptor
|
||||
* @error: a #GError pointer
|
||||
* @returns: %TRUE in case of success, else %FALSE (and @error is set)
|
||||
*
|
||||
* Adds a file descriptor to @message.
|
||||
*
|
||||
@ -220,7 +225,11 @@ g_unix_fd_message_steal_fds (GUnixFDMessage *message,
|
||||
*
|
||||
* A possible cause of failure is exceeding the per-process or
|
||||
* system-wide file descriptor limit.
|
||||
**/
|
||||
*
|
||||
* Returns: %TRUE in case of success, else %FALSE (and @error is set)
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
gboolean
|
||||
g_unix_fd_message_append_fd (GUnixFDMessage *message,
|
||||
gint fd,
|
||||
|
@ -38,14 +38,14 @@
|
||||
* @short_description: Unix #GSocketAddress
|
||||
*
|
||||
* Support for UNIX-domain (aka local) sockets.
|
||||
**/
|
||||
*/
|
||||
|
||||
/**
|
||||
* GUnixSocketAddress:
|
||||
*
|
||||
* A UNIX-domain (local) socket address, corresponding to a
|
||||
* <type>struct sockaddr_un</type>.
|
||||
**/
|
||||
*/
|
||||
G_DEFINE_TYPE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS);
|
||||
|
||||
enum
|
||||
|
Loading…
Reference in New Issue
Block a user