]>
Commit | Line | Data |
---|---|---|
86d23308 MT |
1 | /* |
2 | * collecty | |
3 | * Copyright (C) 2015 IPFire Team (www.ipfire.org) | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program 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 | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | #include <Python.h> | |
20 | ||
21 | #include <atasmart.h> | |
22 | #include <linux/hdreg.h> | |
23 | #include <mntent.h> | |
24 | #include <oping.h> | |
25 | #include <sensors/error.h> | |
26 | #include <sensors/sensors.h> | |
27 | ||
28 | #define MODEL_SIZE 40 | |
29 | #define SERIAL_SIZE 20 | |
30 | ||
31 | #define PING_HISTORY_SIZE 1024 | |
32 | #define PING_DEFAULT_COUNT 10 | |
33 | #define PING_DEFAULT_TIMEOUT 8 | |
34 | ||
35 | /* block devices */ | |
36 | typedef struct { | |
37 | PyObject_HEAD | |
38 | char* path; | |
39 | struct hd_driveid identity; | |
40 | SkDisk* disk; | |
41 | } BlockDevice; | |
42 | ||
c237bbed | 43 | extern PyTypeObject BlockDeviceType; |
86d23308 | 44 | |
86d23308 | 45 | /* ping */ |
c237bbed MT |
46 | extern PyObject* PyExc_PingError; |
47 | extern PyObject* PyExc_PingAddHostError; | |
48 | extern PyObject* PyExc_PingNoReplyError; | |
86d23308 MT |
49 | |
50 | typedef struct { | |
51 | PyObject_HEAD | |
52 | pingobj_t* ping; | |
53 | const char* host; | |
54 | struct { | |
55 | double history[PING_HISTORY_SIZE]; | |
56 | size_t history_index; | |
57 | size_t history_size; | |
58 | size_t packets_sent; | |
59 | size_t packets_rcvd; | |
60 | double average; | |
61 | double stddev; | |
62 | double loss; | |
63 | } stats; | |
64 | } PingObject; | |
65 | ||
c237bbed | 66 | extern PyTypeObject PingType; |
86d23308 | 67 | |
86d23308 MT |
68 | /* sensors */ |
69 | typedef struct { | |
70 | PyObject_HEAD | |
71 | const sensors_chip_name* chip; | |
72 | const sensors_feature* feature; | |
73 | } SensorObject; | |
74 | ||
c237bbed | 75 | extern PyTypeObject SensorType; |
86d23308 | 76 | |
86d23308 MT |
77 | PyObject* _collecty_sensors_init(); |
78 | PyObject* _collecty_sensors_cleanup(); | |
79 | PyObject* _collecty_get_detected_sensors(PyObject* o, PyObject* args); | |
80 | ||
81 | /* utils */ | |
82 | int _collecty_mountpoint_is_virtual(const struct mntent* mp); | |
83 | PyObject* _collecty_get_mountpoints(); |