![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
For PETEY
Dependencies: mbed EthernetNetIf
TinyHTTP.h@0:f2bf5f966801, 2011-07-27 (annotated)
- Committer:
- okini3939
- Date:
- Wed Jul 27 16:08:54 2011 +0000
- Revision:
- 0:f2bf5f966801
- Child:
- 2:764ecec3dc59
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
okini3939 | 0:f2bf5f966801 | 1 | /* |
okini3939 | 0:f2bf5f966801 | 2 | * mbed Tiny HTTP Client |
okini3939 | 0:f2bf5f966801 | 3 | * Copyright (c) 2011 Hiroshi Suga |
okini3939 | 0:f2bf5f966801 | 4 | * Released under the MIT License: http://mbed.org/license/mit |
okini3939 | 0:f2bf5f966801 | 5 | */ |
okini3939 | 0:f2bf5f966801 | 6 | |
okini3939 | 0:f2bf5f966801 | 7 | /** @file |
okini3939 | 0:f2bf5f966801 | 8 | * @brief Tiny HTTP Client |
okini3939 | 0:f2bf5f966801 | 9 | */ |
okini3939 | 0:f2bf5f966801 | 10 | |
okini3939 | 0:f2bf5f966801 | 11 | #ifndef TinyHTTP_h |
okini3939 | 0:f2bf5f966801 | 12 | #define TinyHTTP_h |
okini3939 | 0:f2bf5f966801 | 13 | |
okini3939 | 0:f2bf5f966801 | 14 | #define DEBUG |
okini3939 | 0:f2bf5f966801 | 15 | |
okini3939 | 0:f2bf5f966801 | 16 | #define HTTP_PORT 80 |
okini3939 | 0:f2bf5f966801 | 17 | #define HTTP_TIMEOUT 15000 // ms |
okini3939 | 0:f2bf5f966801 | 18 | |
okini3939 | 0:f2bf5f966801 | 19 | #define METHOD_GET 0 |
okini3939 | 0:f2bf5f966801 | 20 | #define METHOD_POST 1 |
okini3939 | 0:f2bf5f966801 | 21 | |
okini3939 | 0:f2bf5f966801 | 22 | /** send http request |
okini3939 | 0:f2bf5f966801 | 23 | * @param method METHOD_GET or METHOD_POST |
okini3939 | 0:f2bf5f966801 | 24 | * @param host http server |
okini3939 | 0:f2bf5f966801 | 25 | * @param uri URI |
okini3939 | 0:f2bf5f966801 | 26 | * @param head http header (CR+LF) (or NULL) |
okini3939 | 0:f2bf5f966801 | 27 | * @param body POST body (or NULL) |
okini3939 | 0:f2bf5f966801 | 28 | * @return http code, -1:failue |
okini3939 | 0:f2bf5f966801 | 29 | */ |
okini3939 | 0:f2bf5f966801 | 30 | int httpRequest (int method, Host *host, char *uri, char *head, char *body); |
okini3939 | 0:f2bf5f966801 | 31 | |
okini3939 | 0:f2bf5f966801 | 32 | #endif |