Commit | Line | Data |
---|---|---|
d3e2ba59 JD |
1 | /* |
2 | * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com> | |
3 | * David Goulet <dgoulet@efficios.com> | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU General Public License, version 2 only, as | |
7 | * published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License along with | |
15 | * this program; if not, write to the Free Software Foundation, Inc., 51 | |
16 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 | */ | |
18 | ||
19 | #define _GNU_SOURCE | |
6c1c0768 | 20 | #define _LGPL_SOURCE |
d3e2ba59 JD |
21 | #include <assert.h> |
22 | #include <string.h> | |
23 | ||
24 | #include <common/common.h> | |
25 | #include <common/sessiond-comm/relayd.h> | |
26 | ||
f263b7fd JD |
27 | #include <common/compat/endian.h> |
28 | ||
d3e2ba59 JD |
29 | #include "cmd-generic.h" |
30 | #include "lttng-relayd.h" | |
31 | ||
58eb9381 | 32 | int cmd_create_session_2_4(struct relay_connection *conn, |
d3e2ba59 JD |
33 | struct relay_session *session) |
34 | { | |
35 | int ret; | |
36 | struct lttcomm_relayd_create_session_2_4 session_info; | |
37 | ||
58eb9381 | 38 | assert(conn); |
d3e2ba59 JD |
39 | assert(session); |
40 | ||
58eb9381 | 41 | ret = cmd_recv(conn->sock, &session_info, sizeof(session_info)); |
d3e2ba59 JD |
42 | if (ret < 0) { |
43 | ERR("Unable to recv session info version 2.4"); | |
44 | goto error; | |
45 | } | |
46 | ||
47 | strncpy(session->session_name, session_info.session_name, | |
48 | sizeof(session->session_name)); | |
49 | strncpy(session->hostname, session_info.hostname, | |
50 | sizeof(session->hostname)); | |
51 | session->live_timer = be32toh(session_info.live_timer); | |
7d2f7452 | 52 | session->snapshot = be32toh(session_info.snapshot); |
d3e2ba59 JD |
53 | |
54 | ret = 0; | |
55 | ||
56 | error: | |
57 | return ret; | |
58 | } |