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