chiark / gitweb /
gudev: add device::get_sysfs_attr_keys and device::has_sysfs_attr
[elogind.git] / src / gudev / gudevclient.h
1 /* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2  *
3  * Copyright (C) 2008 David Zeuthen <davidz@redhat.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
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  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19
20 #if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H)
21 #error "Only <gudev/gudev.h> can be included directly, this file may disappear or change contents."
22 #endif
23
24 #ifndef __G_UDEV_CLIENT_H__
25 #define __G_UDEV_CLIENT_H__
26
27 #include <gudev/gudevtypes.h>
28
29 G_BEGIN_DECLS
30
31 #define G_UDEV_TYPE_CLIENT         (g_udev_client_get_type ())
32 #define G_UDEV_CLIENT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_CLIENT, GUdevClient))
33 #define G_UDEV_CLIENT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_CLIENT, GUdevClientClass))
34 #define G_UDEV_IS_CLIENT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_CLIENT))
35 #define G_UDEV_IS_CLIENT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_CLIENT))
36 #define G_UDEV_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_CLIENT, GUdevClientClass))
37
38 typedef struct _GUdevClientClass   GUdevClientClass;
39 typedef struct _GUdevClientPrivate GUdevClientPrivate;
40
41 /**
42  * GUdevClient:
43  *
44  * The #GUdevClient struct is opaque and should not be accessed directly.
45  */
46 struct _GUdevClient
47 {
48   GObject              parent;
49
50   /*< private >*/
51   GUdevClientPrivate *priv;
52 };
53
54 /**
55  * GUdevClientClass:
56  * @parent_class: Parent class.
57  * @uevent: Signal class handler for the #GUdevClient::uevent signal.
58  *
59  * Class structure for #GUdevClient.
60  */
61 struct _GUdevClientClass
62 {
63   GObjectClass   parent_class;
64
65   /* signals */
66   void (*uevent) (GUdevClient  *client,
67                   const gchar  *action,
68                   GUdevDevice  *device);
69
70   /*< private >*/
71   /* Padding for future expansion */
72   void (*reserved1) (void);
73   void (*reserved2) (void);
74   void (*reserved3) (void);
75   void (*reserved4) (void);
76   void (*reserved5) (void);
77   void (*reserved6) (void);
78   void (*reserved7) (void);
79   void (*reserved8) (void);
80 };
81
82 GType        g_udev_client_get_type                    (void) G_GNUC_CONST;
83 GUdevClient *g_udev_client_new                         (const gchar* const *subsystems);
84 GList       *g_udev_client_query_by_subsystem          (GUdevClient        *client,
85                                                         const gchar        *subsystem);
86 GUdevDevice *g_udev_client_query_by_device_number      (GUdevClient        *client,
87                                                         GUdevDeviceType     type,
88                                                         GUdevDeviceNumber   number);
89 GUdevDevice *g_udev_client_query_by_device_file        (GUdevClient        *client,
90                                                         const gchar        *device_file);
91 GUdevDevice *g_udev_client_query_by_sysfs_path         (GUdevClient        *client,
92                                                         const gchar        *sysfs_path);
93 GUdevDevice *g_udev_client_query_by_subsystem_and_name (GUdevClient        *client,
94                                                         const gchar        *subsystem,
95                                                         const gchar        *name);
96
97 G_END_DECLS
98
99 #endif /* __G_UDEV_CLIENT_H__ */