+/**
+ * g_unix_socket_address_new_abstract:
+ * @path: (array length=path_len) (element-type gchar): the abstract name
+ * @path_len: the length of @path, or -1
+ *
+ * Creates a new %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED
+ * #GUnixSocketAddress for @path.
+ *
+ * Returns: a new #GUnixSocketAddress
+ *
+ * Deprecated: Use g_unix_socket_address_new_with_type().
+ */
+GSocketAddress *
+g_unix_socket_address_new_abstract (const gchar *path,
+ gint path_len)
+{
+ return g_unix_socket_address_new_with_type (path, path_len,
+ G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED);
+}
+
+/**
+ * g_unix_socket_address_new_with_type:
+ * @path: (array length=path_len) (element-type gchar): the name
+ * @path_len: the length of @path, or -1
+ * @type: a #GUnixSocketAddressType
+ *
+ * Creates a new #GUnixSocketAddress of type @type with name @path.
+ *
+ * If @type is %G_UNIX_SOCKET_ADDRESS_PATH, this is equivalent to
+ * calling g_unix_socket_address_new().
+ *
+ * If @path_type is %G_UNIX_SOCKET_ADDRESS_ABSTRACT, then @path_len
+ * bytes of @path will be copied to the socket's path, and only those
+ * bytes will be considered part of the name. (If @path_len is -1,
+ * then @path is assumed to be NUL-terminated.) For example, if @path
+ * was "test", then calling g_socket_address_get_native_size() on the
+ * returned socket would return 7 (2 bytes of overhead, 1 byte for the
+ * abstract-socket indicator byte, and 4 bytes for the name "test").
+ *
+ * If @path_type is %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED, then
+ * @path_len bytes of @path will be copied to the socket's path, the
+ * rest of the path will be padded with 0 bytes, and the entire
+ * zero-padded buffer will be considered the name. (As above, if
+ * @path_len is -1, then @path is assumed to be NUL-terminated.) In
+ * this case, g_socket_address_get_native_size() will always return
+ * the full size of a `struct sockaddr_un`, although
+ * g_unix_socket_address_get_path_len() will still return just the
+ * length of @path.
+ *
+ * %G_UNIX_SOCKET_ADDRESS_ABSTRACT is preferred over
+ * %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED for new programs. Of course,
+ * when connecting to a server created by another process, you must
+ * use the appropriate type corresponding to how that process created
+ * its listening socket.
+ *
+ * Returns: a new #GUnixSocketAddress
+ *
+ * Since: 2.26
+ */
+GSocketAddress *
+g_unix_socket_address_new_with_type (const gchar *path,
+ gint path_len,
+ GUnixSocketAddressType type)
+{
+ GSocketAddress *address;
+ GByteArray *array;
+
+ if (type == G_UNIX_SOCKET_ADDRESS_ANONYMOUS)
+ path_len = 0;
+ else if (path_len == -1)
+ path_len = strlen (path);
+
+ array = g_byte_array_sized_new (path_len);
+
+ g_byte_array_append (array, (guint8 *)path, path_len);
+
+ address = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS,
+ "path-as-array", array,
+ "address-type", type,
+ NULL);
+
+ g_byte_array_unref (array);
+
+ return address;
+}
+
+/**
+ * g_unix_socket_address_get_path:
+ * @address: a #GInetSocketAddress
+ *
+ * Gets @address's path, or for abstract sockets the "name".
+ *
+ * Guaranteed to be zero-terminated, but an abstract socket
+ * may contain embedded zeros, and thus you should use
+ * g_unix_socket_address_get_path_len() to get the true length
+ * of this string.
+ *
+ * Returns: the path for @address
+ *
+ * Since: 2.22
+ */
+const char *
+g_unix_socket_address_get_path (GUnixSocketAddress *address)
+{
+ return address->priv->path;
+}
+
+/**
+ * g_unix_socket_address_get_path_len:
+ * @address: a #GInetSocketAddress
+ *
+ * Gets the length of @address's path.
+ *
+ * For details, see g_unix_socket_address_get_path().
+ *
+ * Returns: the length of the path
+ *
+ * Since: 2.22
+ */
+gsize
+g_unix_socket_address_get_path_len (GUnixSocketAddress *address)
+{
+ return address->priv->path_len;
+}
+
+/**
+ * g_unix_socket_address_get_address_type:
+ * @address: a #GInetSocketAddress
+ *
+ * Gets @address's type.
+ *
+ * Returns: a #GUnixSocketAddressType
+ *
+ * Since: 2.26
+ */
+GUnixSocketAddressType
+g_unix_socket_address_get_address_type (GUnixSocketAddress *address)
+{
+ return address->priv->address_type;
+}
+
+/**
+ * g_unix_socket_address_get_is_abstract:
+ * @address: a #GInetSocketAddress
+ *
+ * Tests if @address is abstract.
+ *
+ * Returns: %TRUE if the address is abstract, %FALSE otherwise
+ *
+ * Since: 2.22
+ *
+ * Deprecated: Use g_unix_socket_address_get_address_type()
+ */
+gboolean
+g_unix_socket_address_get_is_abstract (GUnixSocketAddress *address)
+{
+ return (address->priv->address_type == G_UNIX_SOCKET_ADDRESS_ABSTRACT ||
+ address->priv->address_type == G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED);
+}
+
+/**
+ * g_unix_socket_address_abstract_names_supported:
+ *
+ * Checks if abstract UNIX domain socket names are supported.
+ *
+ * Returns: %TRUE if supported, %FALSE otherwise
+ *
+ * Since: 2.22
+ */
+gboolean
+g_unix_socket_address_abstract_names_supported (void)
+{
+#ifdef __linux__
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}