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
20 #ifndef ELEMENT_GLUE_H
21 #define ELEMENT_GLUE_H
24 #include <glib-object.h>
25 #include "xfer-element.h"
26 #include "semaphore.h"
32 GType xfer_element_glue_get_type(void);
33 #define XFER_ELEMENT_GLUE_TYPE (xfer_element_glue_get_type())
34 #define XFER_ELEMENT_GLUE(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_element_glue_get_type(), XferElementGlue)
35 #define XFER_ELEMENT_GLUE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_element_glue_get_type(), XferElementGlue const)
36 #define XFER_ELEMENT_GLUE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_element_glue_get_type(), XferElementGlueClass)
37 #define IS_XFER_ELEMENT_GLUE(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_element_glue_get_type ())
38 #define XFER_ELEMENT_GLUE_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_element_glue_get_type(), XferElementGlueClass)
41 * Main object structure
44 typedef struct XferElementGlue {
45 XferElement __parent__;
47 /* the stuff we might use, depending on what flavor of glue we're
51 /* for push/pull, a ring buffer of ptr/size pairs */
52 struct { gpointer buf; size_t size; } *ring;
53 semaphore_t *ring_used_sem, *ring_free_sem;
54 gint ring_head, ring_tail;
57 GThreadFunc threadfunc;
65 XferElementClass __parent__;
66 } XferElementGlueClass;
70 XferElement * xfer_element_glue(void);
72 /* the mech pairs supported by this object */
74 extern xfer_element_mech_pair_t *xfer_element_glue_mech_pairs;