source: trunk/include/sh_tools.h@ 225

Last change on this file since 225 was 197, checked in by katerina, 16 years ago

Rewrite of code for conditionals in configuration file, supports more tests now (ticket #129).

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