updates.
[silc.git] / lib / silcutil / silcutil.h
1 /*
2
3   silcutil.h
4
5   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
6
7   Copyright (C) 1997 - 2000 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 2 of the License, or
12   (at your option) any later version.
13   
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19 */
20
21 #ifndef SILCUTIL_H
22 #define SILCUTIL_H
23
24 /* Prototypes */
25 char *silc_file_read(const char *filename, uint32 *return_len);
26 int silc_file_write(const char *filename, const char *buffer, uint32 len);
27 int silc_file_write_mode(const char *filename, const char *buffer, 
28                          uint32 len, int mode);
29 int silc_gets(char *dest, int destlen, const char *src, int srclen, int begin);
30 int silc_check_line(char *buf);
31 char *silc_get_time();
32 char *silc_to_upper(char *string);
33 char *silc_encode_pem(unsigned char *data, uint32 len);
34 char *silc_encode_pem_file(unsigned char *data, uint32 data_len);
35 unsigned char *silc_decode_pem(unsigned char *pem, uint32 pem_len,
36                                uint32 *ret_len);
37 bool silc_parse_userfqdn(const char *string, char **left, char **right);
38 void silc_parse_command_line(unsigned char *buffer, 
39                              unsigned char ***parsed,
40                              uint32 **parsed_lens,
41                              uint32 **parsed_types,
42                              uint32 *parsed_num,
43                              uint32 max_args);
44 char *silc_format(char *fmt, ...);
45 char *silc_id_render(void *id, uint16 type);
46 int silc_string_compare(char *string1, char *string2);
47 char *silc_string_regexify(const char *string);
48 int silc_string_regex_match(const char *regex, const char *string);
49 int silc_string_match(const char *string1, const char *string2);
50 char *silc_get_username();
51 char *silc_get_real_name();
52 uint32 silc_hash_string(void *key, void *user_context);
53 uint32 silc_hash_uint(void *key, void *user_context);
54 uint32 silc_hash_ptr(void *key, void *user_context);
55 uint32 silc_hash_id(void *key, void *user_context);
56 uint32 silc_hash_data(void *key, void *user_context);
57 bool silc_hash_string_compare(void *key1, void *key2, void *user_context);
58 bool silc_hash_id_compare(void *key1, void *key2, void *user_context);
59 bool silc_hash_client_id_compare(void *key1, void *key2, void *user_context);
60 bool silc_hash_data_compare(void *key1, void *key2, void *user_context);
61 char *silc_client_chmode(uint32 mode, const char *cipher, const char *hmac);
62 char *silc_client_chumode(uint32 mode);
63 char *silc_client_chumode_char(uint32 mode);
64 int silc_gettimeofday(struct timeval *p);
65
66 #endif