source: trunk/include/sh_tools.h@ 193

Last change on this file since 193 was 132, checked in by rainer, 17 years ago

Make utility functions thread-safe.

File size: 2.6 KB
RevLine 
[1]1#ifndef SH_TOOLS_H
2#define SH_TOOLS_H
3
4#define SH_DO_WRITE 0
5#define SH_DO_READ 1
6
7/* protocols
8 */
9#define SH_PROTO_SRP (1 << 0)
10#define SH_PROTO_MSG (1 << 2)
11#define SH_PROTO_BIG (1 << 3)
12#define SH_PROTO_END (1 << 4)
13#define SH_PROTO_ENC (1 << 5)
14#define SH_PROTO_EN2 (1 << 6)
15#define SH_MASK_ENC (SH_PROTO_ENC|SH_PROTO_EN2)
16
17#ifdef SH_ENCRYPT
[132]18/* returns pointer to errbuf
19 */
20char * errorExplain (int err_num, char * errbuf, size_t len);
[1]21#endif
22
[132]23/* returns allocated buffer
24 */
[1]25char * sh_tools_safe_name(const char * str, int flag);
26int is_numeric (const char * address);
27int connect_port (char * address, int port,
28 char * ecall, int * errnum, char * errmsg, int errsiz);
29int connect_port_2 (char * address1, char * address2, int port,
30 char * ecall, int * errnum, char * errmsg, int errsiz);
31void delete_cache(void);
32
[132]33/* returns pointer to errbuf
34 */
35char * sh_tools_errmessage (int tellme, char * errbuf, size_t len);
[1]36
[132]37
[1]38void sh_tools_show_header (unsigned char * head, char sign);
39
40#if defined (SH_WITH_SERVER)
41
42int get_open_max (void);
43
44void put_header (/*@out@*/unsigned char * head, int protocol,
45 unsigned long * length, char * u);
46
47int check_request_s (char * have, char * need, char * clt);
48int check_request_nerr (char * have, char * need);
49
[132]50/* returns allocated buffer
51 */
[1]52char * hash_me (char * key, char * buf, int buflen);
53int sh_tools_hash_vfy(char * key, char * buf, int buflen);
54
[132]55/* returns allocated buffer
56 */
[1]57char * get_client_conf_file (char * peer, unsigned long * length);
[132]58
59/* returns allocated buffer
60 */
[1]61char * get_client_data_file (char * peer, unsigned long * length);
62
63#endif
64
65unsigned long read_port (int sockfd, char *buf, unsigned long nbytes,
66 int * w_error, int timeout);
67
68
[27]69#if defined (SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
[1]70
71unsigned long write_port (int sockfd, char *buf, unsigned long nbytes,
72 int * w_error, int timeout);
73
74int check_request (char * have, char * need);
75int check_request_nerr (char * have, char * need);
76
77void get_header (unsigned char * head, unsigned long * bytes, char * u);
78void put_header (unsigned char * head, int protocol,
79 unsigned long * length, char * u);
80
[27]81/*
82 SL_TICKET open_tmp (void);
83 int close_tmp (SL_TICKET fd);
84 int rewind_tmp (SL_TICKET fd);
85*/
[1]86
87void sh_tools_server_cmd(const char * srvcmd);
88
89int hash_check(char * key,
90 char * buf, int buflen);
91
92int sh_tools_hash_add(char * key, char * buf, int buflen);
93#endif
94
[27]95#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) || defined(SH_STEALTH) || defined(WITH_GPG) || defined(WITH_PGP)
96SL_TICKET open_tmp (void);
97int close_tmp (SL_TICKET fd);
98int rewind_tmp (SL_TICKET fd);
99#endif
[1]100
101#endif
Note: See TracBrowser for help on using the repository browser.