CDC/ECM driver for mbed, based on USBDevice by mbed-official. Uses PicoTCP to access Ethernet USB device. License: GPLv2

Dependents:   USBEthernet_TEST

Fork of USB_Ethernet by Daniele Lacamera

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pico_udp.h Source File

pico_udp.h

00001 /*********************************************************************
00002 PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved.
00003 See LICENSE and COPYING for usage.
00004 
00005 .
00006 
00007 *********************************************************************/
00008 #ifndef _INCLUDE_PICO_UDP
00009 #define _INCLUDE_PICO_UDP
00010 #include "pico_addressing.h"
00011 #include "pico_protocol.h"
00012 
00013 extern struct pico_protocol pico_proto_udp;
00014 
00015 struct __attribute__((packed)) pico_udp_hdr {
00016   struct pico_trans trans;
00017   uint16_t len;
00018   uint16_t crc;
00019 };
00020 #define PICO_UDPHDR_SIZE 8
00021 
00022 struct pico_socket *pico_udp_open(void);
00023 int pico_udp_recv(struct pico_socket *s, void *buf, int len, void *src, uint16_t *port);
00024 uint16_t pico_udp_checksum_ipv4(struct pico_frame *f);
00025 
00026 #ifdef PICO_SUPPORT_MCAST
00027 int pico_udp_set_mc_ttl(struct pico_socket *s, uint8_t ttl);
00028 int pico_udp_get_mc_ttl(struct pico_socket *s, uint8_t *ttl);
00029 #else
00030 static inline int pico_udp_set_mc_ttl(struct pico_socket *s, uint8_t ttl)
00031 {
00032   pico_err = PICO_ERR_EPROTONOSUPPORT;
00033   return -1;
00034 }
00035 static inline int pico_udp_get_mc_ttl(struct pico_socket *s, uint8_t *ttl)
00036 {
00037   pico_err = PICO_ERR_EPROTONOSUPPORT;
00038   return -1;
00039 }
00040 #endif /* PICO_SUPPORT_MCAST */
00041 
00042 #endif