void connman_dbus_dict_append_variant(DBusMessageIter *dict,
const char *key, int type, void *val);
+dbus_bool_t connman_dbus_validate_ident(const char *ident);
char *connman_dbus_encode_string(const char *value);
#ifdef __cplusplus
#endif
#include <string.h>
+#include <dbus/dbus.h>
#include "connman.h"
+dbus_bool_t connman_dbus_validate_ident(const char *ident)
+{
+ unsigned int i;
+
+ if (ident == NULL)
+ return FALSE;
+
+ for (i = 0; i < strlen(ident); i++) {
+ if (ident[i] >= '0' && ident[i] <= '9')
+ continue;
+ if (ident[i] >= 'a' && ident[i] <= 'z')
+ continue;
+ if (ident[i] >= 'A' && ident[i] <= 'Z')
+ continue;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
char *connman_dbus_encode_string(const char *value)
{
GString *str;