Axeda Ready Demo for Freescale FRDM-KL46Z as accident alert system
Dependencies: FRDM_MMA8451Q KL46Z-USBHost MAG3110 SocketModem TSI mbed FATFileSystem
Fork of AxedaGo-Freescal_FRDM-KL46Z revert by
axHTTP.h
00001 /************************************************************************************/ 00002 /* axHTTP.h */ 00003 /* �2013 Axeda Corporation */ 00004 /* */ 00005 /*Provides a basic, bare bones implementation of the HTTP 1.1 protocol spec to allow*/ 00006 /*this library to be more platform independent. The function calls in this file */ 00007 /*depend on the socket calls provided in axTransport */ 00008 /* */ 00009 /************************************************************************************/ 00010 #ifndef AXHTTP_H 00011 #define AXHTTP_H 00012 00013 //#include "axTransport.h" 00014 00015 #define AX_HTTP_GET 0 //Standard GET Operation 00016 #define AX_HTTP_POST 1 //Standard HTTP Post operation 00017 #define AX_HTTP_MPOST 2 //Multipart form data operation, POST 00018 #define AX_HTTP_PUT 3 00019 00020 00021 00022 typedef struct { 00023 // char *host; ..Host is passed in when sending to the 00024 char *contentType; 00025 }HTTP_Headers; 00026 00027 typedef struct HTTP_Part{ 00028 char *file_name; 00029 unsigned char *data; 00030 int data_sz; 00031 char *hint; 00032 struct HTTP_Part *next; 00033 }HTTP_Part; 00034 00035 typedef struct { 00036 int operation; //POST, GET, MPOST. 00037 char *resource; //A pointer to a string that the resource is identified by 00038 HTTP_Headers headers; //a structure of headers for the request 00039 char *body; //the body of the request, used only for post and mpost 00040 int body_length; //the length of the main body, used only for post and mpost 00041 HTTP_Part *mpData; //the first link in a chain of data to be uploaded as part of a multipart post request 00042 int response_code; //For responses only, this field will be populated after calling http_parse 00043 int secure; //use SSL or TLS 00044 }HTTP_Transmission; 00045 00046 //Flag used to turn on debug x-count header. 00047 extern int http_debug; 00048 00049 struct ax_socket; //incomplete declaration, see axTransport.h for full declaration 00050 00051 #ifdef __cplusplus 00052 extern "C" { 00053 #endif 00054 00055 00056 //Operations 00057 int http_send(HTTP_Transmission *request, char *host, int port, int secure, HTTP_Transmission *response); 00058 int http_send_get(char *resource, char *host, int port, int secure, HTTP_Transmission *response); 00059 int http_send_put(char *resource, char *host, int port, int secure, HTTP_Headers *headers, char *data, int data_sz, HTTP_Transmission *response); 00060 int http_send_post(char *resource, char *host, int port, int secure, HTTP_Headers *headers, char *data, int data_sz, HTTP_Transmission *response); 00061 int http_send_mpost(char *resource, char *host, int port, int secure, HTTP_Headers *headers, char *data, int data_sz, HTTP_Part *files, int part_ct, HTTP_Transmission *response); 00062 void http_add_mpart(HTTP_Transmission *request, char *file_name, unsigned char *data, int file_sz); //For Future expansion, do not use. 00063 00064 //Return Handling 00065 HTTP_Transmission *http_parse(HTTP_Transmission *response, char *data); 00066 00067 //Supporting Methods 00068 char *http_getBoundary(char *buff, int length); 00069 void zeroOutHTTPXmission(HTTP_Transmission *tgt); 00070 char *createHeaders(char *tgtBuff, int http_operation, char *resource, int httpver, char *hostname, char *contentType, int contentLength, int xCount); 00071 00072 #ifdef __cplusplus 00073 } 00074 #endif 00075 #endif 00076
Generated on Wed Jul 13 2022 02:45:01 by 1.7.2