]> git.ipfire.org Git - collecty.git/blame - src/_collecty/_collectymodule.h
python: Declare functions as static when possible
[collecty.git] / src / _collecty / _collectymodule.h
CommitLineData
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 */
36typedef struct {
37 PyObject_HEAD
38 char* path;
39 struct hd_driveid identity;
40 SkDisk* disk;
41} BlockDevice;
42
c237bbed 43extern PyTypeObject BlockDeviceType;
86d23308 44
86d23308 45/* ping */
c237bbed
MT
46extern PyObject* PyExc_PingError;
47extern PyObject* PyExc_PingAddHostError;
48extern PyObject* PyExc_PingNoReplyError;
86d23308
MT
49
50typedef 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 66extern PyTypeObject PingType;
86d23308 67
86d23308
MT
68/* sensors */
69typedef struct {
70 PyObject_HEAD
71 const sensors_chip_name* chip;
72 const sensors_feature* feature;
73} SensorObject;
74
c237bbed 75extern PyTypeObject SensorType;
86d23308 76
86d23308
MT
77PyObject* _collecty_sensors_init();
78PyObject* _collecty_sensors_cleanup();
79PyObject* _collecty_get_detected_sensors(PyObject* o, PyObject* args);
80
81/* utils */
82int _collecty_mountpoint_is_virtual(const struct mntent* mp);
83PyObject* _collecty_get_mountpoints();