comparison cli-chansession.c @ 1461:fb90a5ba84e0

Merge pull request #49 from fperrad/20170812_lint Some linting, const parameters
author Matt Johnston <matt@ucc.asn.au>
date Thu, 25 Jan 2018 21:55:25 +0800
parents 58a74cb829b8
children 79eef94ccea9
comparison
equal deleted inserted replaced
1454:ef310db5ccec 1461:fb90a5ba84e0
33 #include "runopts.h" 33 #include "runopts.h"
34 #include "termcodes.h" 34 #include "termcodes.h"
35 #include "chansession.h" 35 #include "chansession.h"
36 #include "agentfwd.h" 36 #include "agentfwd.h"
37 37
38 static void cli_closechansess(struct Channel *channel); 38 static void cli_closechansess(const struct Channel *channel);
39 static int cli_initchansess(struct Channel *channel); 39 static int cli_initchansess(struct Channel *channel);
40 static void cli_chansessreq(struct Channel *channel); 40 static void cli_chansessreq(struct Channel *channel);
41 static void send_chansess_pty_req(struct Channel *channel); 41 static void send_chansess_pty_req(const struct Channel *channel);
42 static void send_chansess_shell_req(struct Channel *channel); 42 static void send_chansess_shell_req(const struct Channel *channel);
43 static void cli_escape_handler(struct Channel *channel, unsigned char* buf, int *len); 43 static void cli_escape_handler(const struct Channel *channel, const unsigned char* buf, int *len);
44 static int cli_init_netcat(struct Channel *channel); 44 static int cli_init_netcat(struct Channel *channel);
45 45
46 static void cli_tty_setup(void); 46 static void cli_tty_setup(void);
47 47
48 const struct ChanType clichansess = { 48 const struct ChanType clichansess = {
81 m_free(type); 81 m_free(type);
82 } 82 }
83 83
84 84
85 /* If the main session goes, we close it up */ 85 /* If the main session goes, we close it up */
86 static void cli_closechansess(struct Channel *UNUSED(channel)) { 86 static void cli_closechansess(const struct Channel *UNUSED(channel)) {
87 cli_tty_cleanup(); /* Restore tty modes etc */ 87 cli_tty_cleanup(); /* Restore tty modes etc */
88 88
89 /* This channel hasn't gone yet, so we have > 1 */ 89 /* This channel hasn't gone yet, so we have > 1 */
90 if (ses.chancount > 1) { 90 if (ses.chancount > 1) {
91 dropbear_log(LOG_INFO, "Waiting for other channels to close..."); 91 dropbear_log(LOG_INFO, "Waiting for other channels to close...");
268 } 268 }
269 } 269 }
270 cli_ses.winchange = 0; 270 cli_ses.winchange = 0;
271 } 271 }
272 272
273 static void send_chansess_pty_req(struct Channel *channel) { 273 static void send_chansess_pty_req(const struct Channel *channel) {
274 274
275 char* term = NULL; 275 char* term = NULL;
276 276
277 TRACE(("enter send_chansess_pty_req")) 277 TRACE(("enter send_chansess_pty_req"))
278 278
301 dropbear_exit("Signal error"); 301 dropbear_exit("Signal error");
302 } 302 }
303 TRACE(("leave send_chansess_pty_req")) 303 TRACE(("leave send_chansess_pty_req"))
304 } 304 }
305 305
306 static void send_chansess_shell_req(struct Channel *channel) { 306 static void send_chansess_shell_req(const struct Channel *channel) {
307 307
308 char* reqtype = NULL; 308 char* reqtype = NULL;
309 309
310 TRACE(("enter send_chansess_shell_req")) 310 TRACE(("enter send_chansess_shell_req"))
311 311
450 return 0; 450 return 0;
451 } 451 }
452 } 452 }
453 453
454 static 454 static
455 void cli_escape_handler(struct Channel* UNUSED(channel), unsigned char* buf, int *len) { 455 void cli_escape_handler(const struct Channel* UNUSED(channel), const unsigned char* buf, int *len) {
456 char c; 456 char c;
457 int skip_char = 0; 457 int skip_char = 0;
458 458
459 /* only handle escape characters if they are read one at a time. simplifies 459 /* only handle escape characters if they are read one at a time. simplifies
460 the code and avoids nasty people putting ~. at the start of a line to paste */ 460 the code and avoids nasty people putting ~. at the start of a line to paste */