Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:59

0001 /*
0002  * Copyright © 2008 Christian Kellner, Samuel Cormier-Iijima
0003  * Copyright © 2009 Codethink Limited
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-or-later
0006  *
0007  * This library is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU Lesser General Public
0009  * License as published by the Free Software Foundation; either
0010  * version 2.1 of the License, or (at your option) any later version.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General
0018  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
0019  *
0020  * Authors: Christian Kellner <gicmo@gnome.org>
0021  *          Samuel Cormier-Iijima <sciyoshi@gmail.com>
0022  *          Ryan Lortie <desrt@desrt.ca>
0023  */
0024 
0025 #ifndef __G_SOCKET_H__
0026 #define __G_SOCKET_H__
0027 
0028 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
0029 #error "Only <gio/gio.h> can be included directly."
0030 #endif
0031 
0032 #include <gio/giotypes.h>
0033 
0034 G_BEGIN_DECLS
0035 
0036 #define G_TYPE_SOCKET                                       (g_socket_get_type ())
0037 #define G_SOCKET(inst)                                      (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
0038                                                              G_TYPE_SOCKET, GSocket))
0039 #define G_SOCKET_CLASS(class)                               (G_TYPE_CHECK_CLASS_CAST ((class),                       \
0040                                                              G_TYPE_SOCKET, GSocketClass))
0041 #define G_IS_SOCKET(inst)                                   (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
0042                                                              G_TYPE_SOCKET))
0043 #define G_IS_SOCKET_CLASS(class)                            (G_TYPE_CHECK_CLASS_TYPE ((class),                       \
0044                                                              G_TYPE_SOCKET))
0045 #define G_SOCKET_GET_CLASS(inst)                            (G_TYPE_INSTANCE_GET_CLASS ((inst),                      \
0046                                                              G_TYPE_SOCKET, GSocketClass))
0047 
0048 typedef struct _GSocketPrivate                              GSocketPrivate;
0049 typedef struct _GSocketClass                                GSocketClass;
0050 
0051 struct _GSocketClass
0052 {
0053   GObjectClass parent_class;
0054 
0055   /*< private >*/
0056 
0057   /* Padding for future expansion */
0058   void (*_g_reserved1) (void);
0059   void (*_g_reserved2) (void);
0060   void (*_g_reserved3) (void);
0061   void (*_g_reserved4) (void);
0062   void (*_g_reserved5) (void);
0063   void (*_g_reserved6) (void);
0064   void (*_g_reserved7) (void);
0065   void (*_g_reserved8) (void);
0066   void (*_g_reserved9) (void);
0067   void (*_g_reserved10) (void);
0068 };
0069 
0070 struct _GSocket
0071 {
0072   GObject parent_instance;
0073   GSocketPrivate *priv;
0074 };
0075 
0076 GIO_AVAILABLE_IN_ALL
0077 GType                  g_socket_get_type                (void) G_GNUC_CONST;
0078 GIO_AVAILABLE_IN_ALL
0079 GSocket *              g_socket_new                     (GSocketFamily            family,
0080                              GSocketType              type,
0081                              GSocketProtocol          protocol,
0082                              GError                 **error);
0083 GIO_AVAILABLE_IN_ALL
0084 GSocket *              g_socket_new_from_fd             (gint                     fd,
0085                              GError                 **error);
0086 GIO_AVAILABLE_IN_ALL
0087 int                    g_socket_get_fd                  (GSocket                 *socket);
0088 GIO_AVAILABLE_IN_ALL
0089 GSocketFamily          g_socket_get_family              (GSocket                 *socket);
0090 GIO_AVAILABLE_IN_ALL
0091 GSocketType            g_socket_get_socket_type         (GSocket                 *socket);
0092 GIO_AVAILABLE_IN_ALL
0093 GSocketProtocol        g_socket_get_protocol            (GSocket                 *socket);
0094 GIO_AVAILABLE_IN_ALL
0095 GSocketAddress *       g_socket_get_local_address       (GSocket                 *socket,
0096                              GError                 **error);
0097 GIO_AVAILABLE_IN_ALL
0098 GSocketAddress *       g_socket_get_remote_address      (GSocket                 *socket,
0099                              GError                 **error);
0100 GIO_AVAILABLE_IN_ALL
0101 void                   g_socket_set_blocking            (GSocket                 *socket,
0102                              gboolean                 blocking);
0103 GIO_AVAILABLE_IN_ALL
0104 gboolean               g_socket_get_blocking            (GSocket                 *socket);
0105 GIO_AVAILABLE_IN_ALL
0106 void                   g_socket_set_keepalive           (GSocket                 *socket,
0107                              gboolean                 keepalive);
0108 GIO_AVAILABLE_IN_ALL
0109 gboolean               g_socket_get_keepalive           (GSocket                 *socket);
0110 GIO_AVAILABLE_IN_ALL
0111 gint                   g_socket_get_listen_backlog      (GSocket                 *socket);
0112 GIO_AVAILABLE_IN_ALL
0113 void                   g_socket_set_listen_backlog      (GSocket                 *socket,
0114                              gint                     backlog);
0115 GIO_AVAILABLE_IN_ALL
0116 guint                  g_socket_get_timeout             (GSocket                 *socket);
0117 GIO_AVAILABLE_IN_ALL
0118 void                   g_socket_set_timeout             (GSocket                 *socket,
0119                              guint                    timeout);
0120 
0121 GIO_AVAILABLE_IN_2_32
0122 guint                  g_socket_get_ttl                 (GSocket                 *socket);
0123 GIO_AVAILABLE_IN_2_32
0124 void                   g_socket_set_ttl                 (GSocket                 *socket,
0125                                                          guint                    ttl);
0126 
0127 GIO_AVAILABLE_IN_2_32
0128 gboolean               g_socket_get_broadcast           (GSocket                 *socket);
0129 GIO_AVAILABLE_IN_2_32
0130 void                   g_socket_set_broadcast           (GSocket                 *socket,
0131                                                          gboolean         broadcast);
0132 
0133 GIO_AVAILABLE_IN_2_32
0134 gboolean               g_socket_get_multicast_loopback  (GSocket                 *socket);
0135 GIO_AVAILABLE_IN_2_32
0136 void                   g_socket_set_multicast_loopback  (GSocket                 *socket,
0137                                                          gboolean         loopback);
0138 GIO_AVAILABLE_IN_2_32
0139 guint                  g_socket_get_multicast_ttl       (GSocket                 *socket);
0140 GIO_AVAILABLE_IN_2_32
0141 void                   g_socket_set_multicast_ttl       (GSocket                 *socket,
0142                                                          guint                    ttl);
0143 GIO_AVAILABLE_IN_ALL
0144 gboolean               g_socket_is_connected            (GSocket                 *socket);
0145 GIO_AVAILABLE_IN_ALL
0146 gboolean               g_socket_bind                    (GSocket                 *socket,
0147                              GSocketAddress          *address,
0148                              gboolean                 allow_reuse,
0149                              GError                 **error);
0150 GIO_AVAILABLE_IN_2_32
0151 gboolean               g_socket_join_multicast_group    (GSocket                 *socket,
0152                                                          GInetAddress            *group,
0153                                                          gboolean                 source_specific,
0154                                                          const gchar             *iface,
0155                                                          GError                 **error);
0156 GIO_AVAILABLE_IN_2_32
0157 gboolean               g_socket_leave_multicast_group   (GSocket                 *socket,
0158                                                          GInetAddress            *group,
0159                                                          gboolean                 source_specific,
0160                                                          const gchar             *iface,
0161                                                          GError                 **error);
0162 GIO_AVAILABLE_IN_2_56
0163 gboolean               g_socket_join_multicast_group_ssm    (GSocket                 *socket,
0164                                                              GInetAddress            *group,
0165                                                              GInetAddress            *source_specific,
0166                                                              const gchar             *iface,
0167                                                              GError                 **error);
0168 GIO_AVAILABLE_IN_2_56
0169 gboolean               g_socket_leave_multicast_group_ssm   (GSocket                 *socket,
0170                                                              GInetAddress            *group,
0171                                                              GInetAddress            *source_specific,
0172                                                              const gchar             *iface,
0173                                                              GError                 **error);
0174 GIO_AVAILABLE_IN_ALL
0175 gboolean               g_socket_connect                 (GSocket                 *socket,
0176                              GSocketAddress          *address,
0177                              GCancellable            *cancellable,
0178                              GError                 **error);
0179 GIO_AVAILABLE_IN_ALL
0180 gboolean               g_socket_check_connect_result    (GSocket                 *socket,
0181                              GError                 **error);
0182 
0183 GIO_AVAILABLE_IN_ALL
0184 gssize                 g_socket_get_available_bytes     (GSocket                 *socket);
0185 
0186 GIO_AVAILABLE_IN_ALL
0187 GIOCondition           g_socket_condition_check         (GSocket                 *socket,
0188                              GIOCondition             condition);
0189 GIO_AVAILABLE_IN_ALL
0190 gboolean               g_socket_condition_wait          (GSocket                 *socket,
0191                              GIOCondition             condition,
0192                              GCancellable            *cancellable,
0193                              GError                 **error);
0194 GIO_AVAILABLE_IN_2_32
0195 gboolean               g_socket_condition_timed_wait    (GSocket                 *socket,
0196                              GIOCondition             condition,
0197                              gint64                   timeout_us,
0198                              GCancellable            *cancellable,
0199                              GError                 **error);
0200 GIO_AVAILABLE_IN_ALL
0201 GSocket *              g_socket_accept                  (GSocket                 *socket,
0202                              GCancellable            *cancellable,
0203                              GError                 **error);
0204 GIO_AVAILABLE_IN_ALL
0205 gboolean               g_socket_listen                  (GSocket                 *socket,
0206                              GError                 **error);
0207 GIO_AVAILABLE_IN_ALL
0208 gssize                 g_socket_receive                 (GSocket                 *socket,
0209                              gchar                   *buffer,
0210                              gsize                    size,
0211                              GCancellable            *cancellable,
0212                              GError                 **error);
0213 GIO_AVAILABLE_IN_2_80
0214 GBytes *               g_socket_receive_bytes           (GSocket                 *socket,
0215                                                          gsize                    size,
0216                                                          gint64                   timeout_us,
0217                                                          GCancellable            *cancellable,
0218                                                          GError                 **error);
0219 GIO_AVAILABLE_IN_ALL
0220 gssize                 g_socket_receive_from            (GSocket                 *socket,
0221                              GSocketAddress         **address,
0222                              gchar                   *buffer,
0223                              gsize                    size,
0224                              GCancellable            *cancellable,
0225                              GError                 **error);
0226 GIO_AVAILABLE_IN_2_80
0227 GBytes *               g_socket_receive_bytes_from      (GSocket                 *socket,
0228                                                          GSocketAddress         **address,
0229                                                          gsize                    size,
0230                                                          gint64                   timeout_us,
0231                                                          GCancellable            *cancellable,
0232                                                          GError                 **error);
0233 GIO_AVAILABLE_IN_ALL
0234 gssize                 g_socket_send                    (GSocket                 *socket,
0235                              const gchar             *buffer,
0236                              gsize                    size,
0237                              GCancellable            *cancellable,
0238                              GError                 **error);
0239 GIO_AVAILABLE_IN_ALL
0240 gssize                 g_socket_send_to                 (GSocket                 *socket,
0241                              GSocketAddress          *address,
0242                              const gchar             *buffer,
0243                              gsize                    size,
0244                              GCancellable            *cancellable,
0245                              GError                 **error);
0246 GIO_AVAILABLE_IN_ALL
0247 gssize                 g_socket_receive_message         (GSocket                 *socket,
0248                              GSocketAddress         **address,
0249                              GInputVector            *vectors,
0250                              gint                     num_vectors,
0251                              GSocketControlMessage ***messages,
0252                              gint                    *num_messages,
0253                              gint                    *flags,
0254                              GCancellable            *cancellable,
0255                              GError                 **error);
0256 GIO_AVAILABLE_IN_ALL
0257 gssize                 g_socket_send_message            (GSocket                 *socket,
0258                              GSocketAddress          *address,
0259                              GOutputVector           *vectors,
0260                              gint                     num_vectors,
0261                              GSocketControlMessage  **messages,
0262                              gint                     num_messages,
0263                              gint                     flags,
0264                              GCancellable            *cancellable,
0265                              GError                 **error);
0266 
0267 GIO_AVAILABLE_IN_2_48
0268 gint                   g_socket_receive_messages        (GSocket                 *socket,
0269                                                          GInputMessage           *messages,
0270                                                          guint                    num_messages,
0271                                                          gint                     flags,
0272                                                          GCancellable            *cancellable,
0273                                                          GError                 **error);
0274 GIO_AVAILABLE_IN_2_44
0275 gint                   g_socket_send_messages           (GSocket                 *socket,
0276                              GOutputMessage          *messages,
0277                              guint                    num_messages,
0278                              gint                     flags,
0279                              GCancellable            *cancellable,
0280                              GError                 **error);
0281 
0282 GIO_AVAILABLE_IN_ALL
0283 gboolean               g_socket_close                   (GSocket                 *socket,
0284                              GError                 **error);
0285 GIO_AVAILABLE_IN_ALL
0286 gboolean               g_socket_shutdown                (GSocket                 *socket,
0287                              gboolean                 shutdown_read,
0288                              gboolean                 shutdown_write,
0289                              GError                 **error);
0290 GIO_AVAILABLE_IN_ALL
0291 gboolean               g_socket_is_closed               (GSocket                 *socket);
0292 GIO_AVAILABLE_IN_ALL
0293 GSource *              g_socket_create_source           (GSocket                 *socket,
0294                              GIOCondition             condition,
0295                              GCancellable            *cancellable);
0296 GIO_AVAILABLE_IN_ALL
0297 gboolean               g_socket_speaks_ipv4             (GSocket                 *socket);
0298 GIO_AVAILABLE_IN_ALL
0299 GCredentials          *g_socket_get_credentials         (GSocket                 *socket,
0300                                                          GError                 **error);
0301 
0302 GIO_AVAILABLE_IN_ALL
0303 gssize                 g_socket_receive_with_blocking   (GSocket                 *socket,
0304                              gchar                   *buffer,
0305                              gsize                    size,
0306                              gboolean                 blocking,
0307                              GCancellable            *cancellable,
0308                              GError                 **error);
0309 GIO_AVAILABLE_IN_ALL
0310 gssize                 g_socket_send_with_blocking      (GSocket                 *socket,
0311                              const gchar             *buffer,
0312                              gsize                    size,
0313                              gboolean                 blocking,
0314                              GCancellable            *cancellable,
0315                              GError                 **error);
0316 GIO_AVAILABLE_IN_2_60
0317 GPollableReturn        g_socket_send_message_with_timeout (GSocket                *socket,
0318                                GSocketAddress         *address,
0319                                const GOutputVector    *vectors,
0320                                gint                    num_vectors,
0321                                GSocketControlMessage **messages,
0322                                gint                    num_messages,
0323                                gint                    flags,
0324                                gint64                  timeout_us,
0325                                gsize                  *bytes_written,
0326                                GCancellable           *cancellable,
0327                                GError                **error);
0328 GIO_AVAILABLE_IN_2_36
0329 gboolean               g_socket_get_option              (GSocket                 *socket,
0330                              gint                     level,
0331                              gint                     optname,
0332                              gint                    *value,
0333                              GError                 **error);
0334 GIO_AVAILABLE_IN_2_36
0335 gboolean               g_socket_set_option              (GSocket                 *socket,
0336                              gint                     level,
0337                              gint                     optname,
0338                              gint                     value,
0339                              GError                 **error);
0340 
0341 G_END_DECLS
0342 
0343 #endif /* __G_SOCKET_H__ */