1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
* Copyright (c) 2008-2010 Aconex. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef LOCAL_H
#define LOCAL_H
#include <pmapi.h>
#include <impl.h>
#include <pmda.h>
typedef struct sv scalar_t;
typedef struct timeval delta_t;
typedef struct {
int id;
delta_t delta;
int cookie;
scalar_t *callback;
} timers_t;
typedef enum { FILE_PIPE, FILE_SOCK, FILE_TAIL } file_type_t;
typedef struct {
FILE *file;
} pipe_data_t;
typedef struct {
char *path;
dev_t dev;
ino_t ino;
} tail_data_t;
typedef struct {
char *host;
int port;
} sock_data_t;
typedef struct {
int fd;
int type;
int cookie;
scalar_t *callback;
union {
pipe_data_t pipe;
tail_data_t tail;
sock_data_t sock;
} me;
} files_t;
extern void timer_callback(int, void *);
extern void input_callback(scalar_t *, int, char *);
extern char *local_strdup_suffix(const char *string, const char *suffix);
extern char *local_strdup_prefix(const char *prefix, const char *string);
extern int local_user(const char *username);
extern int local_timer(double timeout, scalar_t *callback, int cookie);
extern int local_timer_get_cookie(int id);
extern scalar_t *local_timer_get_callback(int id);
extern int local_pipe(char *pipe, scalar_t *callback, int cookie);
extern int local_tail(char *file, scalar_t *callback, int cookie);
extern int local_sock(char *host, int port, scalar_t *callback, int cookie);
extern void local_atexit(void);
extern int local_files_get_descriptor(int id);
extern void local_pmdaMain(pmdaInterface *self);
#endif /* LOCAL_H */
|