aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/utils.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-10-03 17:41:59 +0800
committerHarald Welte <laforge@gnumonks.org>2017-10-24 16:00:44 +0000
commitfebe83c4243520ccc64544026d5f496ef945a9aa (patch)
treee1b160b672ab974725a3b1c8cf6fe2953afc3e22 /include/osmocom/core/utils.h
parentc8ef736370483df6feb761b49fccaa6790b6f8c2 (diff)
Introduce osmo_identifier_valid() function to check validity of identifier
We define the notion of an 'osmocom identifier' which is basically a 7-bit US-ASCII without any special characters beyond "-_:@". We introduce a function to verify if an identifier consists only of the permitted characters. Change-Id: I96a8d345c5a69238a12d040f39b70c485a5c421c
Diffstat (limited to 'include/osmocom/core/utils.h')
-rw-r--r--include/osmocom/core/utils.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index 4b083f6c..c5cc138b 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -22,6 +22,7 @@
/*! Number of bytes necessary to store given BITS */
#define OSMO_BYTES_FOR_BITS(BITS) ((BITS + 8 - 1) / 8)
+#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@@ -112,4 +113,6 @@ size_t osmo_strlcpy(char *dst, const char *src, size_t siz);
bool osmo_is_hexstr(const char *str, int min_digits, int max_digits,
bool require_even);
+bool osmo_identifier_valid(const char *str);
+
/*! @} */