31d2c6b0 |
1 | /* libltt header file |
2 | * |
3 | * Copyright 2005- |
e59e4125 |
4 | * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> |
31d2c6b0 |
5 | * |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
e59e4125 |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31d2c6b0 |
15 | * GNU General Public License for more details. |
16 | * |
17 | * |
18 | * Inspired from iptables, by James Morris <jmorris@intercode.com.au>. |
19 | * |
20 | */ |
21 | |
22 | #ifndef _LIBLTT_H |
23 | #define _LIBLTT_H |
24 | |
25 | #include <linux/limits.h> |
994ef399 |
26 | #include <asm/types.h> |
94fe07f4 |
27 | #include <sys/socket.h> |
ace0e68d |
28 | #include <linux/netlink.h> |
29 | |
30 | #ifndef NETLINK_LTT |
71a866fc |
31 | #define NETLINK_LTT 31 |
ace0e68d |
32 | #endif |
33 | |
31d2c6b0 |
34 | |
35 | enum trace_op { |
36 | OP_CREATE, |
37 | OP_DESTROY, |
38 | OP_START, |
ace0e68d |
39 | OP_STOP, |
40 | OP_NONE |
31d2c6b0 |
41 | }; |
42 | |
43 | enum trace_mode { |
ace0e68d |
44 | LTT_TRACE_NORMAL, |
d24c12e7 |
45 | LTT_TRACE_FLIGHT, |
46 | LTT_TRACE_HYBRID |
31d2c6b0 |
47 | }; |
48 | |
fde1a29a |
49 | typedef struct lttctl_peer_msg { |
50 | char trace_name[NAME_MAX]; |
313b3771 |
51 | char trace_type[NAME_MAX]; |
fde1a29a |
52 | enum trace_op op; |
53 | union { |
e59e4125 |
54 | struct { |
55 | enum trace_mode mode; |
d24c12e7 |
56 | unsigned subbuf_size_low; |
57 | unsigned n_subbufs_low; |
58 | unsigned subbuf_size_med; |
59 | unsigned n_subbufs_med; |
60 | unsigned subbuf_size_high; |
61 | unsigned n_subbufs_high; |
e59e4125 |
62 | } new_trace; |
fde1a29a |
63 | } args; |
64 | } lttctl_peer_msg_t; |
65 | |
31d2c6b0 |
66 | |
67 | struct lttctl_handle |
68 | { |
e59e4125 |
69 | int fd; |
70 | //u_int8_t blocking; |
71 | struct sockaddr_nl local; |
72 | struct sockaddr_nl peer; |
31d2c6b0 |
73 | }; |
74 | |
ace0e68d |
75 | typedef struct lttctl_resp_msg { |
76 | int err; |
77 | } lttctl_resp_msg_t; |
31d2c6b0 |
78 | |
ace0e68d |
79 | struct lttctl_handle *lttctl_create_handle(void); |
31d2c6b0 |
80 | |
81 | int lttctl_destroy_handle(struct lttctl_handle *h); |
82 | |
83 | |
fde1a29a |
84 | int lttctl_create_trace(const struct lttctl_handle *h, |
d24c12e7 |
85 | char *name, enum trace_mode mode, char *trace_type, |
86 | unsigned subbuf_size_low, unsigned n_subbufs_low, |
87 | unsigned subbuf_size_med, unsigned n_subbufs_med, |
88 | unsigned subbuf_size_high, unsigned n_subbufs_high); |
31d2c6b0 |
89 | |
ace0e68d |
90 | int lttctl_destroy_trace(const struct lttctl_handle *handle, char *name); |
31d2c6b0 |
91 | |
ace0e68d |
92 | int lttctl_start(const struct lttctl_handle *handle, char *name); |
31d2c6b0 |
93 | |
ace0e68d |
94 | int lttctl_stop(const struct lttctl_handle *handle, char *name); |
31d2c6b0 |
95 | |
96 | #define LTTCTLM_BASE 0x10 |
97 | #define LTTCTLM_CONTROL (LTTCTLM_BASE + 1) /* LTT control message */ |
98 | |
99 | |
100 | #endif //_LIBLTT_H |