2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 2008 Zmanda Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library 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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 * This declaration is entirely private; nothing but xfer_dest_fd() references
30 GType xfer_dest_fd_get_type(void);
31 #define XFER_DEST_FD_TYPE (xfer_dest_fd_get_type())
32 #define XFER_DEST_FD(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_fd_get_type(), XferDestFd)
33 #define XFER_DEST_FD_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_fd_get_type(), XferDestFd const)
34 #define XFER_DEST_FD_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_fd_get_type(), XferDestFdClass)
35 #define IS_XFER_DEST_FD(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_fd_get_type ())
36 #define XFER_DEST_FD_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_fd_get_type(), XferDestFdClass)
38 static GObjectClass *parent_class = NULL;
41 * Main object structure
44 typedef struct XferDestFd {
45 XferElement __parent__;
53 XferElementClass __parent__;
62 XferDestFdClass * selfc)
64 XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
65 static xfer_element_mech_pair_t mech_pairs[] = {
66 { XFER_MECH_WRITEFD, XFER_MECH_NONE, 0, 0},
67 { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
70 klass->perl_class = "Amanda::Xfer::Dest::Fd";
71 klass->mech_pairs = mech_pairs;
73 parent_class = g_type_class_peek_parent(selfc);
77 xfer_dest_fd_get_type (void)
79 static GType type = 0;
81 if G_UNLIKELY(type == 0) {
82 static const GTypeInfo info = {
83 sizeof (XferDestFdClass),
85 (GBaseFinalizeFunc) NULL,
86 (GClassInitFunc) class_init,
87 (GClassFinalizeFunc) NULL,
88 NULL /* class_data */,
91 (GInstanceInitFunc) NULL,
95 type = g_type_register_static (XFER_ELEMENT_TYPE, "XferDestFd", &info, 0);
101 /* create an element of this class; prototype is in xfer-element.h */
106 XferDestFd *self = (XferDestFd *)g_object_new(XFER_DEST_FD_TYPE, NULL);
107 XferElement *elt = XFER_ELEMENT(self);
111 /* We keep a *copy* of this fd, because our caller will close it to indicate
113 elt->input_fd = dup(fd);