libkylin-chkname/kylin-chkname.h

47 lines
1.1 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef KYLIN_USERNAME_CHECK_H
#define KYLIN_USERNAME_CHECK_H
#ifdef __cplusplus
extern "C" {
#endif
#define CHECK_SUCCESS 0
#define LENGTH_ERROR -1
#define REGEX_ERROR -2
#define RESERVED_ERROR -3
#define NAME_ERROR -4
#define OPEN_RESERVED_NAMES_ERROR -5
#define FIRST_CHAR_ERROR -6
#define HEX_ERROR -7
#define OCTAL_ERROR -8
#define NUMBERIC_ERROR -9
/*
* @brief 检测用户名是否合法
*
* @param name 待检测用户名
* @param reserve 是否过滤系统保留用户名
* 1表示过滤保留用户名为非法用户名0表示不过滤
*
* @return 用户名合法返回0用户名非法返回负数
*/
int kylin_username_check(const char *name, int reserve);
/*
* @brief 将返回值转为字符串描述
*
* @param err_num kylin_username_check接口返回值
*
* @return 参数err_num为已知错误时返回对应的字符串描述
* 未知错误返回“Unknown error”
*/
char *kylin_username_strerror(int err_num);
#ifdef __cplusplus
}
#endif
#endif /* KYLIN_USERNAME_CHECK_H */