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.
Fork of PicoTCP by
include/pico_stack.h@51:18637a3d071f, 2013-08-03 (annotated)
- Committer:
- daniele
- Date:
- Sat Aug 03 08:50:27 2013 +0000
- Revision:
- 51:18637a3d071f
- Parent:
- 3:b4047e8a0123
Branch for CDC-ECM: Work in progress
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 | #ifndef _INCLUDE_PICO_STACK |
daniele | 3:b4047e8a0123 | 7 | #define _INCLUDE_PICO_STACK |
daniele | 3:b4047e8a0123 | 8 | #include "pico_config.h" |
daniele | 3:b4047e8a0123 | 9 | #include "pico_frame.h" |
daniele | 3:b4047e8a0123 | 10 | |
daniele | 3:b4047e8a0123 | 11 | #define PICO_MAX_TIMERS 20 |
daniele | 3:b4047e8a0123 | 12 | |
daniele | 3:b4047e8a0123 | 13 | /* ===== RECEIVING FUNCTIONS (from dev up to socket) ===== */ |
daniele | 3:b4047e8a0123 | 14 | |
daniele | 3:b4047e8a0123 | 15 | /* TRANSPORT LEVEL */ |
daniele | 3:b4047e8a0123 | 16 | /* interface towards network */ |
daniele | 3:b4047e8a0123 | 17 | int pico_transport_receive(struct pico_frame *f, uint8_t proto); |
daniele | 3:b4047e8a0123 | 18 | |
daniele | 3:b4047e8a0123 | 19 | /* NETWORK LEVEL */ |
daniele | 3:b4047e8a0123 | 20 | /* interface towards ethernet */ |
daniele | 3:b4047e8a0123 | 21 | int pico_network_receive(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 22 | |
daniele | 3:b4047e8a0123 | 23 | /* The pico_ethernet_receive() function is used by |
daniele | 3:b4047e8a0123 | 24 | * those devices supporting ETH in order to push packets up |
daniele | 3:b4047e8a0123 | 25 | * into the stack. |
daniele | 3:b4047e8a0123 | 26 | */ |
daniele | 3:b4047e8a0123 | 27 | /* DATALINK LEVEL */ |
daniele | 3:b4047e8a0123 | 28 | int pico_ethernet_receive(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 29 | |
daniele | 3:b4047e8a0123 | 30 | /* LOWEST LEVEL: interface towards devices. */ |
daniele | 3:b4047e8a0123 | 31 | /* Device driver will call this function which returns immediately. |
daniele | 3:b4047e8a0123 | 32 | * Incoming packet will be processed later on in the dev loop. |
daniele | 3:b4047e8a0123 | 33 | */ |
daniele | 3:b4047e8a0123 | 34 | int pico_stack_recv(struct pico_device *dev, uint8_t *buffer, int len); |
daniele | 3:b4047e8a0123 | 35 | |
daniele | 3:b4047e8a0123 | 36 | |
daniele | 3:b4047e8a0123 | 37 | /* ===== SENDIING FUNCTIONS (from socket down to dev) ===== */ |
daniele | 3:b4047e8a0123 | 38 | |
daniele | 3:b4047e8a0123 | 39 | int pico_transport_send(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 40 | int pico_network_send(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 41 | int pico_ethernet_send(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 42 | int pico_sendto_dev(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 43 | |
daniele | 3:b4047e8a0123 | 44 | /* ----- Initialization ----- */ |
daniele | 3:b4047e8a0123 | 45 | void pico_stack_init(void); |
daniele | 3:b4047e8a0123 | 46 | |
daniele | 3:b4047e8a0123 | 47 | /* ----- Loop Function. ----- */ |
daniele | 3:b4047e8a0123 | 48 | void pico_stack_tick(void); |
daniele | 3:b4047e8a0123 | 49 | void pico_stack_loop(void); |
daniele | 3:b4047e8a0123 | 50 | |
daniele | 3:b4047e8a0123 | 51 | /* ---- Notifications for stack errors */ |
daniele | 3:b4047e8a0123 | 52 | int pico_notify_socket_unreachable(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 53 | int pico_notify_proto_unreachable(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 54 | int pico_notify_dest_unreachable(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 55 | int pico_notify_ttl_expired(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 56 | |
daniele | 3:b4047e8a0123 | 57 | /* Various. */ |
daniele | 3:b4047e8a0123 | 58 | int pico_source_is_local(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 59 | int pico_destination_is_local(struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 60 | void pico_store_network_origin(void *src, struct pico_frame *f); |
daniele | 3:b4047e8a0123 | 61 | void pico_timer_add(unsigned long expire, void (*timer)(unsigned long, void *), void *arg); |
daniele | 3:b4047e8a0123 | 62 | uint32_t pico_rand(void); |
daniele | 3:b4047e8a0123 | 63 | void pico_rand_feed(uint32_t feed); |
daniele | 3:b4047e8a0123 | 64 | |
daniele | 3:b4047e8a0123 | 65 | #endif |