source: trunk/include/sh_tools.h@ 118

Last change on this file since 118 was 27, checked in by rainer, 19 years ago

Support for server-to-server relay and more user policies

File size: 2.4 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
18char * errorExplain (int err_num);
19#endif
20
21char * sh_tools_safe_name(const char * str, int flag);
22int is_numeric (const char * address);
23int connect_port (char * address, int port,
24 char * ecall, int * errnum, char * errmsg, int errsiz);
25int connect_port_2 (char * address1, char * address2, int port,
26 char * ecall, int * errnum, char * errmsg, int errsiz);
27void delete_cache(void);
28char * sh_tools_errmessage (int tellme);
29
30
31void sh_tools_show_header (unsigned char * head, char sign);
32
33#if defined (SH_WITH_SERVER)
34
35int get_open_max (void);
36
37void put_header (/*@out@*/unsigned char * head, int protocol,
38 unsigned long * length, char * u);
39
40int check_request_s (char * have, char * need, char * clt);
41int check_request_nerr (char * have, char * need);
42
43char * hash_me (char * key, char * buf, int buflen);
44int sh_tools_hash_vfy(char * key, char * buf, int buflen);
45
46char * get_client_conf_file (char * peer, unsigned long * length);
47char * get_client_data_file (char * peer, unsigned long * length);
48
49#endif
50
51unsigned 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
57unsigned long write_port (int sockfd, char *buf, unsigned long nbytes,
58 int * w_error, int timeout);
59
60int check_request (char * have, char * need);
61int check_request_nerr (char * have, char * need);
62
63void get_header (unsigned char * head, unsigned long * bytes, char * u);
64void 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
73void sh_tools_server_cmd(const char * srvcmd);
74
75int hash_check(char * key,
76 char * buf, int buflen);
77
78int 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)
82SL_TICKET open_tmp (void);
83int close_tmp (SL_TICKET fd);
84int rewind_tmp (SL_TICKET fd);
85#endif
86
87#endif
Note: See TracBrowser for help on using the repository browser.