Tiny HTTP Client http://mbed.org/users/okini3939/notebook/tinyhttp

Dependencies:   EthernetNetIf mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TinyHTTP.h Source File

TinyHTTP.h

Go to the documentation of this file.
00001 /*
00002  * mbed Tiny HTTP Client
00003  * Copyright (c) 2011 Hiroshi Suga
00004  * Released under the MIT License: http://mbed.org/license/mit
00005  */
00006 
00007 /** @file
00008  * @brief Tiny HTTP Client
00009  */
00010 
00011 #ifndef TinyHTTP_h
00012 #define TinyHTTP_h
00013 
00014 #define DEBUG
00015 
00016 #define HTTP_PORT 80
00017 #define HTTP_TIMEOUT 15000 // ms
00018 
00019 #define METHOD_GET 0
00020 #define METHOD_POST 1
00021 
00022 /** send http request
00023  * @param method METHOD_GET or METHOD_POST
00024  * @param host http server
00025  * @param uri URI
00026  * @param head http header (CR+LF) (or NULL)
00027  * @param body POST body (or NULL)
00028  * @return http code, -1:failue
00029  */
00030 int httpRequest (int method, Host *host, char *uri, char *head, char *body);
00031 
00032 void createauth (char *user, char *pwd, char *buf, int len);
00033 
00034 int base64enc(const char *input, unsigned int length, char *output, int len);
00035 
00036 int urlencode(char *str, char *buf, int len);
00037 
00038 #endif