mirror of
https://github.com/linux-msm/hexagonrpc.git
synced 2026-10-07 15:29:50 -07:00
The code for opening and closing a remote interface with an error is duplicated in hexagonrpcd and chrecd. Like the remotectl interface itself, the error handling is useful for most FastRPC applications. Add a new API for opening and closing remote interfaces with error checking. Signed-off-by: Richard Acayan <mailingradian@gmail.com>
42 lines
1.2 KiB
C
42 lines
1.2 KiB
C
/*
|
|
* FastRPC handle utilities
|
|
*
|
|
* Copyright (C) 2025 HexagonRPC Contributors
|
|
*
|
|
* This file is part of HexagonRPC.
|
|
*
|
|
* HexagonRPC is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* 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.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef LIBHEXAGONRPC_HANDLE_H
|
|
#define LIBHEXAGONRPC_HANDLE_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
/*
|
|
* Open a remote interface by name and get its handle.
|
|
*
|
|
* On success, returns 0 and sets the handle.
|
|
* On failure, returns -1 and sets the err string.
|
|
*/
|
|
int hexagonrpc_open(int fd, const char *name, uint32_t *hdl, size_t n_err, char *err);
|
|
|
|
/*
|
|
* Close a remote interface by its handle.
|
|
*/
|
|
void hexagonrpc_close(int fd, uint32_t hdl);
|
|
|
|
#endif /* LIBHEXAGONRPC_HANDLE_H */
|