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.
Dependents: lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more
PicoTCP. Copyright (c) 2013 TASS Belgium NV.
Released under the GNU General Public License, version 2.
Different licensing models may exist, at the sole discretion of the Copyright holders.
Official homepage: http://www.picotcp.com
Bug tracker: https://github.com/tass-belgium/picotcp/issues
Development steps:
initial integration with mbed RTOSgeneric mbed Ethernet driverhigh performance NXP LPC1768 specific Ethernet driverMulti-threading support for mbed RTOSBerkeley sockets and integration with the New Socket APIFork of the apps running on top of the New Socket APIScheduling optimizations- Debugging/benchmarking/testing
Demo application (measuring TCP sender performance):
Import programlpc1768-picotcp-demo
A PicoTCP demo app testing the ethernet throughput on the lpc1768 mbed board.
modules/pico_http_util.h@148:969fdb223792, 2014-03-11 (annotated)
- Committer:
- TASS Belgium NV
- Date:
- Tue Mar 11 15:34:51 2014 +0100
- Revision:
- 148:969fdb223792
- Parent:
- 131:4758606c9316
Fixed bug #92 in PicoTCP
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| tass | 68:0847e35d08a6 | 1 | /********************************************************************* |
| TASS Belgium NV |
131:4758606c9316 | 2 | PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved. |
| TASS Belgium NV |
131:4758606c9316 | 3 | See LICENSE and COPYING for usage. |
| tass | 68:0847e35d08a6 | 4 | |
| TASS Belgium NV |
131:4758606c9316 | 5 | Author: Andrei Carp <andrei.carp@tass.be> |
| TASS Belgium NV |
131:4758606c9316 | 6 | *********************************************************************/ |
| tass | 68:0847e35d08a6 | 7 | |
| tass | 68:0847e35d08a6 | 8 | #ifndef PICO_HTTP_UTIL_H_ |
| tass | 68:0847e35d08a6 | 9 | #define PICO_HTTP_UTIL_H_ |
| tass | 68:0847e35d08a6 | 10 | |
| tass | 68:0847e35d08a6 | 11 | /* Informational reponses */ |
| TASS Belgium NV |
131:4758606c9316 | 12 | #define HTTP_CONTINUE 100u |
| tass | 68:0847e35d08a6 | 13 | #define HTTP_SWITCHING_PROTOCOLS 101u |
| TASS Belgium NV |
131:4758606c9316 | 14 | #define HTTP_PROCESSING 102u |
| tass | 68:0847e35d08a6 | 15 | |
| tass | 68:0847e35d08a6 | 16 | /* Success */ |
| TASS Belgium NV |
131:4758606c9316 | 17 | #define HTTP_OK 200u |
| TASS Belgium NV |
131:4758606c9316 | 18 | #define HTTP_CREATED 201u |
| TASS Belgium NV |
131:4758606c9316 | 19 | #define HTTP_ACCEPTED 202u |
| TASS Belgium NV |
131:4758606c9316 | 20 | #define HTTP_NON_AUTH_INFO 203u |
| TASS Belgium NV |
131:4758606c9316 | 21 | #define HTTP_NO_CONTENT 204u |
| TASS Belgium NV |
131:4758606c9316 | 22 | #define HTTP_RESET_CONTENT 205u |
| TASS Belgium NV |
131:4758606c9316 | 23 | #define HTTP_PARTIAL_CONTENT 206u |
| TASS Belgium NV |
131:4758606c9316 | 24 | #define HTTP_MULTI_STATUS 207u |
| TASS Belgium NV |
131:4758606c9316 | 25 | #define HTTP_ALREADY_REPORTED 208u |
| TASS Belgium NV |
131:4758606c9316 | 26 | #define HTTP_LOW_SPACE 250u |
| TASS Belgium NV |
131:4758606c9316 | 27 | #define HTTP_IM_SPACE 226u |
| tass | 68:0847e35d08a6 | 28 | |
| tass | 68:0847e35d08a6 | 29 | /* Redirection */ |
| TASS Belgium NV |
131:4758606c9316 | 30 | #define HTTP_MULTI_CHOICE 300u |
| TASS Belgium NV |
131:4758606c9316 | 31 | #define HTTP_MOVED_PERMANENT 301u |
| TASS Belgium NV |
131:4758606c9316 | 32 | #define HTTP_FOUND 302u |
| TASS Belgium NV |
131:4758606c9316 | 33 | #define HTTP_SEE_OTHER 303u |
| TASS Belgium NV |
131:4758606c9316 | 34 | #define HTTP_NOT_MODIFIED 304u |
| TASS Belgium NV |
131:4758606c9316 | 35 | #define HTTP_USE_PROXY 305u |
| TASS Belgium NV |
131:4758606c9316 | 36 | #define HTTP_SWITCH_PROXY 306u |
| TASS Belgium NV |
131:4758606c9316 | 37 | #define HTTP_TEMP_REDIRECT 307u |
| TASS Belgium NV |
131:4758606c9316 | 38 | #define HTTP_PERM_REDIRECT 308u |
| tass | 68:0847e35d08a6 | 39 | |
| tass | 68:0847e35d08a6 | 40 | /* Client error */ |
| TASS Belgium NV |
131:4758606c9316 | 41 | #define HTTP_BAD_REQUEST 400u |
| TASS Belgium NV |
131:4758606c9316 | 42 | #define HTTP_UNAUTH 401u |
| TASS Belgium NV |
131:4758606c9316 | 43 | #define HTTP_PAYMENT_REQ 402u |
| TASS Belgium NV |
131:4758606c9316 | 44 | #define HTTP_FORBIDDEN 403u |
| TASS Belgium NV |
131:4758606c9316 | 45 | #define HTTP_NOT_FOUND 404u |
| TASS Belgium NV |
131:4758606c9316 | 46 | #define HTTP_METH_NOT_ALLOWED 405u |
| TASS Belgium NV |
131:4758606c9316 | 47 | #define HTTP_NOT_ACCEPTABLE 406u |
| TASS Belgium NV |
131:4758606c9316 | 48 | #define HTTP_PROXY_AUTH_REQ 407u |
| TASS Belgium NV |
131:4758606c9316 | 49 | #define HTTP_REQ_TIMEOUT 408u |
| TASS Belgium NV |
131:4758606c9316 | 50 | #define HTTP_CONFLICT 409u |
| TASS Belgium NV |
131:4758606c9316 | 51 | #define HTTP_GONE 410u |
| TASS Belgium NV |
131:4758606c9316 | 52 | #define HTTP_LEN_REQ 411u |
| TASS Belgium NV |
131:4758606c9316 | 53 | #define HTTP_PRECONDITION_FAIL 412u |
| TASS Belgium NV |
131:4758606c9316 | 54 | #define HTTP_REQ_ENT_LARGE 413u |
| TASS Belgium NV |
131:4758606c9316 | 55 | #define HTTP_URI_TOO_LONG 414u |
| TASS Belgium NV |
131:4758606c9316 | 56 | #define HTTP_UNSUPORTED_MEDIA 415u |
| TASS Belgium NV |
131:4758606c9316 | 57 | #define HTTP_REQ_RANGE_NOK 416u |
| TASS Belgium NV |
131:4758606c9316 | 58 | #define HTTP_EXPECT_FAILED 417u |
| TASS Belgium NV |
131:4758606c9316 | 59 | #define HTTP_TEAPOT 418u |
| TASS Belgium NV |
131:4758606c9316 | 60 | #define HTTP_UNPROC_ENTITY 422u |
| TASS Belgium NV |
131:4758606c9316 | 61 | #define HTTP_LOCKED 423u |
| TASS Belgium NV |
131:4758606c9316 | 62 | #define HTTP_METHOD_FAIL 424u |
| TASS Belgium NV |
131:4758606c9316 | 63 | #define HTTP_UNORDERED 425u |
| TASS Belgium NV |
131:4758606c9316 | 64 | #define HTTP_UPGRADE_REQ 426u |
| TASS Belgium NV |
131:4758606c9316 | 65 | #define HTTP_PRECOND_REQ 428u |
| TASS Belgium NV |
131:4758606c9316 | 66 | #define HTTP_TOO_MANY_REQ 429u |
| TASS Belgium NV |
131:4758606c9316 | 67 | #define HTTP_HEDER_FIELD_LARGE 431u |
| tass | 68:0847e35d08a6 | 68 | |
| tass | 68:0847e35d08a6 | 69 | /* Server error */ |
| TASS Belgium NV |
131:4758606c9316 | 70 | #define HTTP_INTERNAL_SERVER_ERR 500u |
| TASS Belgium NV |
131:4758606c9316 | 71 | #define HTTP_NOT_IMPLEMENTED 501u |
| TASS Belgium NV |
131:4758606c9316 | 72 | #define HTTP_BAD_GATEWAY 502u |
| TASS Belgium NV |
131:4758606c9316 | 73 | #define HTTP_SERVICE_UNAVAILABLE 503u |
| TASS Belgium NV |
131:4758606c9316 | 74 | #define HTTP_GATEWAY_TIMEOUT 504u |
| TASS Belgium NV |
131:4758606c9316 | 75 | #define HTTP_NOT_SUPPORTED 505u |
| TASS Belgium NV |
131:4758606c9316 | 76 | #define HTTP_SERV_LOW_STORAGE 507u |
| TASS Belgium NV |
131:4758606c9316 | 77 | #define HTTP_LOOP_DETECTED 508u |
| TASS Belgium NV |
131:4758606c9316 | 78 | #define HTTP_NOT_EXTENDED 510u |
| TASS Belgium NV |
131:4758606c9316 | 79 | #define HTTP_NETWORK_AUTH 511u |
| TASS Belgium NV |
131:4758606c9316 | 80 | #define HTTP_PERMISSION_DENIED 550u |
| tass | 68:0847e35d08a6 | 81 | |
| tass | 68:0847e35d08a6 | 82 | /* Returns used */ |
| tass | 68:0847e35d08a6 | 83 | #define HTTP_RETURN_ERROR -1 |
| TASS Belgium NV |
131:4758606c9316 | 84 | #define HTTP_RETURN_OK 0 |
| tass | 68:0847e35d08a6 | 85 | |
| tass | 68:0847e35d08a6 | 86 | /* List of events - shared between client and server */ |
| TASS Belgium NV |
131:4758606c9316 | 87 | #define EV_HTTP_CON 1u |
| tass | 68:0847e35d08a6 | 88 | #define EV_HTTP_REQ 2u |
| tass | 68:0847e35d08a6 | 89 | #define EV_HTTP_PROGRESS 4u |
| TASS Belgium NV |
131:4758606c9316 | 90 | #define EV_HTTP_SENT 8u |
| tass | 68:0847e35d08a6 | 91 | #define EV_HTTP_CLOSE 16u |
| tass | 68:0847e35d08a6 | 92 | #define EV_HTTP_ERROR 32u |
| TASS Belgium NV |
131:4758606c9316 | 93 | #define EV_HTTP_BODY 64u |
| TASS Belgium NV |
131:4758606c9316 | 94 | #define EV_HTTP_DNS 128u |
| tass | 68:0847e35d08a6 | 95 | |
| tass | 68:0847e35d08a6 | 96 | #ifndef TRUE |
| TASS Belgium NV |
131:4758606c9316 | 97 | #define TRUE 1 |
| tass | 68:0847e35d08a6 | 98 | #endif |
| tass | 68:0847e35d08a6 | 99 | |
| tass | 68:0847e35d08a6 | 100 | #ifndef FALSE |
| TASS Belgium NV |
131:4758606c9316 | 101 | #define FALSE 0 |
| tass | 68:0847e35d08a6 | 102 | #endif |
| tass | 68:0847e35d08a6 | 103 | |
| tass | 68:0847e35d08a6 | 104 | struct pico_http_uri |
| tass | 68:0847e35d08a6 | 105 | { |
| TASS Belgium NV |
131:4758606c9316 | 106 | uint8_t protoHttp; /* is the protocol Http ? */ |
| TASS Belgium NV |
131:4758606c9316 | 107 | char *host; /* hostname */ |
| TASS Belgium NV |
131:4758606c9316 | 108 | uint16_t port; /* port if specified */ |
| TASS Belgium NV |
131:4758606c9316 | 109 | char *resource; /* resource , ignoring the other possible parameters */ |
| tass | 68:0847e35d08a6 | 110 | }; |
| tass | 68:0847e35d08a6 | 111 | |
| TASS Belgium NV |
131:4758606c9316 | 112 | /* used for chunks */ |
| TASS Belgium NV |
131:4758606c9316 | 113 | int pico_itoaHex(uint16_t port, char *ptr); |
| TASS Belgium NV |
131:4758606c9316 | 114 | uint16_t pico_itoa(uint16_t port, char *ptr); |
| TASS Belgium NV |
131:4758606c9316 | 115 | int8_t pico_processURI(const char *uri, struct pico_http_uri *urikey); |
| tass | 68:0847e35d08a6 | 116 | |
| tass | 68:0847e35d08a6 | 117 | #endif /* PICO_HTTP_UTIL_H_ */ |
