diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2018-02-24 16:01:16 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-03-01 09:39:42 +0100 |
commit | ec42940ea194f3089c5b2d29a06d61d7d03e94d9 (patch) | |
tree | 85c8a4dfe68f10b3d8c65854f67d21263aaca5de /common/ratp/ping.c | |
parent | 4cf99a772cf2494db74ff6872fae5bd2d2a03afa (diff) | |
download | barebox-ec42940ea194f3089c5b2d29a06d61d7d03e94d9.tar.gz barebox-ec42940ea194f3089c5b2d29a06d61d7d03e94d9.tar.xz |
ratp: implement ping as a standard ratp command
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/ratp/ping.c')
-rw-r--r-- | common/ratp/ping.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/common/ratp/ping.c b/common/ratp/ping.c new file mode 100644 index 0000000000..cc29ea36c6 --- /dev/null +++ b/common/ratp/ping.c @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +/* + * RATP ping + */ + +#include <common.h> +#include <ratp_bb.h> +#include <malloc.h> + +static int ratp_cmd_ping(const struct ratp_bb *req, int req_len, + struct ratp_bb **rsp, int *rsp_len) +{ + /* Just build response */ + *rsp_len = sizeof(struct ratp_bb); + *rsp = xzalloc(*rsp_len); + (*rsp)->type = cpu_to_be16(BB_RATP_TYPE_PONG); + return 0; +} + +BAREBOX_RATP_CMD_START(PING) + .request_id = BB_RATP_TYPE_PING, + .response_id = BB_RATP_TYPE_PONG, + .cmd = ratp_cmd_ping +BAREBOX_RATP_CMD_END |