1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY! 2 #ifndef _GIOMM_UNIXFDMESSAGE_H 3 #define _GIOMM_UNIXFDMESSAGE_H 4 5 6 #include <glibmm/ustring.h> 7 #include <sigc++/sigc++.h> 8 9 /* Copyright (C) 2010 The giomm Development Team 10 * 11 * This library is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU Lesser General Public 13 * License as published by the Free Software Foundation; either 14 * version 2.1 of the License, or (at your option) any later version. 15 * 16 * This library is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public 22 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 23 */ 24 25 #include <glibmm/arrayhandle.h> 26 #include <giomm/socketcontrolmessage.h> 27 28 29 #ifndef DOXYGEN_SHOULD_SKIP_THIS 30 using GUnixFDMessage = struct _GUnixFDMessage; 31 using GUnixFDMessageClass = struct _GUnixFDMessageClass; 32 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 33 34 35 #ifndef DOXYGEN_SHOULD_SKIP_THIS 36 namespace Gio 37 { class GIOMM_API UnixFDMessage_Class; } // namespace Gio 38 #endif //DOXYGEN_SHOULD_SKIP_THIS 39 40 namespace Gio 41 { 42 43 class GIOMM_API UnixFDList; 44 45 /** UnixFDMessage — A GSocketControlMessage containing a GUnixFDList. 46 * This SocketControlMessage contains a UnixFDList. It may be sent using 47 * Gio::Socket::send() and received using Gio::Socket::receive() over 48 * UNIX sockets (ie: sockets in the Gio::SOCKET_ADDRESS_UNIX family). The file 49 * descriptors are copied between processes by the kernel. 50 * 51 * For an easier way to send and receive file descriptors over stream-oriented 52 * UNIX sockets, see Gio::UnixConnection::send_fd() and 53 * Gio::UnixConnection::receive_fd(). 54 * 55 * @ingroup NetworkIO 56 * @newin{2,28} 57 */ 58 59 class GIOMM_API UnixFDMessage : public SocketControlMessage 60 { 61 62 #ifndef DOXYGEN_SHOULD_SKIP_THIS 63 64 public: 65 using CppObjectType = UnixFDMessage; 66 using CppClassType = UnixFDMessage_Class; 67 using BaseObjectType = GUnixFDMessage; 68 using BaseClassType = GUnixFDMessageClass; 69 70 // noncopyable 71 UnixFDMessage(const UnixFDMessage&) = delete; 72 UnixFDMessage& operator=(const UnixFDMessage&) = delete; 73 74 private: friend class UnixFDMessage_Class; 75 static CppClassType unixfdmessage_class_; 76 77 protected: 78 explicit UnixFDMessage(const Glib::ConstructParams& construct_params); 79 explicit UnixFDMessage(GUnixFDMessage* castitem); 80 81 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 82 83 public: 84 85 UnixFDMessage(UnixFDMessage&& src) noexcept; 86 UnixFDMessage& operator=(UnixFDMessage&& src) noexcept; 87 88 ~UnixFDMessage() noexcept override; 89 90 /** Get the GType for this class, for use with the underlying GObject type system. 91 */ 92 static GType get_type() G_GNUC_CONST; 93 94 #ifndef DOXYGEN_SHOULD_SKIP_THIS 95 96 97 static GType get_base_type() G_GNUC_CONST; 98 #endif 99 100 ///Provides access to the underlying C GObject. gobj()101 GUnixFDMessage* gobj() { return reinterpret_cast<GUnixFDMessage*>(gobject_); } 102 103 ///Provides access to the underlying C GObject. gobj()104 const GUnixFDMessage* gobj() const { return reinterpret_cast<GUnixFDMessage*>(gobject_); } 105 106 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. 107 GUnixFDMessage* gobj_copy(); 108 109 private: 110 111 //This is not available on Win32. 112 //This source file will not be compiled on Win32, 113 //and no class defined in it will be registered by wrap_init(). 114 115 116 protected: 117 UnixFDMessage(); 118 explicit UnixFDMessage(const Glib::RefPtr<UnixFDList>& fd_list); 119 120 121 public: 122 123 /** Creates a new UnixFDMessage containing an empty file descriptor 124 * list. 125 * 126 * @newin{2,22} 127 * 128 * @return A new UnixFDMessage. 129 */ 130 131 132 static Glib::RefPtr<UnixFDMessage> create(); 133 134 135 /** Creates a new UnixFDMessage containing @a list. 136 * 137 * @newin{2,24} 138 * 139 * @param fd_list A UnixFDList. 140 * @return A new UnixFDMessage. 141 */ 142 143 144 static Glib::RefPtr<UnixFDMessage> create(const Glib::RefPtr<UnixFDList>& fd_list); 145 146 147 /** Gets the UnixFDList contained in @a message. This function does not 148 * return a reference to the caller, but the returned list is valid for 149 * the lifetime of @a message. 150 * 151 * @newin{2,24} 152 * 153 * @return The UnixFDList from @a message. 154 */ 155 Glib::RefPtr<UnixFDList> get_fd_list(); 156 157 /** Gets the UnixFDList contained in @a message. This function does not 158 * return a reference to the caller, but the returned list is valid for 159 * the lifetime of @a message. 160 * 161 * @newin{2,24} 162 * 163 * @return The UnixFDList from @a message. 164 */ 165 Glib::RefPtr<const UnixFDList> get_fd_list() const; 166 167 168 /** Adds a file descriptor to @a message. 169 * 170 * The file descriptor is duplicated using dup(). You keep your copy 171 * of the descriptor and the copy contained in @a message will be closed 172 * when @a message is finalized. 173 * 174 * A possible cause of failure is exceeding the per-process or 175 * system-wide file descriptor limit. 176 * 177 * @newin{2,22} 178 * 179 * @param fd A valid open file descriptor. 180 * @return <tt>true</tt> in case of success, else <tt>false</tt> (and @a error is set). 181 * 182 * @throws Glib::Error 183 */ 184 bool append_fd(int fd); 185 186 /** Returns the array of file descriptors that is contained in this object. 187 * 188 * After this call, the descriptors are no longer contained in message. 189 * Further calls will return an empty list (unless more descriptors have 190 * been added). 191 * 192 * The caller is responsible for closing all of the file descriptors. 193 * 194 * @return An array of file descriptors. 195 * 196 * @newin{2,28} 197 */ 198 Glib::ArrayHandle<int> steal_fds(); 199 200 201 /** The GUnixFDList object to send with the message. 202 * 203 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 204 * or receive notification when the value of the property changes. 205 */ 206 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<UnixFDList> > property_fd_list() const; 207 208 209 public: 210 211 public: 212 //C++ methods used to invoke GTK+ virtual functions: 213 214 protected: 215 //GTK+ Virtual Functions (override these to change behaviour): 216 217 //Default Signal Handlers:: 218 219 220 }; 221 222 } // namespace Gio 223 224 225 namespace Glib 226 { 227 /** A Glib::wrap() method for this object. 228 * 229 * @param object The C instance. 230 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. 231 * @result A C++ instance that wraps this C instance. 232 * 233 * @relates Gio::UnixFDMessage 234 */ 235 GIOMM_API 236 Glib::RefPtr<Gio::UnixFDMessage> wrap(GUnixFDMessage* object, bool take_copy = false); 237 } 238 239 240 #endif /* _GIOMM_UNIXFDMESSAGE_H */ 241 242