comparison session.h @ 26:0969767bca0d

snapshot of stuff
author Matt Johnston <matt@ucc.asn.au>
date Mon, 26 Jul 2004 02:44:20 +0000
parents 469950e86d0f
children f789045062e6
comparison
equal deleted inserted replaced
25:e4b6e2d569b2 26:0969767bca0d
24 24
25 #ifndef _SESSION_H_ 25 #ifndef _SESSION_H_
26 #define _SESSION_H_ 26 #define _SESSION_H_
27 27
28 #include "includes.h" 28 #include "includes.h"
29 #include "options.h"
29 #include "buffer.h" 30 #include "buffer.h"
30 #include "signkey.h" 31 #include "signkey.h"
31 #include "kex.h" 32 #include "kex.h"
32 #include "auth.h" 33 #include "auth.h"
33 #include "channel.h" 34 #include "channel.h"
36 #include "packet.h" 37 #include "packet.h"
37 38
38 extern int sessinitdone; /* Is set to 0 somewhere */ 39 extern int sessinitdone; /* Is set to 0 somewhere */
39 extern int exitflag; 40 extern int exitflag;
40 41
41 void common_session_init(int sock); 42 void common_session_init(int sock, char* remotehost);
43 void session_loop(void(*loophandler)());
42 void common_session_cleanup(); 44 void common_session_cleanup();
43 void checktimeouts(); 45 void checktimeouts();
44 void session_identification(); 46 void session_identification();
45 47
46 extern void(*session_remoteclosed)(); 48 extern void(*session_remoteclosed)();
47 49
48 /* Server */ 50 /* Server */
49 void svr_session(int sock, int childpipe, struct sockaddr *remoteaddr); 51 void svr_session(int sock, int childpipe, char *remotehost);
50 void svr_dropbear_exit(int exitcode, const char* format, va_list param); 52 void svr_dropbear_exit(int exitcode, const char* format, va_list param);
51 void svr_dropbear_log(int priority, const char* format, va_list param); 53 void svr_dropbear_log(int priority, const char* format, va_list param);
52 54
55 /* Client */
56 void cli_session(int sock, char *remotehost);
57 void cli_dropbear_exit(int exitcode, const char* format, va_list param);
58 void cli_dropbear_log(int priority, const char* format, va_list param);
53 59
54 struct key_context { 60 struct key_context {
55 61
56 const struct dropbear_cipher *recv_algo_crypt; /* NULL for none */ 62 const struct dropbear_cipher *recv_algo_crypt; /* NULL for none */
57 const struct dropbear_cipher *trans_algo_crypt; /* NULL for none */ 63 const struct dropbear_cipher *trans_algo_crypt; /* NULL for none */
83 long connecttimeout; /* time to disconnect if we have a timeout (for 89 long connecttimeout; /* time to disconnect if we have a timeout (for
84 userauth etc), or 0 for no timeout */ 90 userauth etc), or 0 for no timeout */
85 91
86 int sock; 92 int sock;
87 93
88 struct sockaddr *remoteaddr;
89 unsigned char *remotehost; /* the peer hostname */ 94 unsigned char *remotehost; /* the peer hostname */
95
90 unsigned char *remoteident; 96 unsigned char *remoteident;
91 97
92 int maxfd; /* the maximum file descriptor to check with select() */ 98 int maxfd; /* the maximum file descriptor to check with select() */
93 99
94 100
164 struct ChildPid * childpids; /* array of mappings childpid<->channel */ 170 struct ChildPid * childpids; /* array of mappings childpid<->channel */
165 unsigned int childpidsize; 171 unsigned int childpidsize;
166 172
167 }; 173 };
168 174
169 175 typedef enum {
176 NOTHING,
177 KEXINIT_RCVD,
178 KEXDH_INIT_SENT,
179 KEXDH_REPLY_RCVD,
180
181 } cli_state;
170 182
171 struct clientsession { 183 struct clientsession {
172 184
185 mp_int *dh_e, *dh_x; /* Used during KEX */
186 cli_state state; /* Used to progress the KEX/auth/channelsession etc */
173 int something; /* XXX */ 187 int something; /* XXX */
188 unsigned donefirstkex : 1; /* Set when we set sentnewkeys, never reset */
174 189
175 }; 190 };
176 191
177 /* Global structs storing the state */ 192 /* Global structs storing the state */
178 extern struct sshsession ses; 193 extern struct sshsession ses;
180 #ifdef DROPBEAR_SERVER 195 #ifdef DROPBEAR_SERVER
181 extern struct serversession svr_ses; 196 extern struct serversession svr_ses;
182 #endif /* DROPBEAR_SERVER */ 197 #endif /* DROPBEAR_SERVER */
183 198
184 #ifdef DROPBEAR_CLIENT 199 #ifdef DROPBEAR_CLIENT
185 extern struct serversession cli_ses; 200 extern struct clientsession cli_ses;
186 #endif /* DROPBEAR_CLIENT */ 201 #endif /* DROPBEAR_CLIENT */
187 202
188 #endif /* _SESSION_H_ */ 203 #endif /* _SESSION_H_ */