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