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 63 private import gio.Credentials; 64 65 66 67 private import gio.SocketControlMessage; 68 69 /** 70 * Description 71 * This GSocketControlMessage contains a GCredentials instance. It 72 * may be sent using g_socket_send_message() and received using 73 * g_socket_receive_message() over UNIX sockets (ie: sockets in the 74 * G_SOCKET_FAMILY_UNIX family). 75 * For an easier way to send and receive credentials over 76 * stream-oriented UNIX sockets, see 77 * g_unix_connection_send_credentials() and 78 * g_unix_connection_receive_credentials(). To receive credentials of 79 * a foreign process connected to a socket, use 80 * g_socket_get_credentials(). 81 */ 82 public class UnixCredentialsMessage : SocketControlMessage 83 { 84 85 /** the main Gtk struct */ 86 protected GUnixCredentialsMessage* gUnixCredentialsMessage; 87 88 89 public GUnixCredentialsMessage* getUnixCredentialsMessageStruct() 90 { 91 return gUnixCredentialsMessage; 92 } 93 94 95 /** the main Gtk struct as a void* */ 96 protected override void* getStruct() 97 { 98 return cast(void*)gUnixCredentialsMessage; 99 } 100 101 /** 102 * Sets our main struct and passes it to the parent class 103 */ 104 public this (GUnixCredentialsMessage* gUnixCredentialsMessage) 105 { 106 super(cast(GSocketControlMessage*)gUnixCredentialsMessage); 107 this.gUnixCredentialsMessage = gUnixCredentialsMessage; 108 } 109 110 protected override void setStruct(GObject* obj) 111 { 112 super.setStruct(obj); 113 gUnixCredentialsMessage = cast(GUnixCredentialsMessage*)obj; 114 } 115 116 /** 117 */ 118 119 /** 120 * Creates a new GUnixCredentialsMessage with credentials matching the current processes. 121 * Since 2.26 122 * Throws: ConstructionException GTK+ fails to create the object. 123 */ 124 public this () 125 { 126 // GSocketControlMessage * g_unix_credentials_message_new (void); 127 auto p = g_unix_credentials_message_new(); 128 if(p is null) 129 { 130 throw new ConstructionException("null returned by g_unix_credentials_message_new()"); 131 } 132 this(cast(GUnixCredentialsMessage*) p); 133 } 134 135 /** 136 * Creates a new GUnixCredentialsMessage holding credentials. 137 * Since 2.26 138 * Params: 139 * credentials = A GCredentials object. 140 * Throws: ConstructionException GTK+ fails to create the object. 141 */ 142 public this (Credentials credentials) 143 { 144 // GSocketControlMessage * g_unix_credentials_message_new_with_credentials (GCredentials *credentials); 145 auto p = g_unix_credentials_message_new_with_credentials((credentials is null) ? null : credentials.getCredentialsStruct()); 146 if(p is null) 147 { 148 throw new ConstructionException("null returned by g_unix_credentials_message_new_with_credentials((credentials is null) ? null : credentials.getCredentialsStruct())"); 149 } 150 this(cast(GUnixCredentialsMessage*) p); 151 } 152 153 /** 154 * Gets the credentials stored in message. 155 * Since 2.26 156 * Returns: A GCredentials instance. Do not free, it is owned by message. [transfer none] 157 */ 158 public Credentials getCredentials() 159 { 160 // GCredentials * g_unix_credentials_message_get_credentials (GUnixCredentialsMessage *message); 161 auto p = g_unix_credentials_message_get_credentials(gUnixCredentialsMessage); 162 163 if(p is null) 164 { 165 return null; 166 } 167 168 return ObjectG.getDObject!(Credentials)(cast(GCredentials*) p); 169 } 170 171 /** 172 * Checks if passing a GCredential on a GSocket is supported on this platform. 173 * Since 2.26 174 * Returns: TRUE if supported, FALSE otherwise 175 */ 176 public static int isSupported() 177 { 178 // gboolean g_unix_credentials_message_is_supported (void); 179 return g_unix_credentials_message_is_supported(); 180 } 181 }