Free (GPLv2) TCP/IP stack developed by TASS Belgium
Fork of PicoTCP by
Diff: modules/pico_udp.h
- Revision:
- 3:b4047e8a0123
diff -r d12a891f2eca -r b4047e8a0123 modules/pico_udp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/pico_udp.h Fri May 24 15:25:25 2013 +0000 @@ -0,0 +1,42 @@ +/********************************************************************* +PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved. +See LICENSE and COPYING for usage. + +. + +*********************************************************************/ +#ifndef _INCLUDE_PICO_UDP +#define _INCLUDE_PICO_UDP +#include "pico_addressing.h" +#include "pico_protocol.h" + +extern struct pico_protocol pico_proto_udp; + +struct __attribute__((packed)) pico_udp_hdr { + struct pico_trans trans; + uint16_t len; + uint16_t crc; +}; +#define PICO_UDPHDR_SIZE 8 + +struct pico_socket *pico_udp_open(void); +int pico_udp_recv(struct pico_socket *s, void *buf, int len, void *src, uint16_t *port); +uint16_t pico_udp_checksum_ipv4(struct pico_frame *f); + +#ifdef PICO_SUPPORT_MCAST +int pico_udp_set_mc_ttl(struct pico_socket *s, uint8_t ttl); +int pico_udp_get_mc_ttl(struct pico_socket *s, uint8_t *ttl); +#else +static inline int pico_udp_set_mc_ttl(struct pico_socket *s, uint8_t ttl) +{ + pico_err = PICO_ERR_EPROTONOSUPPORT; + return -1; +} +static inline int pico_udp_get_mc_ttl(struct pico_socket *s, uint8_t *ttl) +{ + pico_err = PICO_ERR_EPROTONOSUPPORT; + return -1; +} +#endif /* PICO_SUPPORT_MCAST */ + +#endif