1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 /**
5  *****************************************************************************
6  * @file sal_string_parse.h
7  *
8  * @defgroup SalStringParse
9  *
10  * @ingroup SalStringParse
11  *
12  * @description
13  *     This file contains string parsing functions
14  *
15  *****************************************************************************/
16 
17 #ifndef SAL_STRING_PARSE_H
18 #define SAL_STRING_PARSE_H
19 
20 /* Maximum size of the strings used by SAL */
21 #define SAL_CFG_MAX_VAL_LEN_IN_BYTES 64
22 
23 /**
24 *******************************************************************************
25  * @ingroup SalStringParse
26  *      Builds a string and store it in result
27  *
28  * @description
29  *      The result string will be the concatenation of string1, instanceNumber
30  *      and string2. The size of result has to be SAL_CFG_MAX_VAL_LEN_IN_BYTES.
31  *      We can't check this in this function, this is the user responsibility
32  *
33  * @param[in]  string1          First string to concatenate
34  * @param[in]  instanceNumber   Instance number
35  * @param[in]  string2          Second string to concatenate
36  * @param[out] result           Resulting string of concatenation
37  *
38  * @retval CPA_STATUS_SUCCESS   Function executed successfully
39  * @retval CPA_STATUS_FAIL      Function failed
40  *
41  *****************************************************************************/
42 CpaStatus Sal_StringParsing(char *string1,
43 			    Cpa32U instanceNumber,
44 			    char *string2,
45 			    char *result);
46 
47 /**
48 *******************************************************************************
49  * @ingroup SalStringParse
50  *      Convert a string to an unsigned long
51  *
52  * @description
53  *      Parses the string cp in the specified base, and returned it as an
54  *      unsigned long value.
55  *
56  * @param[in]  cp       String to be converted
57  * @param[in]  endp     Pointer to the end of the string. This parameter
58  *                      can also be NULL and will not be used in this case
59  * @param[in]  cfgBase  Base to convert the string
60  *
61  * @retval  The string converted to an unsigned long
62  *
63  *****************************************************************************/
64 Cpa64U Sal_Strtoul(const char *cp, char **endp, unsigned int cfgBase);
65 
66 #endif /* SAL_STRING_PARSE_H */
67