2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 2008,2009 Zmanda, Inc. All Rights Reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
19 * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
23 #include "sockaddr-util.h"
29 * This declaration is entirely private; nothing but xfer_source_directtcp_listen() references
33 static GType xfer_source_directtcp_listen_get_type(void);
34 #define XFER_SOURCE_DIRECTTCP_LISTEN_TYPE (xfer_source_directtcp_listen_get_type())
35 #define XFER_SOURCE_DIRECTTCP_LISTEN(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_directtcp_listen_get_type(), XferSourceDirectTCPListen)
36 #define XFER_SOURCE_DIRECTTCP_LISTEN_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_directtcp_listen_get_type(), XferSourceDirectTCPListen const)
37 #define XFER_SOURCE_DIRECTTCP_LISTEN_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_source_directtcp_listen_get_type(), XferSourceDirectTCPListenClass)
38 #define IS_XFER_SOURCE_DIRECTTCP_LISTEN(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_source_directtcp_listen_get_type ())
39 #define XFER_SOURCE_DIRECTTCP_LISTEN_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_source_directtcp_listen_get_type(), XferSourceDirectTCPListenClass)
41 static GObjectClass *parent_class = NULL;
44 * Main object structure
47 typedef struct XferSourceDirectTCPListen {
48 XferElement __parent__;
49 } XferSourceDirectTCPListen;
56 XferElementClass __parent__;
57 } XferSourceDirectTCPListenClass;
67 /* this is really all we do -- copy the input addresses from our downstream
68 * neighbor. This seems trivial, but downstream may be a glue element, which
69 * means we get the listening socket for free. */
70 elt->input_listen_addrs = elt->downstream->input_listen_addrs;
79 elt->can_generate_eof = FALSE;
84 XferSourceDirectTCPListenClass * selfc)
86 XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
87 static xfer_element_mech_pair_t mech_pairs[] = {
88 { XFER_MECH_NONE, XFER_MECH_DIRECTTCP_LISTEN, XFER_NROPS(1), XFER_NTHREADS(0) },
89 { XFER_MECH_NONE, XFER_MECH_NONE, XFER_NROPS(0), XFER_NTHREADS(0) },
92 klass->start = start_impl;
93 klass->perl_class = "Amanda::Xfer::Source::DirectTCPListen";
94 klass->mech_pairs = mech_pairs;
96 parent_class = g_type_class_peek_parent(selfc);
100 xfer_source_directtcp_listen_get_type (void)
102 static GType type = 0;
104 if G_UNLIKELY(type == 0) {
105 static const GTypeInfo info = {
106 sizeof (XferSourceDirectTCPListenClass),
107 (GBaseInitFunc) NULL,
108 (GBaseFinalizeFunc) NULL,
109 (GClassInitFunc) class_init,
110 (GClassFinalizeFunc) NULL,
111 NULL /* class_data */,
112 sizeof (XferSourceDirectTCPListen),
114 (GInstanceInitFunc) instance_init,
118 type = g_type_register_static (XFER_ELEMENT_TYPE, "XferSourceDirectTCPListen", &info, 0);
124 /* create an element of this class; prototype is in xfer-element.h */
126 xfer_source_directtcp_listen(void)
128 XferSourceDirectTCPListen *xsr = (XferSourceDirectTCPListen *)g_object_new(XFER_SOURCE_DIRECTTCP_LISTEN_TYPE, NULL);
129 XferElement *elt = XFER_ELEMENT(xsr);