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