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
|
---|
18 | char * errorExplain (int err_num);
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | char * sh_tools_safe_name(const char * str, int flag);
|
---|
22 | int is_numeric (const char * address);
|
---|
23 | int connect_port (char * address, int port,
|
---|
24 | char * ecall, int * errnum, char * errmsg, int errsiz);
|
---|
25 | int connect_port_2 (char * address1, char * address2, int port,
|
---|
26 | char * ecall, int * errnum, char * errmsg, int errsiz);
|
---|
27 | void delete_cache(void);
|
---|
28 | char * sh_tools_errmessage (int tellme);
|
---|
29 |
|
---|
30 |
|
---|
31 | void sh_tools_show_header (unsigned char * head, char sign);
|
---|
32 |
|
---|
33 | #if defined (SH_WITH_SERVER)
|
---|
34 |
|
---|
35 | int get_open_max (void);
|
---|
36 |
|
---|
37 | void put_header (/*@out@*/unsigned char * head, int protocol,
|
---|
38 | unsigned long * length, char * u);
|
---|
39 |
|
---|
40 | int check_request_s (char * have, char * need, char * clt);
|
---|
41 | int check_request_nerr (char * have, char * need);
|
---|
42 |
|
---|
43 | char * hash_me (char * key, char * buf, int buflen);
|
---|
44 | int sh_tools_hash_vfy(char * key, char * buf, int buflen);
|
---|
45 |
|
---|
46 | char * get_client_conf_file (char * peer, unsigned long * length);
|
---|
47 | char * get_client_data_file (char * peer, unsigned long * length);
|
---|
48 |
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | unsigned long read_port (int sockfd, char *buf, unsigned long nbytes,
|
---|
52 | int * w_error, int timeout);
|
---|
53 |
|
---|
54 |
|
---|
55 | #if defined (SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
|
---|
56 |
|
---|
57 | unsigned long write_port (int sockfd, char *buf, unsigned long nbytes,
|
---|
58 | int * w_error, int timeout);
|
---|
59 |
|
---|
60 | int check_request (char * have, char * need);
|
---|
61 | int check_request_nerr (char * have, char * need);
|
---|
62 |
|
---|
63 | void get_header (unsigned char * head, unsigned long * bytes, char * u);
|
---|
64 | void put_header (unsigned char * head, int protocol,
|
---|
65 | unsigned long * length, char * u);
|
---|
66 |
|
---|
67 | /*
|
---|
68 | SL_TICKET open_tmp (void);
|
---|
69 | int close_tmp (SL_TICKET fd);
|
---|
70 | int rewind_tmp (SL_TICKET fd);
|
---|
71 | */
|
---|
72 |
|
---|
73 | void sh_tools_server_cmd(const char * srvcmd);
|
---|
74 |
|
---|
75 | int hash_check(char * key,
|
---|
76 | char * buf, int buflen);
|
---|
77 |
|
---|
78 | int sh_tools_hash_add(char * key, char * buf, int buflen);
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) || defined(SH_STEALTH) || defined(WITH_GPG) || defined(WITH_PGP)
|
---|
82 | SL_TICKET open_tmp (void);
|
---|
83 | int close_tmp (SL_TICKET fd);
|
---|
84 | int rewind_tmp (SL_TICKET fd);
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | #endif
|
---|