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 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_nat.h@3:b4047e8a0123, 2013-05-24 (annotated)
- Committer:
- daniele
- Date:
- Fri May 24 15:25:25 2013 +0000
- Revision:
- 3:b4047e8a0123
- Child:
- 51:ab4529a384a6
Updated from main repo + fixed Mutexes;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
daniele | 3:b4047e8a0123 | 1 | /********************************************************************* |
daniele | 3:b4047e8a0123 | 2 | PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved. |
daniele | 3:b4047e8a0123 | 3 | See LICENSE and COPYING for usage. |
daniele | 3:b4047e8a0123 | 4 | |
daniele | 3:b4047e8a0123 | 5 | . |
daniele | 3:b4047e8a0123 | 6 | |
daniele | 3:b4047e8a0123 | 7 | Authors: Kristof Roelants, Simon Maes, Brecht Van Cauwenberghe |
daniele | 3:b4047e8a0123 | 8 | *********************************************************************/ |
daniele | 3:b4047e8a0123 | 9 | |
daniele | 3:b4047e8a0123 | 10 | #ifndef _INCLUDE_PICO_NAT |
daniele | 3:b4047e8a0123 | 11 | #define _INCLUDE_PICO_NAT |
daniele | 3:b4047e8a0123 | 12 | #include "pico_frame.h" |
daniele | 3:b4047e8a0123 | 13 | |
daniele | 3:b4047e8a0123 | 14 | #define PICO_DEL_FLAGS_FIN_FORWARD (0x8000) |
daniele | 3:b4047e8a0123 | 15 | #define PICO_DEL_FLAGS_FIN_BACKWARD (0x4000) |
daniele | 3:b4047e8a0123 | 16 | #define PICO_DEL_FLAGS_SYN (0x2000) |
daniele | 3:b4047e8a0123 | 17 | #define PICO_DEL_FLAGS_RST (0x1000) |
daniele | 3:b4047e8a0123 | 18 | |
daniele | 3:b4047e8a0123 | 19 | #define PICO_IPV4_FORWARD_DEL 0 |
daniele | 3:b4047e8a0123 | 20 | #define PICO_IPV4_FORWARD_ADD 1 |
daniele | 3:b4047e8a0123 | 21 | |
daniele | 3:b4047e8a0123 | 22 | #ifdef PICO_SUPPORT_NAT |
daniele | 3:b4047e8a0123 | 23 | void pico_ipv4_nat_print_table(void); |
daniele | 3:b4047e8a0123 | 24 | int pico_ipv4_nat_add(struct pico_ip4 pub_addr, uint16_t pub_port, struct pico_ip4 priv_addr, uint16_t priv_port, uint8_t proto); |
daniele | 3:b4047e8a0123 | 25 | int pico_ipv4_nat_del(uint16_t pub_port, uint8_t proto); |
daniele | 3:b4047e8a0123 | 26 | int pico_ipv4_nat_find(uint16_t pub_port, struct pico_ip4 *priv_addr, uint16_t priv_port, uint8_t proto); |
daniele | 3:b4047e8a0123 | 27 | int pico_ipv4_port_forward(struct pico_ip4 pub_addr, uint16_t pub_port, struct pico_ip4 priv_addr, uint16_t priv_port, uint8_t proto, uint8_t persistant); |
daniele | 3:b4047e8a0123 | 28 | |
daniele | 3:b4047e8a0123 | 29 | int pico_ipv4_nat(struct pico_frame* f, struct pico_ip4 pub_addr); |
daniele | 3:b4047e8a0123 | 30 | int pico_ipv4_nat_enable(struct pico_ipv4_link *link); |
daniele | 3:b4047e8a0123 | 31 | int pico_ipv4_nat_isenabled_out(struct pico_ipv4_link *link); |
daniele | 3:b4047e8a0123 | 32 | int pico_ipv4_nat_isenabled_in(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 33 | |
daniele | 3:b4047e8a0123 | 34 | #else |
daniele | 3:b4047e8a0123 | 35 | |
daniele | 3:b4047e8a0123 | 36 | static inline int pico_ipv4_nat_isenabled_out(struct pico_ipv4_link *link) |
daniele | 3:b4047e8a0123 | 37 | { |
daniele | 3:b4047e8a0123 | 38 | pico_err = PICO_ERR_EPROTONOSUPPORT; |
daniele | 3:b4047e8a0123 | 39 | return -1; |
daniele | 3:b4047e8a0123 | 40 | } |
daniele | 3:b4047e8a0123 | 41 | static inline int pico_ipv4_nat_isenabled_in(struct pico_frame *f) |
daniele | 3:b4047e8a0123 | 42 | { |
daniele | 3:b4047e8a0123 | 43 | pico_err = PICO_ERR_EPROTONOSUPPORT; |
daniele | 3:b4047e8a0123 | 44 | return -1; |
daniele | 3:b4047e8a0123 | 45 | } |
daniele | 3:b4047e8a0123 | 46 | |
daniele | 3:b4047e8a0123 | 47 | static inline int pico_ipv4_nat(struct pico_frame* f, struct pico_ip4 pub_addr) |
daniele | 3:b4047e8a0123 | 48 | { |
daniele | 3:b4047e8a0123 | 49 | pico_err = PICO_ERR_EPROTONOSUPPORT; |
daniele | 3:b4047e8a0123 | 50 | return -1; |
daniele | 3:b4047e8a0123 | 51 | } |
daniele | 3:b4047e8a0123 | 52 | |
daniele | 3:b4047e8a0123 | 53 | static inline int pico_ipv4_nat_enable(struct pico_ipv4_link *link) |
daniele | 3:b4047e8a0123 | 54 | { |
daniele | 3:b4047e8a0123 | 55 | pico_err = PICO_ERR_EPROTONOSUPPORT; |
daniele | 3:b4047e8a0123 | 56 | return -1; |
daniele | 3:b4047e8a0123 | 57 | } |
daniele | 3:b4047e8a0123 | 58 | |
daniele | 3:b4047e8a0123 | 59 | #define pico_ipv4_nat_print_table() do{}while(0) |
daniele | 3:b4047e8a0123 | 60 | |
daniele | 3:b4047e8a0123 | 61 | static inline int pico_ipv4_nat_add(struct pico_ip4 pub_addr, uint16_t pub_port, struct pico_ip4 priv_addr, uint16_t priv_port, uint8_t proto) |
daniele | 3:b4047e8a0123 | 62 | { |
daniele | 3:b4047e8a0123 | 63 | pico_err = PICO_ERR_EPROTONOSUPPORT; |
daniele | 3:b4047e8a0123 | 64 | return -1; |
daniele | 3:b4047e8a0123 | 65 | } |
daniele | 3:b4047e8a0123 | 66 | |
daniele | 3:b4047e8a0123 | 67 | static inline int pico_ipv4_nat_del(uint16_t pub_port, uint8_t proto) |
daniele | 3:b4047e8a0123 | 68 | { |
daniele | 3:b4047e8a0123 | 69 | pico_err = PICO_ERR_EPROTONOSUPPORT; |
daniele | 3:b4047e8a0123 | 70 | return -1; |
daniele | 3:b4047e8a0123 | 71 | } |
daniele | 3:b4047e8a0123 | 72 | |
daniele | 3:b4047e8a0123 | 73 | |
daniele | 3:b4047e8a0123 | 74 | static inline int pico_ipv4_nat_find(uint16_t pub_port, struct pico_ip4 priv_addr, uint16_t priv_port, uint8_t proto) |
daniele | 3:b4047e8a0123 | 75 | { |
daniele | 3:b4047e8a0123 | 76 | pico_err = PICO_ERR_EPROTONOSUPPORT; |
daniele | 3:b4047e8a0123 | 77 | return -1; |
daniele | 3:b4047e8a0123 | 78 | } |
daniele | 3:b4047e8a0123 | 79 | |
daniele | 3:b4047e8a0123 | 80 | static inline int pico_ipv4_port_forward(struct pico_ip4 pub_addr, uint16_t pub_port, struct pico_ip4 priv_addr, uint16_t priv_port, uint8_t proto, uint8_t persistant) |
daniele | 3:b4047e8a0123 | 81 | { |
daniele | 3:b4047e8a0123 | 82 | pico_err = PICO_ERR_EPROTONOSUPPORT; |
daniele | 3:b4047e8a0123 | 83 | return -1; |
daniele | 3:b4047e8a0123 | 84 | } |
daniele | 3:b4047e8a0123 | 85 | #endif |
daniele | 3:b4047e8a0123 | 86 | |
daniele | 3:b4047e8a0123 | 87 | #endif /* _INCLUDE_PICO_NAT */ |
daniele | 3:b4047e8a0123 | 88 |