Files
@ d0a14f973771
Branch filter:
Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public/vmkernel64/release/lib/vmkapi_string.h
d0a14f973771
7.7 KiB
text/x-chdr
ESXi-5.0-U1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | /* **********************************************************
* Copyright 2010 VMware, Inc. All rights reserved.
* **********************************************************/
/*
* @VMKAPIMOD_LICENSE@
*/
/*
***********************************************************************
* String */ /**
* \addtogroup Lib
* @{
* \defgroup String Interfaces
*
* @{
***********************************************************************
*/
#ifndef _VMKAPI_STRING_H_
#define _VMKAPI_STRING_H_
/** \cond never */
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
#error This vmkapi file should never be included directly but only via vmkapi.h
#endif
/** \endcond never */
#include <stdarg.h>
/*
***********************************************************************
* vmk_StringCat -- */ /**
*
* \brief Appends the source string to the end of the destination string.
*
* \note This function will not block.
*
* \param[in] dst String to copy to.
* \param[in] src String to append from.
* \param[in] dstLen Length of destination buffer.
*
* \note dst will always be nul terminated so long as dstLen is greater
* than zero.
*
* \retval VMK_OK The string was successfully concatenated.
* \retval VMK_LIMIT_EXCEEDED The source string was too long to be
* copied fully into the destination. As
* much of the source string as possible was
* concatenated.
* \retval VMK_BAD_PARAM The source string or destination buffer
* is not valid.
*
***********************************************************************
*/
VMK_ReturnStatus vmk_StringCat(
char *dst,
const char *src,
vmk_ByteCount dstLen);
/*
***********************************************************************
* vmk_StringCopy -- */ /**
*
* \brief Copy a string up to a maximum number of bytes.
*
* \param[out] dst String to copy to.
* \param[in] src String to copy from.
* \param[in] dstLen Maximum number of bytes to copy into dst.
*
* \note dst will always be be nul terminated so long as dstLen is
* greater than zero.
* \note This function will not block.
*
* \retval VMK_OK The string was successfully copied.
* \retval VMK_LIMIT_EXCEEDED The source string was too long to be
* copied fully into the destination. As
* much of the source string as possible was
* copied.
* \retval VMK_BAD_PARAM The source string or destination buffer
* is not valid.
*
***********************************************************************
*/
VMK_ReturnStatus vmk_StringCopy(
char *dst,
const char *src,
vmk_ByteCount dstLen);
/*
***********************************************************************
* vmk_StringLCopy -- */ /**
*
* \brief Copy a string and ensure nul termination.
*
* \param[out] dst String to copy to.
* \param[in] src String to copy from.
* \param[in] dstLen Maximum number of bytes to store a string in dst.
* \param[out] outLen Number of bytes necessary. Optional: may pass
* NULL.
*
* \note dst will always be be nul terminated so long as dstLen is
* greater than zero.
* \note outLen will always be set to the number of bytes needed to
* successfully copy the src string, even if that copy is not
* successful, not including the nul terminator.
* \note This function will not block.
*
* \retval VMK_OK The string was successfully copied.
* \retval VMK_LIMIT_EXCEEDED The source string was too long to be
* copied fully into the destination. As
* much of the source string as possible was
* copied.
* \retval VMK_BAD_PARAM The source string or destination buffer
* is not valid.
*
***********************************************************************
*/
VMK_ReturnStatus vmk_StringLCopy(
char *dst,
const char *src,
vmk_ByteCount dstLen,
vmk_ByteCount *outLen);
/*
***********************************************************************
* vmk_StringFormat -- */ /**
*
* \brief Formats the provided format string and arguments into the
* destination buffer, up to a maximum bound.
*
* \param[in] str Buffer in which to place output.
* \param[in] strLen Maximum number of bytes to output.
* \param[out] outLen Number of bytes necessary to format this string,
* not including the terminating nul character.
* Optional: may pass NULL.
* \param[in] format Printf-style format string.
*
* \note str will always be be nul terminated so long as strLen is
* greater than zero.
* \note outLen will always be set to the number of bytes needed to
* successfully format the src string, even if that formatting
* is not successful, not including the nul terminator.
* \printformatstringdoc
* \note This function will not block.
*
* \retval VMK_OK The string was successfully formatted.
* \retval VMK_LIMIT_EXCEEDED The source string was too long to be
* formatted fully into the destination. As
* much of the specified format string as
* possible was formatted.
* \retval VMK_BAD_PARAM The format string or destination buffer
* is not valid.
*
***********************************************************************
*/
VMK_ReturnStatus vmk_StringFormat(
char *str,
vmk_ByteCount strLen,
vmk_ByteCount *outLen,
const char *format,
...)
VMK_ATTRIBUTE_PRINTF(4,5);
/*
***********************************************************************
* vmk_StringVFormat -- */ /**
*
* \brief Formats the provided format string and varargs into the
* destination buffer, up to a maximum bound.
*
* \param[in] str Buffer in which to place output.
* \param[in] strLen Maximum number of bytes to output.
* \param[out] outLen Number of bytes necessary to format this string,
* not including the terminating nul character.
* Optional: may pass NULL.
* \param[in] format Printf-style format string.
* \param[in] ap Varargs for format.
*
* \note str will always be be nul terminated so long as strLen is
* greater than zero.
* \note outLen will always be set to the number of bytes needed to
* successfully format the src string, even if that formatting
* is not successful, not including the nul terminator.
* \printformatstringdoc
* \note This function will not block.
*
* \retval VMK_OK The string was successfully formatted.
* \retval VMK_LIMIT_EXCEEDED The source string was too long to be
* formatted fully into the destination. As
* much of the specified format string as
* possible was formatted.
* \retval VMK_BAD_PARAM The format string or destination buffer
* is not valid.
*
***********************************************************************
*/
VMK_ReturnStatus vmk_StringVFormat(
char *str,
vmk_ByteCount strLen,
vmk_ByteCount *outLen,
const char *format,
va_list ap);
#endif /* _VMKAPI_STRING_H_ */
/** @} */
/** @} */
|