source: trunk/include/sh_tools.h@ 582

Last change on this file since 582 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
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)
[481]10#define SH_PROTO_IVA (1 << 1)
[1]11#define SH_PROTO_MSG (1 << 2)
12#define SH_PROTO_BIG (1 << 3)
13#define SH_PROTO_END (1 << 4)
[481]14#define SH_PROTO_EN1 (1 << 5)
[1]15#define SH_PROTO_EN2 (1 << 6)
[481]16#define SH_PROTO_ENC (SH_PROTO_EN1|SH_PROTO_EN2)
[1]17#define SH_MASK_ENC (SH_PROTO_ENC|SH_PROTO_EN2)
18
19#ifdef SH_ENCRYPT
[132]20/* returns pointer to errbuf
21 */
22char * errorExplain (int err_num, char * errbuf, size_t len);
[1]23#endif
24
[197]25/* Returns non-zero if interface exists
26 */
27int sh_tools_iface_is_present(char *str);
28
[132]29/* returns allocated buffer
30 */
[1]31char * sh_tools_safe_name(const char * str, int flag);
[295]32
[1]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
[132]39/* returns pointer to errbuf
40 */
41char * sh_tools_errmessage (int tellme, char * errbuf, size_t len);
[1]42
[132]43
[1]44void sh_tools_show_header (unsigned char * head, char sign);
45
46#if defined (SH_WITH_SERVER)
47
[481]48unsigned char sh_tools_probe_store(unsigned char protocol, int * probe_flag);
49
[1]50int get_open_max (void);
51
[481]52void put_header (/*@out@*/unsigned char * head, const int protocol,
[1]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
[132]58/* returns allocated buffer
59 */
[1]60char * hash_me (char * key, char * buf, int buflen);
61int sh_tools_hash_vfy(char * key, char * buf, int buflen);
62
[132]63/* returns allocated buffer
64 */
[481]65char * get_client_conf_file (const char * peer, unsigned long * length);
[132]66
67/* returns allocated buffer
68 */
[481]69char * get_client_data_file (const char * peer, unsigned long * length);
[1]70
[481]71/* returns allocated buffer
72 */
73char * get_client_uuid_file (const char * peer, unsigned long * length, const char * uuid);
[1]74#endif
75
[481]76
[1]77unsigned long read_port (int sockfd, char *buf, unsigned long nbytes,
78 int * w_error, int timeout);
79
80
[27]81#if defined (SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
[1]82
[481]83void sh_tools_probe_reset();
84
[1]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
[27]95/*
96 SL_TICKET open_tmp (void);
97 int close_tmp (SL_TICKET fd);
98 int rewind_tmp (SL_TICKET fd);
99*/
[1]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
[27]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
[1]114
115#endif
Note: See TracBrowser for help on using the repository browser.