gsocketcontrolmessage.h 4.7 KB

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