![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
prompt.h@114:472502b31a12, 2015-04-20 (annotated)
- Committer:
- klauss
- Date:
- Mon Apr 20 14:40:09 2015 +0000
- Revision:
- 114:472502b31a12
- Parent:
- 113:db67ae00550e
- Child:
- 116:39a41ebb675c
antes de implementar os retrys da header -> cbx
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 69:65665afbad5d | 1 | /** |
klauss | 69:65665afbad5d | 2 | * @file prompt.h |
klauss | 69:65665afbad5d | 3 | * @Synopsis Implementa as funcionalidades de prompt/prompt-eth da Header. |
klauss | 69:65665afbad5d | 4 | * @author Fernando Cola / Jhontan Casale |
klauss | 69:65665afbad5d | 5 | * @version 1 |
klauss | 69:65665afbad5d | 6 | * @date 2014-11-05 |
klauss | 69:65665afbad5d | 7 | */ |
klauss | 69:65665afbad5d | 8 | |
klauss | 17:67a6b557eda5 | 9 | #ifndef _PROMPT_H |
klauss | 17:67a6b557eda5 | 10 | #define _PROMPT_H |
klauss | 17:67a6b557eda5 | 11 | |
klauss | 74:81c47fff88a5 | 12 | #include <stdint.h> |
klauss | 44:cc4996469404 | 13 | #include "mbed.h" |
klauss | 74:81c47fff88a5 | 14 | #include "EthernetInterface.h" |
klauss | 114:472502b31a12 | 15 | #include "telemetry.h" // used for __TELEMETRY_SERVER_IP__ and __TELEMETRY_SERVER_PORT__ |
klauss | 74:81c47fff88a5 | 16 | #include "utils.h" // need for convert_ext_to_port() |
klauss | 44:cc4996469404 | 17 | #include "flood.h" |
klauss | 74:81c47fff88a5 | 18 | #include "shared_variables.h" |
klauss | 74:81c47fff88a5 | 19 | #include "debug.h" |
klauss | 74:81c47fff88a5 | 20 | #include "wdt_manager.h" |
klauss | 74:81c47fff88a5 | 21 | #include "file_system_manager.h" |
klauss | 99:e80850c51106 | 22 | #include "fw.h" |
klauss | 44:cc4996469404 | 23 | |
klauss | 97:8985817e8847 | 24 | #define PVERSION 25 |
klauss | 81:3656f00ab3db | 25 | |
klauss | 78:1353744f01e1 | 26 | #define TCP_IDLE_MAX_TIME 360//90 |
klauss | 78:1353744f01e1 | 27 | ///< Define o tempo maximo de espera por um novo comando via eth, dado que já estamos em uma sessão TCP. |
klauss | 78:1353744f01e1 | 28 | |
klauss | 78:1353744f01e1 | 29 | #define TCP_ALIVE_IDLE_MAX_TIME 360 |
klauss | 78:1353744f01e1 | 30 | ///< Define o tempo maximo de espera por um novo comando via eth dado que já estamos em uma sessão TCP e a flag tcp_alive esta on. |
klauss | 69:65665afbad5d | 31 | |
klauss | 114:472502b31a12 | 32 | #define DEBUGBUFSIZE 50 |
klauss | 69:65665afbad5d | 33 | ///< Define o tamanho do buffer de entrada de dados. |
klauss | 44:cc4996469404 | 34 | |
klauss | 17:67a6b557eda5 | 35 | extern uint8_t dog; |
klauss | 69:65665afbad5d | 36 | ///< Variável de controle que ativa a mensagem de boas vindas. |
klauss | 69:65665afbad5d | 37 | |
klauss | 69:65665afbad5d | 38 | extern FILE *fmask; ///< arquivo de mascara de rede |
klauss | 69:65665afbad5d | 39 | extern FILE *fgate; ///< arquivo de gateway ip |
klauss | 69:65665afbad5d | 40 | |
klauss | 69:65665afbad5d | 41 | extern FILE *fip; ///< arquivo de header ip |
klauss | 69:65665afbad5d | 42 | extern FILE *fext; ///< arquivo de header ext |
klauss | 69:65665afbad5d | 43 | extern FILE *fport; ///< arquivo de header sip port |
klauss | 69:65665afbad5d | 44 | |
klauss | 69:65665afbad5d | 45 | extern FILE *fsip; ///< arquivo de server sip ip |
klauss | 69:65665afbad5d | 46 | extern FILE *fserext; ///< arquivo de server sip ext |
klauss | 69:65665afbad5d | 47 | extern FILE *fsport; ///< arquivo de server sip port |
klauss | 69:65665afbad5d | 48 | |
klauss | 69:65665afbad5d | 49 | extern FILE *fudpport; ///< arquivo de porta udp que a header escuta |
klauss | 69:65665afbad5d | 50 | extern FILE *ftcpport; ///< arquivo de porta tcp que a header escuta |
klauss | 114:472502b31a12 | 51 | extern FILE *ftip; ///< arquivo de IP do servidor para envio de telemetria |
klauss | 114:472502b31a12 | 52 | extern FILE *ftport; ///< arquivo de Porta UDP do servidor para envio de telemetria |
klauss | 17:67a6b557eda5 | 53 | |
klauss | 74:81c47fff88a5 | 54 | extern bool flood_silence; |
klauss | 74:81c47fff88a5 | 55 | extern bool delayed_flood; |
klauss | 74:81c47fff88a5 | 56 | ///< Variável de controle do envio de pacotes de flood off |
klauss | 74:81c47fff88a5 | 57 | |
klauss | 78:1353744f01e1 | 58 | extern bool tcp_alive; |
klauss | 78:1353744f01e1 | 59 | ///< Flag que indica para não dar timeout na conexão tcp |
klauss | 78:1353744f01e1 | 60 | |
klauss | 114:472502b31a12 | 61 | extern Timer tcp_timer; |
klauss | 78:1353744f01e1 | 62 | ///< Timer responsavel por dar timeout por não utilização de recurso. |
klauss | 78:1353744f01e1 | 63 | |
klauss | 69:65665afbad5d | 64 | /** |
klauss | 69:65665afbad5d | 65 | * @Synopsis Principal função de processamento de comandos. |
klauss | 69:65665afbad5d | 66 | * |
klauss | 69:65665afbad5d | 67 | * \note Apesar de formalmente receber apenas um parâmetro, esta função verifica uma porta TCP para verificar eventual |
klauss | 69:65665afbad5d | 68 | * envio de comandos, processando qualquer comando enviado por um usuário ligado na rede. |
klauss | 69:65665afbad5d | 69 | * |
klauss | 69:65665afbad5d | 70 | * @param ethernet_pkg Uma string de comando que será analisada, caso seja um comando válido, executa-o. |
klauss | 69:65665afbad5d | 71 | * |
klauss | 69:65665afbad5d | 72 | * @return NULL, sempre retorna NULL. |
klauss | 69:65665afbad5d | 73 | * |
klauss | 69:65665afbad5d | 74 | * Exemplo: |
klauss | 69:65665afbad5d | 75 | * @code |
klauss | 69:65665afbad5d | 76 | * ... |
klauss | 69:65665afbad5d | 77 | * char * returned_prompt = prompt_process( NULL ); |
klauss | 69:65665afbad5d | 78 | * ... |
klauss | 69:65665afbad5d | 79 | * @endcode |
klauss | 69:65665afbad5d | 80 | */ |
klauss | 114:472502b31a12 | 81 | char * prompt_process( char * ethernet_pkg ); |
klauss | 69:65665afbad5d | 82 | |
klauss | 69:65665afbad5d | 83 | /** |
klauss | 69:65665afbad5d | 84 | * @Synopsis Init file system and check if files exist |
klauss | 69:65665afbad5d | 85 | * |
klauss | 69:65665afbad5d | 86 | * Exemplo: |
klauss | 69:65665afbad5d | 87 | * @code |
klauss | 69:65665afbad5d | 88 | * ... |
klauss | 69:65665afbad5d | 89 | * init_fsystem(); |
klauss | 69:65665afbad5d | 90 | * ... |
klauss | 69:65665afbad5d | 91 | * @endcode |
klauss | 69:65665afbad5d | 92 | */ |
klauss | 69:65665afbad5d | 93 | void init_fsystem(); |
klauss | 28:94aec56c6329 | 94 | |
klauss | 69:65665afbad5d | 95 | /** |
klauss | 69:65665afbad5d | 96 | * @Synopsis Inicializa o prompt e os sockets de conexão eth |
klauss | 69:65665afbad5d | 97 | * |
klauss | 69:65665afbad5d | 98 | * Exemplo: |
klauss | 69:65665afbad5d | 99 | * @code |
klauss | 69:65665afbad5d | 100 | * ... |
klauss | 69:65665afbad5d | 101 | * init_prompt(); |
klauss | 69:65665afbad5d | 102 | * ... |
klauss | 69:65665afbad5d | 103 | * @endcode |
klauss | 69:65665afbad5d | 104 | */ |
klauss | 78:1353744f01e1 | 105 | void init_prompt_eth(); |
klauss | 69:65665afbad5d | 106 | |
klauss | 44:cc4996469404 | 107 | extern char * debug_buf; |
klauss | 69:65665afbad5d | 108 | ///< Buffer de entrada dos dados via serial. |
klauss | 17:67a6b557eda5 | 109 | |
klauss | 17:67a6b557eda5 | 110 | #endif |