#include "config.h"
#include "gsocketcontrolmessage.h"
+#include "gnetworkingprivate.h"
#include "glibintl.h"
#ifndef G_OS_WIN32
+#include "gunixcredentialsmessage.h"
#include "gunixfdmessage.h"
-#include <sys/socket.h>
-#else
-# include <winsock2.h>
-# include <mswsock.h>
#endif
-#include "gioalias.h"
G_DEFINE_ABSTRACT_TYPE (GSocketControlMessage,
g_socket_control_message,
/**
* g_socket_control_message_deserialize:
- * @level:
- * @type:
- * @size:
- * @data:
+ * @level: a socket level
+ * @type: a socket control message type for the given @level
+ * @size: the size of the data in bytes
+ * @data: pointer to the message data
*
- * Returns: the deserialized message
+ * Tries to deserialize a socket control message of a given
+ * @level and @type. This will ask all known (to GType) subclasses
+ * of #GSocketControlMessage if they can understand this kind
+ * of message and if so deserialize it into a #GSocketControlMessage.
+ *
+ * If there is no implementation for this kind of control message, %NULL
+ * will be returned.
+ *
+ * Returns: the deserialized message or %NULL
*
* Since: 2.22
*/
gsize size,
gpointer data)
{
- GSocketControlMessageClass *klass;
GSocketControlMessage *message;
GType *message_types;
guint n_message_types;
/* Ensure we know about the built in types */
#ifndef G_OS_WIN32
+ a_type = g_unix_credentials_message_get_type ();
a_type = g_unix_fd_message_get_type ();
#endif
message = NULL;
for (i = 0; i < n_message_types; i++)
{
- klass = (GSocketControlMessageClass *)g_type_class_ref (type);
+ GSocketControlMessageClass *class;
- if (klass && klass->deserialize)
- {
- message = klass->deserialize (level, type, size, data);
- g_type_class_unref ((GTypeClass *) klass);
- }
+ class = g_type_class_ref (message_types[i]);
+ message = class->deserialize (level, type, size, data);
+ g_type_class_unref (class);
if (message != NULL)
- break;
+ break;
}
g_free (message_types);
return message;
}
-
-#define __G_SOCKET_CONTROL_MESSAGE_C__
-#include "gioaliasdef.c"