Free (GPLv2) TCP/IP stack developed by TASS Belgium

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 RTOS
  • generic mbed Ethernet driver
  • high performance NXP LPC1768 specific Ethernet driver
  • Multi-threading support for mbed RTOS
  • Berkeley sockets and integration with the New Socket API
  • Fork of the apps running on top of the New Socket API
  • Scheduling 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.

Committer:
tass
Date:
Fri Oct 18 09:41:50 2013 +0000
Revision:
101:37763e3777a7
Parent:
70:cd218dd180e5
Child:
131:4758606c9316
merge with mainline Issue #39

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tass 68:0847e35d08a6 1 /*********************************************************************
tass 68:0847e35d08a6 2 PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved.
tass 68:0847e35d08a6 3 See LICENSE and COPYING for usage.
tass 68:0847e35d08a6 4
tass 68:0847e35d08a6 5 Author: Andrei Carp <andrei.carp@tass.be>
tass 68:0847e35d08a6 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 68:0847e35d08a6 12 #define HTTP_CONTINUE 100u
tass 68:0847e35d08a6 13 #define HTTP_SWITCHING_PROTOCOLS 101u
tass 68:0847e35d08a6 14 #define HTTP_PROCESSING 102u
tass 68:0847e35d08a6 15
tass 68:0847e35d08a6 16 /* Success */
tass 68:0847e35d08a6 17 #define HTTP_OK 200u
tass 68:0847e35d08a6 18 #define HTTP_CREATED 201u
tass 68:0847e35d08a6 19 #define HTTP_ACCEPTED 202u
tass 68:0847e35d08a6 20 #define HTTP_NON_AUTH_INFO 203u
tass 68:0847e35d08a6 21 #define HTTP_NO_CONTENT 204u
tass 68:0847e35d08a6 22 #define HTTP_RESET_CONTENT 205u
tass 68:0847e35d08a6 23 #define HTTP_PARTIAL_CONTENT 206u
tass 68:0847e35d08a6 24 #define HTTP_MULTI_STATUS 207u
tass 68:0847e35d08a6 25 #define HTTP_ALREADY_REPORTED 208u
tass 68:0847e35d08a6 26 #define HTTP_LOW_SPACE 250u
tass 68:0847e35d08a6 27 #define HTTP_IM_SPACE 226u
tass 68:0847e35d08a6 28
tass 68:0847e35d08a6 29 /* Redirection */
tass 68:0847e35d08a6 30 #define HTTP_MULTI_CHOICE 300u
tass 68:0847e35d08a6 31 #define HTTP_MOVED_PERMANENT 301u
tass 68:0847e35d08a6 32 #define HTTP_FOUND 302u
tass 68:0847e35d08a6 33 #define HTTP_SEE_OTHER 303u
tass 68:0847e35d08a6 34 #define HTTP_NOT_MODIFIED 304u
tass 68:0847e35d08a6 35 #define HTTP_USE_PROXY 305u
tass 68:0847e35d08a6 36 #define HTTP_SWITCH_PROXY 306u
tass 68:0847e35d08a6 37 #define HTTP_TEMP_REDIRECT 307u
tass 68:0847e35d08a6 38 #define HTTP_PERM_REDIRECT 308u
tass 68:0847e35d08a6 39
tass 68:0847e35d08a6 40 /* Client error */
tass 68:0847e35d08a6 41 #define HTTP_BAD_REQUEST 400u
tass 68:0847e35d08a6 42 #define HTTP_UNAUTH 401u
tass 68:0847e35d08a6 43 #define HTTP_PAYMENT_REQ 402u
tass 68:0847e35d08a6 44 #define HTTP_FORBIDDEN 403u
tass 68:0847e35d08a6 45 #define HTTP_NOT_FOUND 404u
tass 68:0847e35d08a6 46 #define HTTP_METH_NOT_ALLOWED 405u
tass 68:0847e35d08a6 47 #define HTTP_NOT_ACCEPTABLE 406u
tass 68:0847e35d08a6 48 #define HTTP_PROXY_AUTH_REQ 407u
tass 68:0847e35d08a6 49 #define HTTP_REQ_TIMEOUT 408u
tass 68:0847e35d08a6 50 #define HTTP_CONFLICT 409u
tass 68:0847e35d08a6 51 #define HTTP_GONE 410u
tass 68:0847e35d08a6 52 #define HTTP_LEN_REQ 411u
tass 68:0847e35d08a6 53 #define HTTP_PRECONDITION_FAIL 412u
tass 68:0847e35d08a6 54 #define HTTP_REQ_ENT_LARGE 413u
tass 68:0847e35d08a6 55 #define HTTP_URI_TOO_LONG 414u
tass 68:0847e35d08a6 56 #define HTTP_UNSUPORTED_MEDIA 415u
tass 68:0847e35d08a6 57 #define HTTP_REQ_RANGE_NOK 416u
tass 68:0847e35d08a6 58 #define HTTP_EXPECT_FAILED 417u
tass 68:0847e35d08a6 59 #define HTTP_TEAPOT 418u
tass 68:0847e35d08a6 60 #define HTTP_UNPROC_ENTITY 422u
tass 68:0847e35d08a6 61 #define HTTP_LOCKED 423u
tass 68:0847e35d08a6 62 #define HTTP_METHOD_FAIL 424u
tass 68:0847e35d08a6 63 #define HTTP_UNORDERED 425u
tass 68:0847e35d08a6 64 #define HTTP_UPGRADE_REQ 426u
tass 68:0847e35d08a6 65 #define HTTP_PRECOND_REQ 428u
tass 68:0847e35d08a6 66 #define HTTP_TOO_MANY_REQ 429u
tass 68:0847e35d08a6 67 #define HTTP_HEDER_FIELD_LARGE 431u
tass 68:0847e35d08a6 68
tass 68:0847e35d08a6 69 /* Server error */
tass 68:0847e35d08a6 70 #define HTTP_INTERNAL_SERVER_ERR 500u
tass 68:0847e35d08a6 71 #define HTTP_NOT_IMPLEMENTED 501u
tass 68:0847e35d08a6 72 #define HTTP_BAD_GATEWAY 502u
tass 68:0847e35d08a6 73 #define HTTP_SERVICE_UNAVAILABLE 503u
tass 68:0847e35d08a6 74 #define HTTP_GATEWAY_TIMEOUT 504u
tass 68:0847e35d08a6 75 #define HTTP_NOT_SUPPORTED 505u
tass 68:0847e35d08a6 76 #define HTTP_SERV_LOW_STORAGE 507u
tass 68:0847e35d08a6 77 #define HTTP_LOOP_DETECTED 508u
tass 68:0847e35d08a6 78 #define HTTP_NOT_EXTENDED 510u
tass 68:0847e35d08a6 79 #define HTTP_NETWORK_AUTH 511u
tass 68:0847e35d08a6 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 68:0847e35d08a6 84 #define HTTP_RETURN_OK 0
tass 68:0847e35d08a6 85
tass 68:0847e35d08a6 86 /* List of events - shared between client and server */
tass 68:0847e35d08a6 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 68:0847e35d08a6 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 68:0847e35d08a6 93 #define EV_HTTP_BODY 64u
tass 68:0847e35d08a6 94 #define EV_HTTP_DNS 128u
tass 68:0847e35d08a6 95
tass 68:0847e35d08a6 96 #ifndef TRUE
tass 68:0847e35d08a6 97 #define TRUE 1
tass 68:0847e35d08a6 98 #endif
tass 68:0847e35d08a6 99
tass 68:0847e35d08a6 100 #ifndef FALSE
tass 68:0847e35d08a6 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 68:0847e35d08a6 106 uint8_t protoHttp; // is the protocol Http ?
tass 68:0847e35d08a6 107 char * host; // hostname
tass 68:0847e35d08a6 108 uint16_t port; // port if specified
tass 68:0847e35d08a6 109 char * resource; // resource , ignoring the other possible parameters
tass 68:0847e35d08a6 110 };
tass 68:0847e35d08a6 111
tass 68:0847e35d08a6 112 // used for chunks
tass 68:0847e35d08a6 113 int pico_itoaHex(uint16_t port, char * ptr);
tass 70:cd218dd180e5 114 uint16_t pico_itoa(uint16_t port, char * ptr);
tass 70:cd218dd180e5 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_ */