gsocketcontrolmessage.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright © 2009 Codethink Limited
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General
  18. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * Authors: Ryan Lortie <desrt@desrt.ca>
  21. */
  22. #ifndef __G_SOCKET_CONTROL_MESSAGE_H__
  23. #define __G_SOCKET_CONTROL_MESSAGE_H__
  24. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  25. #error "Only <gio/gio.h> can be included directly."
  26. #endif
  27. #include <gio/giotypes.h>
  28. G_BEGIN_DECLS
  29. #define G_TYPE_SOCKET_CONTROL_MESSAGE (g_socket_control_message_get_type ())
  30. #define G_SOCKET_CONTROL_MESSAGE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  31. G_TYPE_SOCKET_CONTROL_MESSAGE, \
  32. GSocketControlMessage))
  33. #define G_SOCKET_CONTROL_MESSAGE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
  34. G_TYPE_SOCKET_CONTROL_MESSAGE, \
  35. GSocketControlMessageClass))
  36. #define G_IS_SOCKET_CONTROL_MESSAGE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
  37. G_TYPE_SOCKET_CONTROL_MESSAGE))
  38. #define G_IS_SOCKET_CONTROL_MESSAGE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
  39. G_TYPE_SOCKET_CONTROL_MESSAGE))
  40. #define G_SOCKET_CONTROL_MESSAGE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
  41. G_TYPE_SOCKET_CONTROL_MESSAGE, \
  42. GSocketControlMessageClass))
  43. typedef struct _GSocketControlMessagePrivate GSocketControlMessagePrivate;
  44. typedef struct _GSocketControlMessageClass GSocketControlMessageClass;
  45. /**
  46. * GSocketControlMessageClass:
  47. * @get_size: gets the size of the message.
  48. * @get_level: gets the protocol of the message.
  49. * @get_type: gets the protocol specific type of the message.
  50. * @serialize: Writes out the message data.
  51. * @deserialize: Tries to deserialize a message.
  52. *
  53. * Class structure for #GSocketControlMessage.
  54. **/
  55. struct _GSocketControlMessageClass
  56. {
  57. GObjectClass parent_class;
  58. gsize (* get_size) (GSocketControlMessage *message);
  59. int (* get_level) (GSocketControlMessage *message);
  60. int (* get_type) (GSocketControlMessage *message);
  61. void (* serialize) (GSocketControlMessage *message,
  62. gpointer data);
  63. GSocketControlMessage *(* deserialize) (int level,
  64. int type,
  65. gsize size,
  66. gpointer data);
  67. /*< private >*/
  68. /* Padding for future expansion */
  69. void (*_g_reserved1) (void);
  70. void (*_g_reserved2) (void);
  71. void (*_g_reserved3) (void);
  72. void (*_g_reserved4) (void);
  73. void (*_g_reserved5) (void);
  74. };
  75. struct _GSocketControlMessage
  76. {
  77. GObject parent_instance;
  78. GSocketControlMessagePrivate *priv;
  79. };
  80. GIO_AVAILABLE_IN_ALL
  81. GType g_socket_control_message_get_type (void) G_GNUC_CONST;
  82. GIO_AVAILABLE_IN_ALL
  83. gsize g_socket_control_message_get_size (GSocketControlMessage *message);
  84. GIO_AVAILABLE_IN_ALL
  85. int g_socket_control_message_get_level (GSocketControlMessage *message);
  86. GIO_AVAILABLE_IN_ALL
  87. int g_socket_control_message_get_msg_type (GSocketControlMessage *message);
  88. GIO_AVAILABLE_IN_ALL
  89. void g_socket_control_message_serialize (GSocketControlMessage *message,
  90. gpointer data);
  91. GIO_AVAILABLE_IN_ALL
  92. GSocketControlMessage *g_socket_control_message_deserialize (int level,
  93. int type,
  94. gsize size,
  95. gpointer data);
  96. G_END_DECLS
  97. #endif /* __G_SOCKET_CONTROL_MESSAGE_H__ */