static inline bool telnet_handle_command(struct net_pkt *pkt) { NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(cmd_access, struct telnet_simple_command); struct telnet_simple_command *cmd; cmd = (struct telnet_simple_command *)net_pkt_get_data_new(pkt, &cmd_access); if (!cmd || cmd->iac != NVT_CMD_IAC) { return false; } #ifdef CONFIG_TELNET_CONSOLE_SUPPORT_COMMAND LOG_DBG("Got a command %u/%u/%u", cmd->iac, cmd->op, cmd->opt); if (!k_sem_take(&cmd_lock, K_NO_WAIT)) { telnet_command_cpy(&telnet_cmd, cmd); k_sem_give(&cmd_lock); k_sem_give(&send_lock); } #endif /* CONFIG_TELNET_CONSOLE_SUPPORT_COMMAND */ return true; }
static inline bool telnet_handle_command(struct net_pkt *pkt) { struct telnet_simple_command *cmd = (struct telnet_simple_command *)net_pkt_appdata(pkt); if (cmd->iac != NVT_CMD_IAC) { return false; } #ifdef CONFIG_TELNET_CONSOLE_SUPPORT_COMMAND cmd = (struct telnet_simple_command *)l_start; SYS_LOG_DBG("Got a command %u/%u/%u", cmd->iac, cmd->op, cmd->opt); if (!k_sem_take(&cmd_lock, K_NO_WAIT)) { telnet_command_cpy(&telnet_cmd, cmd); k_sem_give(&cmd_lock); k_sem_give(&send_lock); } #endif /* CONFIG_TELNET_CONSOLE_SUPPORT_COMMAND */ return true; }