root/trunk/src/gio/UnixSocketAddress.d

Revision 938, 8.8 kB (checked in by Mike Wey, 3 months ago)

Update Gio to 2.28.

Line 
1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23
24 /*
25  * Conversion parameters:
26  * inFile  = GUnixSocketAddress.html
27  * outPack = gio
28  * outFile = UnixSocketAddress
29  * strct   = GUnixSocketAddress
30  * realStrct=
31  * ctorStrct=GSocketAddress
32  * clss    = UnixSocketAddress
33  * interf  =
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  =
38  * implements:
39  * prefixes:
40  *  - g_unix_socket_address_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  *  - glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52
53 module gio.UnixSocketAddress;
54
55 public  import gtkc.giotypes;
56
57 private import gtkc.gio;
58 private import glib.ConstructionException;
59
60
61 private import glib.Str;
62
63
64
65 private import gio.SocketAddress;
66
67 /**
68  * Description
69  * Support for UNIX-domain (also known as local) sockets.
70  * UNIX domain sockets are generally visible in the filesystem.
71  * However, some systems support abstract socket names which are not
72  * visible in the filesystem and not affected by the filesystem
73  * permissions, visibility, etc. Currently this is only supported
74  * under Linux. If you attempt to use abstract sockets on other
75  * systems, function calls may return G_IO_ERROR_NOT_SUPPORTED
76  * errors. You can use g_unix_socket_address_abstract_names_supported()
77  * to see if abstract names are supported.
78  * Note that <gio/gunixsocketaddress.h> belongs to
79  * the UNIX-specific GIO interfaces, thus you have to use the
80  * gio-unix-2.0.pc pkg-config file when using it.
81  */
82 public class UnixSocketAddress : SocketAddress
83 {
84    
85     /** the main Gtk struct */
86     protected GUnixSocketAddress* gUnixSocketAddress;
87    
88    
89     public GUnixSocketAddress* getUnixSocketAddressStruct()
90     {
91         return gUnixSocketAddress;
92     }
93    
94    
95     /** the main Gtk struct as a void* */
96     protected override void* getStruct()
97     {
98         return cast(void*)gUnixSocketAddress;
99     }
100    
101     /**
102      * Sets our main struct and passes it to the parent class
103      */
104     public this (GUnixSocketAddress* gUnixSocketAddress)
105     {
106         if(gUnixSocketAddress is null)
107         {
108             this = null;
109             return;
110         }
111         //Check if there already is a D object for this gtk struct
112         void* ptr = getDObject(cast(GObject*)gUnixSocketAddress);
113         if( ptr !is null )
114         {
115             this = cast(UnixSocketAddress)ptr;
116             return;
117         }
118         super(cast(GSocketAddress*)gUnixSocketAddress);
119         this.gUnixSocketAddress = gUnixSocketAddress;
120     }
121    
122     protected override void setStruct(GObject* obj)
123     {
124         super.setStruct(obj);
125         gUnixSocketAddress = cast(GUnixSocketAddress*)obj;
126     }
127    
128     /**
129      */
130    
131     /**
132      * Creates a new GUnixSocketAddress for path.
133      * To create abstract socket addresses, on systems that support that,
134      * use g_unix_socket_address_new_abstract().
135      * Since 2.22
136      * Params:
137      * path = the socket path
138      * Throws: ConstructionException GTK+ fails to create the object.
139      */
140     public this (string path)
141     {
142         // GSocketAddress * g_unix_socket_address_new (const gchar *path);
143         auto p = g_unix_socket_address_new(Str.toStringz(path));
144         if(p is null)
145         {
146             throw new ConstructionException("null returned by g_unix_socket_address_new(Str.toStringz(path))");
147         }
148         this(cast(GUnixSocketAddress*) p);
149     }
150    
151     /**
152      * Warning
153      * g_unix_socket_address_new_abstract is deprecated and should not be used in newly-written code. Use g_unix_socket_address_new_with_type().
154      * Creates a new G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED
155      * GUnixSocketAddress for path.
156      * Params:
157      * path = the abstract name. [array length=path_len][element-type gchar]
158      * pathLen = the length of path, or -1
159      * Throws: ConstructionException GTK+ fails to create the object.
160      */
161     public this (string path, int pathLen)
162     {
163         // GSocketAddress * g_unix_socket_address_new_abstract (const gchar *path,  gint path_len);
164         auto p = g_unix_socket_address_new_abstract(Str.toStringz(path), pathLen);
165         if(p is null)
166         {
167             throw new ConstructionException("null returned by g_unix_socket_address_new_abstract(Str.toStringz(path), pathLen)");
168         }
169         this(cast(GUnixSocketAddress*) p);
170     }
171    
172     /**
173      * Creates a new GUnixSocketAddress of type type with name path.
174      * If type is G_UNIX_SOCKET_ADDRESS_PATH, this is equivalent to
175      * calling g_unix_socket_address_new().
176      * If path_type is G_UNIX_SOCKET_ADDRESS_ABSTRACT, then path_len
177      * bytes of path will be copied to the socket's path, and only those
178      * bytes will be considered part of the name. (If path_len is -1,
179      * then path is assumed to be NUL-terminated.) For example, if path
180      * was "test", then calling g_socket_address_get_native_size() on the
181      * returned socket would return 7 (2 bytes of overhead, 1 byte for the
182      * abstract-socket indicator byte, and 4 bytes for the name "test").
183      * If path_type is G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED, then
184      * path_len bytes of path will be copied to the socket's path, the
185      * rest of the path will be padded with 0 bytes, and the entire
186      * zero-padded buffer will be considered the name. (As above, if
187      * path_len is -1, then path is assumed to be NUL-terminated.) In
188      * this case, g_socket_address_get_native_size() will always return
189      * the full size of a struct sockaddr_un, although
190      * g_unix_socket_address_get_path_len() will still return just the
191      * length of path.
192      * G_UNIX_SOCKET_ADDRESS_ABSTRACT is preferred over
193      * G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED for new programs. Of course,
194      * when connecting to a server created by another process, you must
195      * use the appropriate type corresponding to how that process created
196      * its listening socket.
197      * Since 2.26
198      * Params:
199      * path = the name. [array length=path_len][element-type gchar]
200      * type = a GUnixSocketAddressType
201      * Throws: ConstructionException GTK+ fails to create the object.
202      */
203     public this (char[] path, GUnixSocketAddressType type)
204     {
205         // GSocketAddress * g_unix_socket_address_new_with_type (const gchar *path,  gint path_len,  GUnixSocketAddressType type);
206         auto p = g_unix_socket_address_new_with_type(path.ptr, cast(int) path.length, type);
207         if(p is null)
208         {
209             throw new ConstructionException("null returned by g_unix_socket_address_new_with_type(path.ptr, cast(int) path.length, type)");
210         }
211         this(cast(GUnixSocketAddress*) p);
212     }
213    
214     /**
215      * Warning
216      * g_unix_socket_address_get_is_abstract is deprecated and should not be used in newly-written code. Use g_unix_socket_address_get_address_type()
217      * Tests if address is abstract.
218      * Since 2.22
219      * Returns: TRUE if the address is abstract, FALSE otherwise
220      */
221     public int getIsAbstract()
222     {
223         // gboolean g_unix_socket_address_get_is_abstract  (GUnixSocketAddress *address);
224         return g_unix_socket_address_get_is_abstract(gUnixSocketAddress);
225     }
226    
227     /**
228      * Gets address's type.
229      * Since 2.26
230      * Returns: a GUnixSocketAddressType
231      */
232     public GUnixSocketAddressType getAddressType()
233     {
234         // GUnixSocketAddressType g_unix_socket_address_get_address_type  (GUnixSocketAddress *address);
235         return g_unix_socket_address_get_address_type(gUnixSocketAddress);
236     }
237    
238     /**
239      * Gets address's path, or for abstract sockets the "name".
240      * Guaranteed to be zero-terminated, but an abstract socket
241      * may contain embedded zeros, and thus you should use
242      * g_unix_socket_address_get_path_len() to get the true length
243      * of this string.
244      * Since 2.22
245      * Returns: the path for address
246      */
247     public string getPath()
248     {
249         // const char * g_unix_socket_address_get_path (GUnixSocketAddress *address);
250         return Str.toString(g_unix_socket_address_get_path(gUnixSocketAddress));
251     }
252    
253     /**
254      * Gets the length of address's path.
255      * For details, see g_unix_socket_address_get_path().
256      * Since 2.22
257      * Returns: the length of the path
258      */
259     public gsize getPathLen()
260     {
261         // gsize g_unix_socket_address_get_path_len (GUnixSocketAddress *address);
262         return g_unix_socket_address_get_path_len(gUnixSocketAddress);
263     }
264    
265     /**
266      * Checks if abstract unix domain socket names are supported.
267      * Since 2.22
268      * Returns: TRUE if supported, FALSE otherwise
269      */
270     public static int abstractNamesSupported()
271     {
272         // gboolean g_unix_socket_address_abstract_names_supported  (void);
273         return g_unix_socket_address_abstract_names_supported();
274     }
275 }
Note: See TracBrowser for help on using the browser.