blob: 441dea4f916acf782dd8951ef4eb30c2b89767c8 [file] [log] [blame]
Julian Hall8cff2b82020-11-23 18:12:17 +01001/*
2 * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef SERVICE_NAME_H
8#define SERVICE_NAME_H
9
10#include <stdbool.h>
11#include <stddef.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/*
18 * Check if it is valid service name with all the mandatory sections.
19 */
20bool sn_is_valid(const char *sn);
21
22/*
23 * Check naming authority. Returns true for match.
24 */
25bool sn_check_authority(const char *sn, const char *auth);
26
27/*
28 * Check the service portion of the service name. Returns true for match.
29 */
30bool sn_check_service(const char *sn, const char *service);
31
32/*
33 * Get the service instance number
34 */
35unsigned int sn_get_service_instance(const char *sn);
36
37/*
38 * Read the service field and copy the null terminated string
39 * to the provided buffer. Returns the copied string length,
40 * minus the zero terminator.
41 */
42size_t sn_read_service(const char *sn, char *buf, size_t buf_len);
43
44
45#ifdef __cplusplus
46}
47#endif
48
49#endif /* SERVICE_NAME_H */