Commit 1ef8bac3 authored by danielinux's avatar danielinux

Merge branch 'development' into gl

parents 0b2d2900 63e35bd8
......@@ -23,6 +23,7 @@ cscope.out
*.gcda
*.gcno
*.expand
.hg
*.pcap
.ycm_extra_conf.py
.clang_complete
External contributions to picoTCP are very welcome. We do, however, ask that you sign the Contributor License Agreement.
We don't ask you to sign away your copyright. The CLA simply grants us an additional license on the code you wrote. This allows us to also use picoTCP in commercial projects, which enables us to keep investing time and money in creating a better TCP/IP stack.
Please read the [Agreement](https://docs.google.com/forms/d/1-z6lsT75l6ZIrgHGEWrWdHylJ6xxpjc7FwGfL2ilDFU/viewform), and if you agree with it, fill in your information.
You will receive a mail with a timestamp. Please modify our [CLA confirmation page](https://github.com/tass-belgium/picotcp/wiki/picoTCP-CLA-Confirmation-Page), adding the timestamp and your github username. This way we can be sure that nobody else filled in your info in the form.
Pull requests by people who haven't signed the CLA will, unfortunately, have to be rejected.
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems.
Released under the GNU General Public License, version 2.
See LICENSE for details.
Released under the GNU General Public License, version 2, or (at your option)
version 3.
See LICENSE.GPLv2 and LICENSE.GPLv3 for details.
Different licensing models may exist, at the sole discretion of
the Copyright holders.
This diff is collapsed.
-include ../../config.mk
-include ../../tools/kconfig/.config
OS:=$(shell uname)
CC:=$(CROSS_COMPILE)gcc
LD:=$(CROSS_COMPILE)ld
AR:=$(CROSS_COMPILE)ar
......@@ -8,7 +9,10 @@ RANLIB:=$(CROSS_COMPILE)ranlib
SIZE:=$(CROSS_COMPILE)size
STRIP_BIN:=$(CROSS_COMPILE)strip
TEST_LDFLAGS=-pthread $(PREFIX)/modules/*.o $(PREFIX)/lib/*.o -lvdeplug
UNIT_LDFLAGS=-lcheck -lm -pthread -lrt -lsubunit
UNIT_LDFLAGS=-lcheck -lm -pthread -lrt
ifneq ("$(wildcard /etc/debian-release)","")
UNIT_LDFLAGS+=-lsubunit
endif
UNIT_CFLAGS= $(CFLAGS) -Wno-missing-braces
LIBNAME:="libpicotcp.a"
......@@ -101,6 +105,18 @@ ifeq ($(CC),clang)
CFLAGS+= -Wunreachable-code-break -Wpointer-bool-conversion -Wmissing-variable-declarations
endif
ifeq ($(OS),Darwin)
LIBSIZE=stat -f%z
ifeq ($(SIZE),size)
SUMSIZE=$(SIZE)
else
SUMSIZE=$(SIZE) -t
endif
else
LIBSIZE=du -b
SUMSIZE=$(SIZE) -t
endif
ifeq ($(DEBUG),1)
CFLAGS+=-ggdb
else
......@@ -232,8 +248,7 @@ POSIX_OBJ+= modules/pico_dev_vde.o \
modules/pico_dev_tun.o \
modules/pico_dev_ipc.o \
modules/pico_dev_tap.o \
modules/pico_dev_mock.o \
modules/pico_dev_radio_mgr.o
modules/pico_dev_mock.o
include rules/debug.mk
......@@ -392,8 +407,8 @@ lib: mod core
@test $(STRIP) -eq 1 && (echo -e "\t[STRIP] $(PREFIX)/lib/$(LIBNAME)" \
&& $(STRIP_BIN) $(PREFIX)/lib/$(LIBNAME)) \
|| echo -e "\t[KEEP SYMBOLS] $(PREFIX)/lib/$(LIBNAME)"
@echo -e "\t[LIBSIZE] `du -b $(PREFIX)/lib/$(LIBNAME)`"
@echo -e "`size -t $(PREFIX)/lib/$(LIBNAME)`"
@echo -e "\t[LIBSIZE] `$(LIBSIZE) $(PREFIX)/lib/$(LIBNAME)`"
@echo -e "`$(SUMSIZE) $(PREFIX)/lib/$(LIBNAME)`"
loop: mod core
mkdir -p $(PREFIX)/test
......@@ -423,6 +438,7 @@ units: mod core lib $(UNITS_OBJ) $(MOD_OBJ)
@$(CC) -o $(PREFIX)/test/modunit_dns_sd.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_dns_sd.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
@$(CC) -o $(PREFIX)/test/modunit_dev_loop.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_dev_loop.c $(UNIT_LDFLAGS) $(UNITS_OBJ)
@$(CC) -o $(PREFIX)/test/modunit_ipv6_nd.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_ipv6_nd.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
@$(CC) -o $(PREFIX)/test/modunit_ipv6_pmtu.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_ipv6_pmtu.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
@$(CC) -o $(PREFIX)/test/modunit_ethernet.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_ethernet.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
@$(CC) -o $(PREFIX)/test/modunit_pico_stack.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_stack.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
@$(CC) -o $(PREFIX)/test/modunit_tftp.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_tftp.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
......
......@@ -2,5 +2,201 @@
---------------
picoTCP optimizations to run with [Frosted embedded operating system](https://github.com/insane-adding-machines/frosted).
License: GPLv2.
PicoTCP free repository. GPLv2/v3 only.
For non-GPL uses, contact [Altran.be PicoTCP](http://picotcp.altran.be).
---------------
picoTCP is a small-footprint, modular TCP/IP stack designed for embedded systems and the Internet of Things.
This code is released under the terms of GNU GPL v2 and GNU GPL v3. Some rights reserved.
Other licenses may apply at the sole discretion of the copyright holders.
Learn how to use picoTCP in your project by going through the **Getting Started guide** on our [GitHub wiki](https://gitlab.com/picotcp/picotcp/wikis).
---------------
## Simple example
### Preparations
This example uses Ubuntu 14.04. It works on other linux distibutions as well, though you may need to change some package names. See [setting up the environment](https://gitlab.com/picotcp/picotcp/wikis/Setting-up-the-environment#prerequisite-packages) for some more info.
```bash
sudo apt-get install git check vde2 libvdeplug2-dev libpcap0.8-dev openvpn wireshark
git clone https://gitlab.com/picotcp/picotcp
cd picotcp
make TAP=1
cd ..
```
### The code
Then make a new directory, e.g. `example`, and create a file with the following content :
[//]: # (The code below is pulled through our CI - please leave the code extractor comments intact!)
[//]: # (code extractor start)
```C
#include <time.h>
#include <pico_stack.h>
#include <pico_ipv4.h>
#include <pico_icmp4.h>
#include <pico_dev_tap.h>
#define NUM_PING 10
static int finished = 0;
/* gets called when the ping receives a reply, or encounters a problem */
void cb_ping(struct pico_icmp4_stats *s)
{
char host[30];
pico_ipv4_to_string(host, s->dst.addr);
if (s->err == 0) {
/* if all is well, print some pretty info */
printf("%lu bytes from %s: icmp_req=%lu ttl=%lu time=%lu ms\n", s->size,
host, s->seq, s->ttl, (long unsigned int)s->time);
if (s->seq >= NUM_PING)
finished = 1;
} else {
/* if something went wrong, print it and signal we want to stop */
printf("PING %lu to %s: Error %d\n", s->seq, host, s->err);
finished = 1;
}
}
int main(void){
int id;
struct pico_ip4 ipaddr, netmask;
struct pico_device* dev;
/* initialise the stack. Super important if you don't want ugly stuff like
* segfaults and such! */
pico_stack_init();
/* create the tap device */
dev = pico_tap_create("tap0");
if (!dev)
return -1;
/* assign the IP address to the tap interface */
pico_string_to_ipv4("192.168.5.4", &ipaddr.addr);
pico_string_to_ipv4("255.255.255.0", &netmask.addr);
pico_ipv4_link_add(dev, ipaddr, netmask);
printf("starting ping\n");
id = pico_icmp4_ping("192.168.5.5", NUM_PING, 1000, 10000, 64, cb_ping);
if (id == -1)
return -1;
/* keep running stack ticks to have picoTCP do its network magic. Note that
* you can do other stuff here as well, or sleep a little. This will impact
* your network performance, but everything should keep working (provided
* you don't go overboard with the delays). */
while (finished != 1)
{
usleep(1000);
pico_stack_tick();
}
printf("finished !\n");
return 0;
}
```
[//]: # (code extractor stop)
### Building and running
Now we can compile this and link it, by running
```bash
gcc -c -o main.o -I../picotcp/build/include main.c
gcc -o main.elf main.o ../picotcp/build/lib/libpicotcp.a
```
Next we'll create a persistent tap device - a virtual network port. You don't need to repeat this each time, the device will exist until you reboot, or until you go `sudo tunctl -d tap0`
```bash
sudo tunctl -u <username>
sudo ifconfig tap0 192.168.5.5
```
Now, you should be able to run `./main.elf`, and see output like
```
Protocol ethernet registered (layer: 2).
Protocol ipv4 registered (layer: 3).
Protocol ipv6 registered (layer: 3).
Protocol icmp4 registered (layer: 4).
Protocol icmp6 registered (layer: 4).
Protocol igmp registered (layer: 4).
Protocol udp registered (layer: 4).
Protocol tcp registered (layer: 4).
Device tap0 created.
Assigned ipv4 192.168.5.4 to device tap0
starting ping
64 bytes from 192.168.5.5: icmp_req=1 ttl=64 time=5 ms
64 bytes from 192.168.5.5: icmp_req=2 ttl=64 time=0 ms
64 bytes from 192.168.5.5: icmp_req=3 ttl=64 time=0 ms
64 bytes from 192.168.5.5: icmp_req=4 ttl=64 time=0 ms
64 bytes from 192.168.5.5: icmp_req=5 ttl=64 time=0 ms
64 bytes from 192.168.5.5: icmp_req=6 ttl=64 time=0 ms
64 bytes from 192.168.5.5: icmp_req=7 ttl=64 time=0 ms
64 bytes from 192.168.5.5: icmp_req=8 ttl=64 time=0 ms
64 bytes from 192.168.5.5: icmp_req=9 ttl=64 time=0 ms
64 bytes from 192.168.5.5: icmp_req=10 ttl=64 time=0 ms
finished !
```
While the application is running, you can also run
```
ping 192.168.5.4
```
to send pings in the other direction.
### Investigating what happened
Run wireshark, and sniff the tap0 interface. Then run the `./main.elf` again, and see what happens. You should see an ARP request from picoTCP to Linux, and a reply. After that you should see the ping requests and replies going back and forth.
Note, sometimes you may see lots of other stuff, IPv6 router sollicitations, various broadcasts, mDNS, DNS-SD, etc - this is your when your Linux notices the new network interface is up, and starts all sorts of discoveries. With the persistent TAP device, this usually only happens the first time you start the application. Start a new wireshark capture, and start the application again, it should be much cleaner now.
Now you could make some changes to the `main.c` file, and experiment a bit! Keep some statistics of your pings (max, min, avg time). Open a UDP socket, send some stuff to a netcat instance on your linux. Or build a rudimentary port scanner, see what ports are open on your machine.
This is just a very quick overview, more info can be found in our [wiki](https://gitlab.com/picotcp/picotcp/wikis).
---------------
## Contributors
Contributors are very welcome. Report a bug, implement a new feature, submit a merge request.
---------------
## PicoTCP has been used with
**Platforms picoTCP runs on**:
ARM Cortex-M series (ST Micro STM, NXP LPC, TI Stellaris, Freescale K64F),
ARM ARM9-series (ST Micro STR9),
Texas Instruments (MSP430),
Microchip (PIC24, PIC32),
Atmel (AVR 8bit),
Linux (User space (TUN/TAP), Kernel space),
Windows (User space (TAP))
**Network devices picoTCP has worked with**:
BCM43362 (IEEE 802.11), MRF24WG (IEEE 802.11), LPC Ethernet ENET/EMAC (IEEE 802.3), Stellaris Ethernet (IEEE 802.3), STM32 Ethernet (IEEE 802.3), Wiznet W5100 (IEEE 802.3), USB CDC-ECM (CDC1.2), PPP, Virtual drivers ( TUN/TAP, VDE, Libpcap)
**(RT)OSes picoTCP has been integrated into**:
No OS / Bare metal, FreeRTOS, mbed-RTOS, Frosted, linux / POSIX, MS DOS, MS Windows
**Libraries picoTCP has been integrated with**:
wolfSSL, mbedTLS, Mongoose RESTful library, MicroPython
**Compilers picoTCP compiles under**:
GCC, Clang, TCC, ARM-RCVT, IAR, XC-16, XC-32, MSP-GCC, AVR-GCC
Unfortunately we can't release all the code, a.o. because some parts depend on code or binaries that aren't GPL compatible, some parts were developed under a commercial contract, and some consist of very rough proof-of-concept code.
If you want to know more about the availability under the commercial license, or the possibility of using our expert services for porting or driver development, feel free to contact us at info@picotcp.com.
Your favorite not in the list? Check out the wiki for information and examples on how to port picoTCP to a new platform!
\section{Initialization}
\subsection{pico$\_$stack$\_$init}
\subsubsection*{Description}
Initializes the picoTCP stack and must be called before any other function.
\subsubsection*{Function prototype}
\begin{verbatim}
int pico_stack_init(void);
\end{verbatim}
\subsubsection*{Return value}
On success, this call returns 0.
On error, -1 is returned (\texttt{pico$\_$err} is \textbf{not} set).
\subsubsection*{Example}
\begin{verbatim}
int main(int argc, char* argv[]) {
pico_stack_init();
/* Code using picoTCP */
}
\end{verbatim}
......@@ -220,6 +220,7 @@ On error, -1 is returned and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Errors}
\begin{itemize}[noitemsep]
\item \texttt{PICO$\_$ERR$\_$EINVAL} - invalid argument
\item \texttt{PICO$\_$ERR$\_$ENXIO} - no such device or address
\end{itemize}
\subsubsection*{Example}
......@@ -325,7 +326,7 @@ a one-direction NAT entry will be made.
\begin{verbatim}
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)
uint8_t flag)
\end{verbatim}
\subsubsection*{Parameters}
......@@ -335,7 +336,7 @@ uint8_t persistant)
\item \texttt{priv$\_$addr} - Private IP address of the host on the internal network.
\item \texttt{priv$\_$port} - Private port of the host on the internal network.
\item \texttt{proto} - Protocol identifier, see supported list below.
\item \texttt{persistant} - Option for function call: create \texttt{PICO$\_$IPV4$\_$FORWARD$\_$ADD} (= 1) \\
\item \texttt{flag} - Option for function call: create \texttt{PICO$\_$IPV4$\_$FORWARD$\_$ADD} (= 1) \\
or delete \texttt{PICO$\_$IPV4$\_$FORWARD$\_$DEL} (= 0).
\end{itemize}
......@@ -347,14 +348,14 @@ or delete \texttt{PICO$\_$IPV4$\_$FORWARD$\_$DEL} (= 0).
\end{itemize}
\subsubsection*{Return value}
On success, this call 0 after a succesfull entry of the forward rule.
On success, this call 0 after a successful entry of the forward rule.
On error, -1 is returned and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Errors}
\begin{itemize}[noitemsep]
\item \texttt{PICO$\_$ERR$\_$EINVAL} - invalid argument
\item \texttt{PICO$\_$ERR$\_$ENOMEM} - not enough space
\item \texttt{PICO$\_$ERR$\_$EAGAIN} - not succesfull, try again
\item \texttt{PICO$\_$ERR$\_$EAGAIN} - not successful, try again
\end{itemize}
\subsubsection*{Example}
......@@ -370,6 +371,8 @@ host_port, PICO_PROTO_UDP, 1);
\subsubsection*{Description}
Add a new route to the destination IP address from the local device link, f.e. eth0.
If both \texttt{address} and \texttt{netmask} are zeroed, the call assumes the meaning of adding a default gateway.
\subsubsection*{Function prototype}
\begin{verbatim}
int pico_ipv4_route_add(struct pico_ip4 address, struct pico_ip4 netmask,
......@@ -379,10 +382,10 @@ struct pico_ip4 gateway, int metric, struct pico_ipv4_link *link);
\subsubsection*{Parameters}
\begin{itemize}[noitemsep]
\item \texttt{address} - Pointer to the destination internet host address as \texttt{struct pico$\_$ip4}.
\item \texttt{netmask} - Netmask of the address. If zeroed, the call assumes the meaning of adding a default gateway.
\item \texttt{netmask} - Netmask of the address.
\item \texttt{gateway} - Gateway of the address network. If zeroed, no gateway will be associated to this route, and the traffic towards the destination will be simply forwarded towards the given device.
\item \texttt{metric} - Metric for this route.
\item \texttt{link} - Local device interface. If a valid gateway is specified, this parameter is not mandatory, otherwise \texttt{NULL} can be used.
\item \texttt{link} - Local device interface. If a valid gateway is specified, this parameter is not mandatory, otherwise \texttt{NULL} can not be used.
\end{itemize}
\subsubsection*{Return value}
......@@ -411,17 +414,14 @@ Remove the route to the destination IP address from the local device link, f.e.
\subsubsection*{Function prototype}
\begin{verbatim}
int pico_ipv4_route_del(struct pico_ip4 address, struct pico_ip4 netmask,
struct pico_ip4 gateway, int metric, struct pico_ipv4_link *link);
int pico_ipv4_route_del(struct pico_ip4 address, struct pico_ip4 netmask, int metric);
\end{verbatim}
\subsubsection*{Parameters}
\begin{itemize}[noitemsep]
\item \texttt{address} - Pointer to the destination internet host address as struct \texttt{pico$\_$ip4}.
\item \texttt{netmask} - Netmask of the address.
\item \texttt{gateway} - Gateway of the address network.
\item \texttt{metric} - Metric of the route.
\item \texttt{link} - Local device interface.
\end{itemize}
\subsubsection*{Return value}
......@@ -435,7 +435,7 @@ On error, -1 is returned and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Example}
\begin{verbatim}
ret = pico_ipv4_route_del(dst, netmask, gateway, metric, link);
ret = pico_ipv4_route_del(dst, netmask, metric);
\end{verbatim}
......@@ -456,7 +456,7 @@ struct pico_ip4 pico_ipv4_route_get_gateway(struct pico_ip4 *addr)
\end{itemize}
\subsubsection*{Return value}
On success the gateway address is returned.
On success the gateway address is returned -- or \texttt{0.0.0.0} if no gateway is needed (and \texttt{pico$\_$err} is unchanged).
On error a \texttt{null} address is returned (\texttt{0.0.0.0}) and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Errors}
......@@ -475,7 +475,7 @@ gateway_addr = pico_ip4 pico_ipv4_route_get_gateway(&dest_addr)
\subsubsection*{Description}
This function sends out a number of ping echo requests and checks if the replies are received correctly.
The information from the replies is passed to the callback function after a succesfull reception.
The information from the replies is passed to the callback function after a successful reception.
If a timeout expires before a reply is received, the callback is called with the error condition.
\subsubsection*{Function prototype}
......
......@@ -417,7 +417,7 @@ int pico_socket_bind(struct pico_socket *s, void *local_addr, uint16_t *port);
\end{itemize}
\subsubsection*{Return value}
On success, this call returns 0 after a succesfull bind.
On success, this call returns 0 after a successful bind.
On error, -1 is returned, and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Errors}
......@@ -534,7 +534,7 @@ uint16_t remote_port);
\end{itemize}
\subsubsection*{Return value}
On success, this call returns 0 after a succesfull connect.
On success, this call returns 0 after a successful connect.
On error, -1 is returned, and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Errors}
......@@ -568,7 +568,7 @@ int pico_socket_listen(struct pico_socket *s, int backlog);
\end{itemize}
\subsubsection*{Return value}
On success, this call returns 0 after a succesfull listen start.
On success, this call returns 0 after a successful listen start.
On error, -1 is returned, and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Errors}
......@@ -639,7 +639,7 @@ int pico_socket_shutdown(struct pico_socket *s, int mode);
\end{itemize}
\subsubsection*{Return value}
On success, this call returns 0 after a succesfull socket shutdown.
On success, this call returns 0 after a successful socket shutdown.
On error, -1 is returned, and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Errors}
......@@ -669,7 +669,7 @@ int pico_socket_close(struct pico_socket *s);
\end{itemize}
\subsubsection*{Return value}
On success, this call returns 0 after a succesfull socket shutdown.
On success, this call returns 0 after a successful socket shutdown.
On error, -1 is returned, and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Errors}
......@@ -722,7 +722,7 @@ int pico_socket_setoption(struct pico_socket *s, int option, void *value);
\end{itemize}
\subsubsection*{Return value}
On success, this call returns 0 after a succesfull setting of socket option.
On success, this call returns 0 after a successful setting of socket option.
On error, -1 is returned, and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Errors}
......@@ -779,7 +779,7 @@ int pico_socket_getoption(struct pico_socket *s, int option, void *value);
\end{itemize}
\subsubsection*{Return value}
On success, this call returns 0 after a succesfull getting of socket option. The value of
On success, this call returns 0 after a successful getting of socket option. The value of
the option is written to \texttt{value}.
On error, -1 is returned, and \texttt{pico$\_$err} is set appropriately.
......
......@@ -80,6 +80,7 @@ statement is kept. Click \href{http://creativecommons.org/licenses/by-nd/3.0/} {
\chapter{API Documentation}
\label{chap:api_doc}
The following sections will describe the API for picoTCP.
\input{chap_api_init}
\input{chap_api_ipv4}
\input{chap_api_ipv6}
\input{chap_api_sock}
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
/*** MACHINE CONFIGURATION ***/
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#define dbg(...) do {} while(0)
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#ifndef _INCLUDE_PICO_CORTEX_M
......
......@@ -5,7 +5,7 @@
* This code is donated to the picoTCP project, and shares the same licensing,
* that is GNU GPLv2.
*
* See LICENSE and COPYING for usage.
* See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*/
#include <dos.h> /* provides int86() along with the union REGS type */
......
/*********************************************************************
PicoTCP. Copyright (c) 2014-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2014-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#ifndef _INCLUDE_PICO_ESP8266
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#ifndef _INCLUDE_PICO_GCC
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
File: pico_mbed.h
Author: Toon Peters
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#ifndef _INCLUDE_PICO_LPC
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#ifndef PICO_SUPPORT_ARCHNONE
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#ifndef PICO_SUPPORT_PIC24
#define PICO_SUPPORT_PIC24
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#ifndef _INCLUDE_PICO_PIC32
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#ifndef PICO_SUPPORT_POSIX
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#define MAX_BLOCK_SIZE 1600
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#ifndef INCLUDE_PICO_ADDRESSING
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#include "pico_defines.h"
......@@ -26,6 +26,11 @@
# define PEDANTIC_STRUCT_DEF struct
# define PACKED_UNION_DEF _Packed union
# define WEAK
#elif defined __CC_ARM
# define PACKED_STRUCT_DEF struct __attribute__((__packed__))
# define PEDANTIC_STRUCT_DEF struct __attribute__((__packed__))
# define PACKED_UNION_DEF union __attribute__((__packed__))
# define WEAK __attribute__((weak))
#else
# define PACKED_STRUCT_DEF struct __attribute__((packed))
# define PEDANTIC_STRUCT_DEF struct
......@@ -53,6 +58,7 @@
#define short_be(x) (x)
#define long_be(x) (x)
#define long_long_be(x) (x)
#define be_to_host_long(x) (x)
static inline uint16_t short_from(void *_p)
{
......@@ -164,6 +170,10 @@ static inline uint64_t long_long_be(uint64_t le)
}
# endif /* BYTESWAP_GCC */
static inline uint32_t be_to_host_long(uint32_t be)
{
return long_be(be);
}
#endif
/* Mockables */
......@@ -186,7 +196,6 @@ static inline uint64_t long_long_be(uint64_t le)
#define PICO_MAX_SLAB_SIZE 1600
#define PICO_MEM_MINIMUM_OBJECT_SIZE 4
/*** *** *** *** *** *** ***
*** PLATFORM SPECIFIC ***
*** *** *** *** *** *** ***/
......@@ -198,6 +207,8 @@ static inline uint64_t long_long_be(uint64_t le)
# include "arch/pico_cortex_m.h"
#elif defined CORTEX_M3
# include "arch/pico_cortex_m.h"
#elif defined CORTEX_M0
# include "arch/pico_cortex_m.h"
#elif defined DOS_WATCOM
# include "arch/pico_dos.h"
#elif defined PIC24
......