source: trunk/include/sh_tools.h@ 487

Last change on this file since 487 was 481, checked in by katerina, 9 years ago

Enhancements and fixes for tickets #374, #375, #376, #377, #378, and #379.

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