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

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-2015 Altran Intelligent Systems. 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 #include "pico_socket.h"
00013 #define PICO_UDP_MODE_UNICAST 0x01
00014 #define PICO_UDP_MODE_MULTICAST 0x02
00015 #define PICO_UDP_MODE_BROADCAST 0xFF
00016 
00017 struct pico_socket_udp
00018 {
00019     struct pico_socket sock;
00020     int mode;
00021     uint8_t mc_ttl; /* Multicasting TTL */
00022 };
00023 
00024 
00025 extern struct pico_protocol pico_proto_udp;
00026 
00027 PACKED_STRUCT_DEF pico_udp_hdr {
00028     struct pico_trans trans;
00029     uint16_t len;
00030     uint16_t crc;
00031 };
00032 #define PICO_UDPHDR_SIZE 8
00033 
00034 struct pico_socket *pico_udp_open(void);
00035 uint16_t pico_udp_recv(struct pico_socket *s, void *buf, uint16_t len, void *src, uint16_t *port, struct pico_msginfo *msginfo);
00036 uint16_t pico_udp_checksum_ipv4(struct pico_frame *f);
00037 
00038 #ifdef PICO_SUPPORT_IPV6
00039 uint16_t pico_udp_checksum_ipv6(struct pico_frame *f);
00040 #endif
00041 
00042 
00043 int pico_udp_setsockopt(struct pico_socket *s, int option, void *value);
00044 
00045 #endif