Did some stuff
[matches/swarm.git] / src / ssh.h
1 #ifndef _SSH_H
2 #define _SSH_H
3
4 #include "network.h"
5 #include "master.h"
6 #include "options.h"
7
8 #define SSH_DIR "~/.ssh/"
9 #define SSH_KNOWN_HOSTS "~/.ssh/known_hosts"
10
11 #include <libssh2.h>
12 #include <pthread.h>
13 #include <sys/select.h>
14 #include <sys/fcntl.h>
15
16 typedef struct
17 {
18         int forward_sock;
19         LIBSSH2_CHANNEL * channel;
20         int port;
21         
22 } ssh_tunnel;
23
24 typedef struct
25 {
26         ssh_tunnel * tunnel;
27         int nTunnels;
28         int reserved_tunnels;
29
30         int socket;
31         LIBSSH2_SESSION *session;
32         char * fingerprint;
33
34         char * user;
35         char * addr;
36 } ssh;
37
38 extern ssh * ssh_new(char * username, char * addr, int port);
39 extern void ssh_destroy(ssh * s);
40
41 extern void ssh_exec_swarm(ssh * s, int * port, int * socket, int np);
42 extern LIBSSH2_LISTENER * ssh_get_listener(ssh * s, int * port);
43 extern void ssh_add_tunnel(ssh * s, LIBSSH2_LISTENER * listener, int socket);
44
45 extern void * ssh_thread(void * args);
46 extern void ssh_thread_add(ssh * s);
47 extern void ssh_thread_del(ssh * s);
48
49
50 extern pthread_mutex_t ssh_thread_mutex;
51
52 extern pthread_t ssh_pthread;
53
54
55 #endif //_SSH_H
56
57 //EOF

UCC git Repository :: git.ucc.asn.au