X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcutil.h;h=57c5b1db9434d3013ab603097fa1dfbafd241995;hb=413da0f8686910f5e627393157566ae729ca99c4;hp=1618b4ff1893f6ab43596f404e6c38cc57557a87;hpb=b3e67d3dfa6409755be33f352b5a86fbb094a570;p=silc.git diff --git a/lib/silcutil/silcutil.h b/lib/silcutil/silcutil.h index 1618b4ff..57c5b1db 100644 --- a/lib/silcutil/silcutil.h +++ b/lib/silcutil/silcutil.h @@ -63,27 +63,42 @@ int silc_check_line(char *buf); * * SYNOPSIS * - * char *silc_get_time(); + * const char *silc_get_time(SilcUInt32 timeval) * * DESCRIPTION * - * Returns current time as string. + * Returns time as string. If the the `timeval' is non-zero that + * value is returned as string. If it is zero the current time of the + * local machine is returned. * ***/ -char *silc_get_time(); +const char *silc_get_time(SilcUInt32 timeval); /****f* silcutil/SilcUtilAPI/silc_to_upper * * SYNOPSIS * - * char *silc_to_upper(char *string); + * bool silc_to_upper(const char *string, char *dest, SilcUInt32 dest_size); * * DESCRIPTION * * Converts string to capital characters. * ***/ -char *silc_to_upper(char *string); +bool silc_to_upper(const char *string, char *dest, SilcUInt32 dest_size); + +/****f* silcutil/SilcUtilAPI/silc_to_lower + * + * SYNOPSIS + * + * bool silc_to_lower(const char *string, char *dest, SilcUInt32 dest_size); + * + * DESCRIPTION + * + * Converts string to capital characters. + * + ***/ +bool silc_to_lower(const char *string, char *dest, SilcUInt32 dest_size); /****f* silcutil/SilcUtilAPI/silc_parse_userfqdn * @@ -220,6 +235,19 @@ SilcUInt32 silc_hash_ptr(void *key, void *user_context); ***/ SilcUInt32 silc_hash_id(void *key, void *user_context); +/****f* silcutil/SilcUtilAPI/silc_hash_client_id_hash + * + * SYNOPSIS + * + * SilcUInt32 silc_hash_client_id_hash(void *key, void *user_context) + * + * DESCRIPTION + * + * Hash Client ID's hash. + * + ***/ +SilcUInt32 silc_hash_client_id_hash(void *key, void *user_context); + /****f* silcutil/SilcUtilAPI/silc_hash_data * * SYNOPSIS @@ -365,7 +393,8 @@ char *silc_client_chumode_char(SilcUInt32 mode); * * DESCRIPTION * - * Creates fingerprint from data, usually used with SHA1 digests. + * Return a textual representation of the fingerprint in *data, the + * caller must free the returned string. * ***/ char *silc_fingerprint(const unsigned char *data, SilcUInt32 data_len); @@ -433,13 +462,174 @@ SilcUInt32 silc_version_to_num(const char *version); ***/ char *silc_get_input(const char *prompt, bool echo_off); -/* XXX - System dependant prototypes */ +/* System dependant prototypes */ +/****f* silcutil/SilcUtilAPI/silc_gettimeofday + * + * SYNOPSIS + * + * int silc_gettimeofday(struct timeval *p); + * + * DESCRIPTION + * + * Return current time to struct timeval. This function is system + * dependant. Returns 0 on success and -1 on error. + * + ***/ int silc_gettimeofday(struct timeval *p); + +/****f* silcutil/SilcUtilAPI/silc_compare_timeval + * + * SYNOPSIS + * + * bool silc_compare_timeval(struct timeval *smaller, + * struct timeval *bigger) + * + * DESCRIPTION + * + * Compare two timeval structures and return TRUE if the first + * time value is smaller than the second time value. + * + ***/ +bool silc_compare_timeval(struct timeval *smaller, + struct timeval *bigger); + +/****f* silcutil/SilcUtilAPI/silc_string_regexify + * + * SYNOPSIS + * + * char *silc_string_regexify(const char *string); + * + * DESCRIPTION + * + * Inspects the `string' for wildcards and returns regex string that can + * be used by the GNU regex library. A comma (`,') in the `string' means + * that the string is list. + * + * This function is system dependant. + * + ***/ char *silc_string_regexify(const char *string); + +/****f* silcutil/SilcUtilAPI/silc_string_regex_match + * + * SYNOPSIS + * + * int silc_string_regex_match(const char *regex, const char *string); + * + * DESCRIPTION + * + * Matches the two strings and returns TRUE if the strings match. + * + * This function is system dependant. + * + ***/ int silc_string_regex_match(const char *regex, const char *string); + +/****f* silcutil/SilcUtilAPI/silc_string_match + * + * SYNOPSIS + * + * int silc_string_match(const char *string1, const char *string2); + * + * DESCRIPTION + * + * Do regex match to the two strings `string1' and `string2'. If the + * `string2' matches the `string1' this returns TRUE. + * + * This function is system dependant. + * + ***/ int silc_string_match(const char *string1, const char *string2); + +/****f* silcutil/SilcUtilAPI/silc_get_username + * + * SYNOPSIS + * + * char *silc_get_username(); + * + * DESCRIPTION + * + * Returns the username of the user. If the global variable LOGNAME + * does not exists we will get the name from the passwd file. The + * caller must free the returned name. + * + * This function is system dependant. + * + ***/ char *silc_get_username(); + +/****f* silcutil/SilcUtilAPI/silc_get_real_name + * + * SYNOPSIS + * + * char *silc_get_real_name(); + * + * DESCRIPTION + * + * Returns the real name of ther user from the passwd file. The + * caller must free the returned name. + * + * This function is system dependant. + * + ***/ char *silc_get_real_name(); +/****f* silcutil/SilcUtilAPI/silc_get_mode_list + * + * SYNOPSIS + * + * bool silc_get_mode_list(SilcBuffer mode_list, SilcUInt32 mode_list_count, + * SilcUInt32 **list); + * + * DESCRIPTION + * + * Returns modes from list of 32 bit MSB first order values that are + * encoded one after the other in the `mode_list' into the `list' + * array. The caller must free the returned list. Return FALSE if + * there is error parsing the list. + * + ***/ +bool silc_get_mode_list(SilcBuffer mode_list, SilcUInt32 mode_list_count, + SilcUInt32 **list); + +/****f* silcutil/SilcUtilAPI/silc_get_status_message + * + * SYNOPSIS + * + * char *silc_get_status_message(SilcStatus status) + * + * DESCRIPTION + * + * Returns status message string + * + ***/ +const char *silc_get_status_message(unsigned char status); + +/****f* silcutil/SilcUtilAPI/silc_get_packet_name + * + * SYNOPSIS + * + * char *silc_get_packet_name(SilcPacketType type); + * + * DESCRIPTION + * + * Returns the name corresponding packet type `type'. + * + ***/ +const char *silc_get_packet_name(unsigned char type); + +/****f* silcutil/SilcUtilAPI/silc_get_command_name + * + * SYNOPSIS + * + * char *silc_get_command_name(SilcCommand command); + * + * DESCRIPTION + * + * Returns the name corresponding SILC command `command'. + * + ***/ +const char *silc_get_command_name(unsigned char command); + #endif /* !SILCUTIL_H */