[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 | */
|
---|
| 22 | char * errorExplain (int err_num, char * errbuf, size_t len);
|
---|
[1] | 23 | #endif
|
---|
| 24 |
|
---|
[197] | 25 | /* Returns non-zero if interface exists
|
---|
| 26 | */
|
---|
| 27 | int sh_tools_iface_is_present(char *str);
|
---|
| 28 |
|
---|
[132] | 29 | /* returns allocated buffer
|
---|
| 30 | */
|
---|
[1] | 31 | char * sh_tools_safe_name(const char * str, int flag);
|
---|
[295] | 32 |
|
---|
[1] | 33 | int connect_port (char * address, int port,
|
---|
| 34 | char * ecall, int * errnum, char * errmsg, int errsiz);
|
---|
| 35 | int connect_port_2 (char * address1, char * address2, int port,
|
---|
| 36 | char * ecall, int * errnum, char * errmsg, int errsiz);
|
---|
| 37 | void delete_cache(void);
|
---|
| 38 |
|
---|
[132] | 39 | /* returns pointer to errbuf
|
---|
| 40 | */
|
---|
| 41 | char * sh_tools_errmessage (int tellme, char * errbuf, size_t len);
|
---|
[1] | 42 |
|
---|
[132] | 43 |
|
---|
[1] | 44 | void sh_tools_show_header (unsigned char * head, char sign);
|
---|
| 45 |
|
---|
| 46 | #if defined (SH_WITH_SERVER)
|
---|
| 47 |
|
---|
[481] | 48 | unsigned char sh_tools_probe_store(unsigned char protocol, int * probe_flag);
|
---|
| 49 |
|
---|
[1] | 50 | int get_open_max (void);
|
---|
| 51 |
|
---|
[481] | 52 | void put_header (/*@out@*/unsigned char * head, const int protocol,
|
---|
[1] | 53 | unsigned long * length, char * u);
|
---|
| 54 |
|
---|
| 55 | int check_request_s (char * have, char * need, char * clt);
|
---|
| 56 | int check_request_nerr (char * have, char * need);
|
---|
| 57 |
|
---|
[132] | 58 | /* returns allocated buffer
|
---|
| 59 | */
|
---|
[1] | 60 | char * hash_me (char * key, char * buf, int buflen);
|
---|
| 61 | int sh_tools_hash_vfy(char * key, char * buf, int buflen);
|
---|
| 62 |
|
---|
[132] | 63 | /* returns allocated buffer
|
---|
| 64 | */
|
---|
[481] | 65 | char * get_client_conf_file (const char * peer, unsigned long * length);
|
---|
[132] | 66 |
|
---|
| 67 | /* returns allocated buffer
|
---|
| 68 | */
|
---|
[481] | 69 | char * get_client_data_file (const char * peer, unsigned long * length);
|
---|
[1] | 70 |
|
---|
[481] | 71 | /* returns allocated buffer
|
---|
| 72 | */
|
---|
| 73 | char * get_client_uuid_file (const char * peer, unsigned long * length, const char * uuid);
|
---|
[1] | 74 | #endif
|
---|
| 75 |
|
---|
[481] | 76 |
|
---|
[1] | 77 | unsigned 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] | 83 | void sh_tools_probe_reset();
|
---|
| 84 |
|
---|
[1] | 85 | unsigned long write_port (int sockfd, char *buf, unsigned long nbytes,
|
---|
| 86 | int * w_error, int timeout);
|
---|
| 87 |
|
---|
| 88 | int check_request (char * have, char * need);
|
---|
| 89 | int check_request_nerr (char * have, char * need);
|
---|
| 90 |
|
---|
| 91 | void get_header (unsigned char * head, unsigned long * bytes, char * u);
|
---|
| 92 | void 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 |
|
---|
| 101 | void sh_tools_server_cmd(const char * srvcmd);
|
---|
| 102 |
|
---|
| 103 | int hash_check(char * key,
|
---|
| 104 | char * buf, int buflen);
|
---|
| 105 |
|
---|
| 106 | int 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)
|
---|
| 110 | SL_TICKET open_tmp (void);
|
---|
| 111 | int close_tmp (SL_TICKET fd);
|
---|
| 112 | int rewind_tmp (SL_TICKET fd);
|
---|
| 113 | #endif
|
---|
[1] | 114 |
|
---|
| 115 | #endif
|
---|