CDC/ECM driver for mbed, based on USBDevice by mbed-official. Uses PicoTCP to access Ethernet USB device. License: GPLv2

Dependents:   USBEthernet_TEST

Fork of USB_Ethernet by Daniele Lacamera

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pico_http_util.h Source File

pico_http_util.h

00001 /*********************************************************************
00002 PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved.
00003 See LICENSE and COPYING for usage.
00004 
00005 Author: Andrei Carp <andrei.carp@tass.be>
00006 *********************************************************************/
00007 
00008 #ifndef PICO_HTTP_UTIL_H_
00009 #define PICO_HTTP_UTIL_H_
00010 
00011 /* Informational reponses */
00012 #define HTTP_CONTINUE                         100u
00013 #define HTTP_SWITCHING_PROTOCOLS  101u
00014 #define HTTP_PROCESSING                      102u
00015 
00016 /* Success */
00017 #define HTTP_OK                                        200u
00018 #define HTTP_CREATED                            201u
00019 #define HTTP_ACCEPTED                            202u
00020 #define HTTP_NON_AUTH_INFO                203u
00021 #define HTTP_NO_CONTENT                        204u
00022 #define HTTP_RESET_CONTENT                205u
00023 #define HTTP_PARTIAL_CONTENT            206u
00024 #define HTTP_MULTI_STATUS                    207u
00025 #define HTTP_ALREADY_REPORTED            208u
00026 #define HTTP_LOW_SPACE                        250u
00027 #define HTTP_IM_SPACE                            226u
00028 
00029 /* Redirection */
00030 #define HTTP_MULTI_CHOICE                    300u
00031 #define HTTP_MOVED_PERMANENT            301u
00032 #define HTTP_FOUND                                302u
00033 #define HTTP_SEE_OTHER                        303u
00034 #define HTTP_NOT_MODIFIED                    304u
00035 #define HTTP_USE_PROXY                        305u
00036 #define HTTP_SWITCH_PROXY                    306u
00037 #define HTTP_TEMP_REDIRECT                307u
00038 #define HTTP_PERM_REDIRECT                308u
00039 
00040 /* Client error */
00041 #define HTTP_BAD_REQUEST                    400u
00042 #define HTTP_UNAUTH                                401u
00043 #define HTTP_PAYMENT_REQ                    402u
00044 #define HTTP_FORBIDDEN                        403u
00045 #define HTTP_NOT_FOUND                        404u
00046 #define HTTP_METH_NOT_ALLOWED            405u
00047 #define HTTP_NOT_ACCEPTABLE                406u
00048 #define HTTP_PROXY_AUTH_REQ                407u
00049 #define HTTP_REQ_TIMEOUT                    408u
00050 #define HTTP_CONFLICT                            409u
00051 #define HTTP_GONE                                    410u
00052 #define HTTP_LEN_REQ                            411u
00053 #define HTTP_PRECONDITION_FAIL        412u
00054 #define HTTP_REQ_ENT_LARGE                413u
00055 #define HTTP_URI_TOO_LONG                    414u
00056 #define HTTP_UNSUPORTED_MEDIA            415u
00057 #define HTTP_REQ_RANGE_NOK                416u
00058 #define HTTP_EXPECT_FAILED                417u
00059 #define HTTP_TEAPOT                                418u
00060 #define HTTP_UNPROC_ENTITY                422u
00061 #define HTTP_LOCKED                                423u
00062 #define HTTP_METHOD_FAIL                    424u
00063 #define HTTP_UNORDERED                        425u
00064 #define HTTP_UPGRADE_REQ                    426u
00065 #define HTTP_PRECOND_REQ                    428u
00066 #define HTTP_TOO_MANY_REQ                    429u
00067 #define HTTP_HEDER_FIELD_LARGE        431u
00068 
00069 /* Server error */
00070 #define HTTP_INTERNAL_SERVER_ERR    500u
00071 #define HTTP_NOT_IMPLEMENTED            501u
00072 #define HTTP_BAD_GATEWAY                    502u
00073 #define HTTP_SERVICE_UNAVAILABLE    503u
00074 #define HTTP_GATEWAY_TIMEOUT            504u
00075 #define HTTP_NOT_SUPPORTED                505u
00076 #define HTTP_SERV_LOW_STORAGE            507u
00077 #define HTTP_LOOP_DETECTED                508u
00078 #define HTTP_NOT_EXTENDED                    510u
00079 #define HTTP_NETWORK_AUTH                    511u
00080 #define HTTP_PERMISSION_DENIED        550u
00081 
00082 /* Returns used  */
00083 #define HTTP_RETURN_ERROR    -1
00084 #define HTTP_RETURN_OK                0
00085 
00086 /* List of events - shared between client and server */
00087 #define EV_HTTP_CON            1u
00088 #define EV_HTTP_REQ       2u
00089 #define EV_HTTP_PROGRESS  4u
00090 #define EV_HTTP_SENT          8u
00091 #define EV_HTTP_CLOSE     16u
00092 #define EV_HTTP_ERROR     32u
00093 #define EV_HTTP_BODY            64u
00094 #define EV_HTTP_DNS                128u
00095 
00096 #ifndef TRUE
00097     #define TRUE    1
00098 #endif
00099 
00100 #ifndef FALSE
00101     #define FALSE 0
00102 #endif
00103 
00104 struct pico_http_uri
00105 {
00106     uint8_t protoHttp; // is the protocol Http ?
00107     char * host;             // hostname
00108     uint16_t port;         // port if specified
00109     char * resource;     // resource , ignoring the other possible parameters
00110 };
00111 
00112 // used for chunks
00113 int pico_itoaHex(uint16_t port, char * ptr);
00114 int pico_itoa(uint16_t port, char * ptr);
00115 int pico_processURI(const char * uri, struct pico_http_uri * urikey);
00116 
00117 #endif /* PICO_HTTP_UTIL_H_ */