Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "zebra.h"
#include <string.h>
#include <ctype.h>
return 0;
return 1;
}
+
+
+char *frrstr_hex(char *buff, size_t bufsiz, const uint8_t *str, size_t num)
+{
+ if (bufsiz == 0)
+ return buff;
+
+ char tmp[3];
+
+ buff[0] = '\0';
+
+ for (size_t i = 0; i < num; i++) {
+ snprintf(tmp, sizeof(tmp), "%02x", (unsigned char)str[i]);
+ strlcat(buff, tmp, bufsiz);
+ }
+
+ return buff;
+}
*/
int all_digit(const char *str);
+/*
+ * Copy the hexadecimal representation of the string to a buffer.
+ *
+ * buff
+ * Buffer to copy result into with size of at least (2 * num) + 1.
+ *
+ * bufsiz
+ * Size of destination buffer.
+ *
+ * str
+ * String to represent as hexadecimal.
+ *
+ * num
+ * Number of characters to copy.
+ *
+ * Returns:
+ * Pointer to buffer containing resulting hexadecimal representation.
+ */
+char *frrstr_hex(char *buff, size_t bufsiz, const uint8_t *str, size_t num);
+
#ifdef __cplusplus
}
#endif