32#include <sys/select.h> 
   36#ifndef UDP_THREAD_PRIO 
   37#define UDP_THREAD_PRIO 10 
   59    fprintf(
stderr, 
"udp_arch_init: Could not create UDP reading thread.\n");
 
 
   75  p->network = (
void *)
sock;
 
 
   86  int available = 
p->rx_insert_idx - 
p->rx_extract_idx;
 
 
  113  if (
p == 
NULL) { 
return; }
 
  114  if (
p->network == 
NULL) { 
return; }
 
  121  if (available <= 0) {
 
  133      p->rx_buf[
p->rx_insert_idx] = buf[i];
 
 
  146  if (
p == 
NULL) { 
return; }
 
  147  if (
p->network == 
NULL) { 
return; }
 
  151  if (
p->tx_insert_idx > 0) {
 
  156        perror(
"udp_send_message failed");
 
  158        fprintf(
stderr, 
"udp_send_message: only sent %d bytes instead of %d\n",
 
  162    p->tx_insert_idx = 0;
 
 
  171  if (
p == 
NULL) { 
return; }
 
  172  if (
p->network == 
NULL) { 
return; }
 
 
void udp_receive(struct udp_periph *p)
Read bytes from UDP.
void udp_arch_periph_init(struct udp_periph *p, char *host, int port_out, int port_in, bool broadcast)
Initialize the UDP peripheral.
void udp_send_raw(struct udp_periph *p, long fd, uint8_t *buffer, uint16_t size)
Send a packet from another buffer.
static void * udp_thread(void *data)
check for new udp packets to receive or send.
static pthread_mutex_t udp_mutex
uint8_t udp_getch(struct udp_periph *p)
Get the last character from the receive buffer.
int udp_char_available(struct udp_periph *p)
Get number of bytes available in receive buffer.
void udp_send_message(struct udp_periph *p, long fd)
Send a message.
Functions to obtain rt priority or set the nice level.
static int get_rt_prio(int prio)
#define UDP_RX_BUFFER_SIZE
int udp_socket_create(struct UdpSocket *sock, char *host, int port_out, int port_in, bool broadcast)
Create UDP socket and bind it.
Easily create and use UDP sockets.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.