Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Timezone NTPClient
websrv_help_functions.h@4:fe9189193dcd, 2020-11-13 (annotated)
- Committer:
- hudakz
- Date:
- Fri Nov 13 09:37:14 2020 +0000
- Revision:
- 4:fe9189193dcd
- Parent:
- 0:f78e57015038
A remote timer, equipped with a scheduling Web interface, controls a "DigitalOut".
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| hudakz | 0:f78e57015038 | 1 | /********************************************* |
| hudakz | 0:f78e57015038 | 2 | * vim:sw=8:ts=8:si:et |
| hudakz | 0:f78e57015038 | 3 | * To use the above modeline in vim you must have "set modeline" in your .vimrc |
| hudakz | 0:f78e57015038 | 4 | * Author: Guido Socher |
| hudakz | 0:f78e57015038 | 5 | * Copyright: LGPL V2 |
| hudakz | 0:f78e57015038 | 6 | * See http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html |
| hudakz | 0:f78e57015038 | 7 | * |
| hudakz | 0:f78e57015038 | 8 | * Some common utilities needed for IP and web applications. |
| hudakz | 0:f78e57015038 | 9 | * The defines below are controlled via ip_config.h. By choosing |
| hudakz | 0:f78e57015038 | 10 | * the right defines for your application in ip_config.h you can |
| hudakz | 0:f78e57015038 | 11 | * significantly reduce the size of the resulting code. |
| hudakz | 0:f78e57015038 | 12 | *********************************************/ |
| hudakz | 0:f78e57015038 | 13 | //@{ |
| hudakz | 0:f78e57015038 | 14 | #ifndef WEBSRV_HELP_FUNCTIONS_H |
| hudakz | 0:f78e57015038 | 15 | #define WEBSRV_HELP_FUNCTIONS_H |
| hudakz | 0:f78e57015038 | 16 | //#include "ip_config.h" |
| hudakz | 0:f78e57015038 | 17 | #include "stdint.h" |
| hudakz | 0:f78e57015038 | 18 | |
| hudakz | 0:f78e57015038 | 19 | #define FROMDECODE_websrv_help |
| hudakz | 0:f78e57015038 | 20 | #define URLENCODE_websrv_help |
| hudakz | 0:f78e57015038 | 21 | |
| hudakz | 0:f78e57015038 | 22 | #ifdef __cplusplus |
| hudakz | 0:f78e57015038 | 23 | extern "C" { |
| hudakz | 0:f78e57015038 | 24 | #endif |
| hudakz | 0:f78e57015038 | 25 | |
| hudakz | 0:f78e57015038 | 26 | #ifdef FROMDECODE_websrv_help |
| hudakz | 0:f78e57015038 | 27 | // These functions are documented in websrv_help_functions.c. |
| hudakz | 0:f78e57015038 | 28 | // find_key_val searches for key=value pairs in urls, returns 1 if the key was found (may be empty string) and returns 0 if the key was not found: |
| hudakz | 0:f78e57015038 | 29 | extern uint8_t find_key_val(char *str,char *strbuf, uint8_t maxlen,char *key); |
| hudakz | 0:f78e57015038 | 30 | |
| hudakz | 0:f78e57015038 | 31 | extern void urldecode(char *urlbuf); // decode a url string e.g "hello%20joe" or "hello+joe" becomes "hello joe" |
| hudakz | 0:f78e57015038 | 32 | #endif |
| hudakz | 0:f78e57015038 | 33 | #ifdef URLENCODE_websrv_help |
| hudakz | 0:f78e57015038 | 34 | extern void urlencode(const char *str,char *urlbuf); // result goes into urlbuf. There must be enough space in urlbuf. In the worst case that would be 3 times the length of str. |
| hudakz | 0:f78e57015038 | 35 | #endif |
| hudakz | 0:f78e57015038 | 36 | // parse a string that is an IP address and extract the IP to bytestr |
| hudakz | 0:f78e57015038 | 37 | extern uint8_t parse_ip(uint8_t *ip_byte_str,const char *str); |
| hudakz | 0:f78e57015038 | 38 | extern void mk_net_str(char *resultstr,uint8_t *ip_byte_str,uint8_t len,char separator,uint8_t base); |
| hudakz | 0:f78e57015038 | 39 | |
| hudakz | 0:f78e57015038 | 40 | #ifdef __cplusplus |
| hudakz | 0:f78e57015038 | 41 | } |
| hudakz | 0:f78e57015038 | 42 | #endif |
| hudakz | 0:f78e57015038 | 43 | |
| hudakz | 0:f78e57015038 | 44 | #endif /* WEBSRV_HELP_FUNCTIONS_H */ |
| hudakz | 0:f78e57015038 | 45 | //@} |
| hudakz | 0:f78e57015038 | 46 |