31d2c6b0 |
1 | /* libltt header file |
2 | * |
3 | * Copyright 2005- |
4 | * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> |
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 |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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> |
ace0e68d |
26 | #include <linux/netlink.h> |
27 | |
28 | #ifndef NETLINK_LTT |
29 | #define NETLINK_LTT 12 |
30 | #endif |
31 | |
31d2c6b0 |
32 | |
33 | enum trace_op { |
34 | OP_CREATE, |
35 | OP_DESTROY, |
36 | OP_START, |
ace0e68d |
37 | OP_STOP, |
38 | OP_NONE |
31d2c6b0 |
39 | }; |
40 | |
41 | enum trace_mode { |
ace0e68d |
42 | LTT_TRACE_NORMAL, |
43 | LTT_TRACE_FLIGHT |
31d2c6b0 |
44 | }; |
45 | |
46 | |
47 | struct lttctl_handle |
48 | { |
49 | int fd; |
ace0e68d |
50 | //u_int8_t blocking; |
31d2c6b0 |
51 | struct sockaddr_nl local; |
52 | struct sockaddr_nl peer; |
53 | }; |
54 | |
55 | typedef struct lttctl_peer_msg { |
56 | char trace_name[NAME_MAX]; |
57 | enum trace_op op; |
58 | union { |
59 | enum trace_mode mode; |
60 | } args; |
61 | } lttctl_peer_msg_t; |
62 | |
ace0e68d |
63 | typedef struct lttctl_resp_msg { |
64 | int err; |
65 | } lttctl_resp_msg_t; |
31d2c6b0 |
66 | |
ace0e68d |
67 | struct lttctl_handle *lttctl_create_handle(void); |
31d2c6b0 |
68 | |
69 | int lttctl_destroy_handle(struct lttctl_handle *h); |
70 | |
71 | |
ace0e68d |
72 | int lttctl_create_trace(const struct lttctl_handle * handle, |
73 | char *name, enum trace_mode mode); |
31d2c6b0 |
74 | |
ace0e68d |
75 | int lttctl_destroy_trace(const struct lttctl_handle *handle, char *name); |
31d2c6b0 |
76 | |
ace0e68d |
77 | int lttctl_start(const struct lttctl_handle *handle, char *name); |
31d2c6b0 |
78 | |
ace0e68d |
79 | int lttctl_stop(const struct lttctl_handle *handle, char *name); |
31d2c6b0 |
80 | |
81 | #define LTTCTLM_BASE 0x10 |
82 | #define LTTCTLM_CONTROL (LTTCTLM_BASE + 1) /* LTT control message */ |
83 | |
84 | |
85 | #endif //_LIBLTT_H |