@@ -34,15 +34,15 @@ LOG_MODULE_REGISTER(LOG_DOMAIN);
34
34
#include "telnet_protocol.h"
35
35
36
36
/* Various definitions mapping the telnet service configuration options */
37
- #define TELNET_PORT CONFIG_TELNET_CONSOLE_PORT
38
- #define TELNET_STACK_SIZE CONFIG_TELNET_CONSOLE_THREAD_STACK
39
- #define TELNET_PRIORITY CONFIG_TELNET_CONSOLE_PRIO
40
- #define TELNET_LINES CONFIG_TELNET_CONSOLE_LINE_BUF_NUMBERS
41
- #define TELNET_LINE_SIZE CONFIG_TELNET_CONSOLE_LINE_BUF_SIZE
42
- #define TELNET_TIMEOUT K_MSEC(CONFIG_TELNET_CONSOLE_SEND_TIMEOUT)
43
- #define TELNET_THRESHOLD CONFIG_TELNET_CONSOLE_SEND_THRESHOLD
37
+ #define TELNET_PORT CONFIG_TELNET_CONSOLE_PORT
38
+ #define TELNET_STACK_SIZE CONFIG_TELNET_CONSOLE_THREAD_STACK
39
+ #define TELNET_PRIORITY CONFIG_TELNET_CONSOLE_PRIO
40
+ #define TELNET_LINES CONFIG_TELNET_CONSOLE_LINE_BUF_NUMBERS
41
+ #define TELNET_LINE_SIZE CONFIG_TELNET_CONSOLE_LINE_BUF_SIZE
42
+ #define TELNET_TIMEOUT K_MSEC(CONFIG_TELNET_CONSOLE_SEND_TIMEOUT)
43
+ #define TELNET_THRESHOLD CONFIG_TELNET_CONSOLE_SEND_THRESHOLD
44
44
45
- #define TELNET_MIN_MSG 2
45
+ #define TELNET_MIN_MSG 2
46
46
47
47
/* These 2 structures below are used to store the console output
48
48
* before sending it to the client. This is done to keep some
@@ -191,7 +191,7 @@ static int telnet_console_out(int c)
191
191
lb -> buf [lb -> len ++ ] = (char )c ;
192
192
193
193
if (c == '\n' || lb -> len == TELNET_LINE_SIZE - 1 ) {
194
- lb -> buf [lb -> len - 1 ] = NVT_CR ;
194
+ lb -> buf [lb -> len - 1 ] = NVT_CR ;
195
195
lb -> buf [lb -> len ++ ] = NVT_LF ;
196
196
telnet_rb_switch ();
197
197
yield = true;
@@ -314,8 +314,7 @@ static inline void telnet_reply_command(void)
314
314
telnet_reply_do_command ();
315
315
break ;
316
316
default :
317
- LOG_DBG ("Operation %u not handled" ,
318
- telnet_cmd .op );
317
+ LOG_DBG ("Operation %u not handled" , telnet_cmd .op );
319
318
break ;
320
319
}
321
320
@@ -349,7 +348,7 @@ static inline bool telnet_handle_command(struct net_pkt *pkt)
349
348
k_sem_give (& cmd_lock );
350
349
k_sem_give (& send_lock );
351
350
}
352
- #endif /* CONFIG_TELNET_CONSOLE_SUPPORT_COMMAND */
351
+ #endif /* CONFIG_TELNET_CONSOLE_SUPPORT_COMMAND */
353
352
354
353
return true;
355
354
}
@@ -381,13 +380,13 @@ static inline void telnet_handle_input(struct net_pkt *pkt)
381
380
net_frag_read (pkt -> frags , offset , & pos , len , (u8_t * )input -> line );
382
381
383
382
/* LF/CR will be removed if only the line is not NUL terminated */
384
- if (input -> line [len - 1 ] != NVT_NUL ) {
385
- if (input -> line [len - 1 ] == NVT_LF ) {
386
- input -> line [len - 1 ] = NVT_NUL ;
383
+ if (input -> line [len - 1 ] != NVT_NUL ) {
384
+ if (input -> line [len - 1 ] == NVT_LF ) {
385
+ input -> line [len - 1 ] = NVT_NUL ;
387
386
}
388
387
389
- if (input -> line [len - 2 ] == NVT_CR ) {
390
- input -> line [len - 2 ] = NVT_NUL ;
388
+ if (input -> line [len - 2 ] == NVT_CR ) {
389
+ input -> line [len - 2 ] = NVT_NUL ;
391
390
}
392
391
}
393
392
@@ -403,8 +402,8 @@ static void telnet_recv(struct net_context *client,
403
402
telnet_end_client_connection ();
404
403
405
404
LOG_DBG ("Telnet client dropped (AF_INET%s) status %d" ,
406
- net_context_get_family (client ) == AF_INET ?
407
- "" : "6" , status );
405
+ net_context_get_family (client ) == AF_INET ?
406
+ "" : "6" , status );
408
407
return ;
409
408
}
410
409
@@ -445,7 +444,7 @@ static void telnet_accept(struct net_context *client,
445
444
446
445
if (net_context_recv (client , telnet_recv , 0 , NULL )) {
447
446
LOG_ERR ("Unable to setup reception (family %u)" ,
448
- net_context_get_family (client ));
447
+ net_context_get_family (client ));
449
448
goto error ;
450
449
}
451
450
@@ -454,7 +453,7 @@ static void telnet_accept(struct net_context *client,
454
453
}
455
454
456
455
LOG_DBG ("Telnet client connected (family AF_INET%s)" ,
457
- net_context_get_family (client ) == AF_INET ? "" : "6" );
456
+ net_context_get_family (client ) == AF_INET ? "" : "6" );
458
457
459
458
orig_printk_hook = __printk_get_hook ();
460
459
__printk_hook_install (telnet_console_out );
@@ -477,7 +476,7 @@ static void telnet_setup_server(struct net_context **ctx, sa_family_t family,
477
476
478
477
if (net_context_bind (* ctx , addr , addrlen )) {
479
478
LOG_ERR ("Cannot bind on family AF_INET%s" ,
480
- family == AF_INET ? "" : "6" );
479
+ family == AF_INET ? "" : "6" );
481
480
goto error ;
482
481
}
483
482
@@ -492,12 +491,12 @@ static void telnet_setup_server(struct net_context **ctx, sa_family_t family,
492
491
}
493
492
494
493
LOG_DBG ("Telnet console enabled on AF_INET%s" ,
495
- family == AF_INET ? "" : "6" );
494
+ family == AF_INET ? "" : "6" );
496
495
497
496
return ;
498
497
error :
499
498
LOG_ERR ("Unable to start telnet on AF_INET%s" ,
500
- family == AF_INET ? "" : "6" );
499
+ family == AF_INET ? "" : "6" );
501
500
502
501
if (* ctx ) {
503
502
net_context_put (* ctx );
0 commit comments