Added lib/silcapputil for SILC application specific util routines.
[silc.git] / lib / silcutil / silcstrutil.c
index 348bdae052d61c0cde727b357c04142433b32bb9..614204dbde50666c6efa3b2eb0ff3904a47c27a9 100644 (file)
@@ -191,123 +191,3 @@ char *silc_strncat(char *dest, SilcUInt32 dest_size,
 
   return dest;
 }
-
-/* Checks that the 'identifier' string is valid identifier string
-   and does not contain any unassigned or prohibited character.  This
-   function is used to check for valid nicknames, channel names,
-   server names, usernames, hostnames, service names, algorithm names,
-   other security property names, and SILC Public Key name. */
-
-unsigned char *silc_identifier_check(const unsigned char *identifier,
-                                    SilcUInt32 identifier_len,
-                                    SilcStringEncoding identifier_encoding,
-                                    SilcUInt32 max_allowed_length,
-                                    SilcUInt32 *out_len)
-{
-  unsigned char *utf8s;
-  SilcUInt32 utf8s_len;
-  SilcStringprepStatus status;
-
-  if (!identifier || !identifier_len)
-    return NULL;
-
-  if (max_allowed_length && identifier_len > max_allowed_length)
-    return NULL;
-
-  status = silc_stringprep(identifier, identifier_len,
-                          identifier_encoding, SILC_IDENTIFIER_PREP, 0,
-                          &utf8s, &utf8s_len, SILC_STRING_UTF8);
-  if (status != SILC_STRINGPREP_OK) {
-    SILC_LOG_DEBUG(("silc_stringprep() status error %d", status));
-    return NULL;
-  }
-
-  if (out_len)
-    *out_len = utf8s_len;
-
-  return utf8s;
-}
-
-/* Same as above but does not allocate memory, just checks the
-   validity of the string. */
-
-SilcBool silc_identifier_verify(const unsigned char *identifier,
-                               SilcUInt32 identifier_len,
-                               SilcStringEncoding identifier_encoding,
-                               SilcUInt32 max_allowed_length)
-{
-  SilcStringprepStatus status;
-
-  if (!identifier || !identifier_len)
-    return FALSE;
-
-  if (max_allowed_length && identifier_len > max_allowed_length)
-    return FALSE;
-
-  status = silc_stringprep(identifier, identifier_len,
-                          identifier_encoding, SILC_IDENTIFIER_PREP, 0,
-                          NULL, NULL, SILC_STRING_UTF8);
-  if (status != SILC_STRINGPREP_OK) {
-    SILC_LOG_DEBUG(("silc_stringprep() status error %d", status));
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-unsigned char *silc_channel_name_check(const unsigned char *identifier,
-                                      SilcUInt32 identifier_len,
-                                      SilcStringEncoding identifier_encoding,
-                                      SilcUInt32 max_allowed_length,
-                                      SilcUInt32 *out_len)
-{
-  unsigned char *utf8s;
-  SilcUInt32 utf8s_len;
-  SilcStringprepStatus status;
-
-  if (!identifier || !identifier_len)
-    return NULL;
-
-  if (max_allowed_length && identifier_len > max_allowed_length)
-    return NULL;
-
-  status = silc_stringprep(identifier, identifier_len,
-                          identifier_encoding, SILC_IDENTIFIER_CH_PREP, 0,
-                          &utf8s, &utf8s_len, SILC_STRING_UTF8);
-  if (status != SILC_STRINGPREP_OK) {
-    SILC_LOG_DEBUG(("silc_stringprep() status error %d", status));
-    return NULL;
-  }
-
-  if (out_len)
-    *out_len = utf8s_len;
-
-  return utf8s;
-}
-
-/* Same as above but does not allocate memory, just checks the
-   validity of the string. */
-
-SilcBool silc_channel_name_verify(const unsigned char *identifier,
-                                 SilcUInt32 identifier_len,
-                                 SilcStringEncoding identifier_encoding,
-                                 SilcUInt32 max_allowed_length)
-{
-  SilcStringprepStatus status;
-
-  if (!identifier || !identifier_len)
-    return FALSE;
-
-  if (max_allowed_length && identifier_len > max_allowed_length)
-    return FALSE;
-
-  status = silc_stringprep(identifier, identifier_len,
-                          identifier_encoding, SILC_IDENTIFIER_CH_PREP, 0,
-                          NULL, NULL, SILC_STRING_UTF8);
-  if (status != SILC_STRINGPREP_OK) {
-    SILC_LOG_DEBUG(("silc_stringprep() status error %d", status));
-    return FALSE;
-  }
-
-  return TRUE;
-}