Implement the relayd live features
[lttng-tools.git] / src / bin / lttng-relayd / cmd-2-4.c
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
20 #include <assert.h>
21 #include <string.h>
22
23 #include <common/common.h>
24 #include <common/sessiond-comm/relayd.h>
25
26 #include "cmd-generic.h"
27 #include "lttng-relayd.h"
28
29 int cmd_create_session_2_4(struct relay_command *cmd,
30 struct relay_session *session)
31 {
32 int ret;
33 struct lttcomm_relayd_create_session_2_4 session_info;
34
35 assert(cmd);
36 assert(session);
37
38 ret = cmd_recv(cmd->sock, &session_info, sizeof(session_info));
39 if (ret < 0) {
40 ERR("Unable to recv session info version 2.4");
41 goto error;
42 }
43
44 strncpy(session->session_name, session_info.session_name,
45 sizeof(session->session_name));
46 strncpy(session->hostname, session_info.hostname,
47 sizeof(session->hostname));
48 session->live_timer = be32toh(session_info.live_timer);
49
50 ret = 0;
51
52 error:
53 return ret;
54 }
This page took 0.030793 seconds and 4 git commands to generate.