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 = GUnixCredentialsMessage.html 27 * outPack = gio 28 * outFile = UnixCredentialsMessage 29 * strct = GUnixCredentialsMessage 30 * realStrct= 31 * ctorStrct=GSocketControlMessage 32 * clss = UnixCredentialsMessage 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_unix_credentials_message_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gio.Credentials 47 * structWrap: 48 * - GCredentials* -> Credentials 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module gio.UnixCredentialsMessage; 55 56 public import gtkc.giotypes; 57 58 private import gtkc.gio; 59 private import glib.ConstructionException; 60 private import gobject.ObjectG; 61 62 private import gio.Credentials; 63 64 65 private import gio.SocketControlMessage; 66 67 /** 68 * This GSocketControlMessage contains a GCredentials instance. It 69 * may be sent using g_socket_send_message() and received using 70 * g_socket_receive_message() over UNIX sockets (ie: sockets in the 71 * G_SOCKET_FAMILY_UNIX family). 72 * 73 * For an easier way to send and receive credentials over 74 * stream-oriented UNIX sockets, see 75 * g_unix_connection_send_credentials() and 76 * g_unix_connection_receive_credentials(). To receive credentials of 77 * a foreign process connected to a socket, use 78 * g_socket_get_credentials(). 79 */ 80 public class UnixCredentialsMessage : SocketControlMessage 81 { 82 83 /** the main Gtk struct */ 84 protected GUnixCredentialsMessage* gUnixCredentialsMessage; 85 86 87 /** Get the main Gtk struct */ 88 public GUnixCredentialsMessage* getUnixCredentialsMessageStruct() 89 { 90 return gUnixCredentialsMessage; 91 } 92 93 94 /** the main Gtk struct as a void* */ 95 protected override void* getStruct() 96 { 97 return cast(void*)gUnixCredentialsMessage; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class 102 */ 103 public this (GUnixCredentialsMessage* gUnixCredentialsMessage) 104 { 105 super(cast(GSocketControlMessage*)gUnixCredentialsMessage); 106 this.gUnixCredentialsMessage = gUnixCredentialsMessage; 107 } 108 109 protected override void setStruct(GObject* obj) 110 { 111 super.setStruct(obj); 112 gUnixCredentialsMessage = cast(GUnixCredentialsMessage*)obj; 113 } 114 115 /** 116 */ 117 118 /** 119 * Creates a new GUnixCredentialsMessage with credentials matching the current processes. 120 * Since 2.26 121 * Throws: ConstructionException GTK+ fails to create the object. 122 */ 123 public this () 124 { 125 // GSocketControlMessage * g_unix_credentials_message_new (void); 126 auto p = g_unix_credentials_message_new(); 127 if(p is null) 128 { 129 throw new ConstructionException("null returned by g_unix_credentials_message_new()"); 130 } 131 this(cast(GUnixCredentialsMessage*) p); 132 } 133 134 /** 135 * Creates a new GUnixCredentialsMessage holding credentials. 136 * Since 2.26 137 * Params: 138 * credentials = A GCredentials object. 139 * Throws: ConstructionException GTK+ fails to create the object. 140 */ 141 public this (Credentials credentials) 142 { 143 // GSocketControlMessage * g_unix_credentials_message_new_with_credentials (GCredentials *credentials); 144 auto p = g_unix_credentials_message_new_with_credentials((credentials is null) ? null : credentials.getCredentialsStruct()); 145 if(p is null) 146 { 147 throw new ConstructionException("null returned by g_unix_credentials_message_new_with_credentials((credentials is null) ? null : credentials.getCredentialsStruct())"); 148 } 149 this(cast(GUnixCredentialsMessage*) p); 150 } 151 152 /** 153 * Gets the credentials stored in message. 154 * Since 2.26 155 * Returns: A GCredentials instance. Do not free, it is owned by message. [transfer none] 156 */ 157 public Credentials getCredentials() 158 { 159 // GCredentials * g_unix_credentials_message_get_credentials (GUnixCredentialsMessage *message); 160 auto p = g_unix_credentials_message_get_credentials(gUnixCredentialsMessage); 161 162 if(p is null) 163 { 164 return null; 165 } 166 167 return ObjectG.getDObject!(Credentials)(cast(GCredentials*) p); 168 } 169 170 /** 171 * Checks if passing GCredentials on a GSocket is supported on this platform. 172 * Since 2.26 173 * Returns: TRUE if supported, FALSE otherwise 174 */ 175 public static int isSupported() 176 { 177 // gboolean g_unix_credentials_message_is_supported (void); 178 return g_unix_credentials_message_is_supported(); 179 } 180 }