text: /*
   * Copyright (C) 2009-2021 Alex Smith
   *
   * Permission to use, copy, modify, and/or distribute this software for any
   * purpose with or without fee is hereby granted, provided that the above
   * copyright notice and this permission notice appear in all copies.
   *
   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   */
  
  /**
   * @file
   * @brief               UDP protocol implementation.
   */
  
  #pragma once
  
  #include <net/socket.h>
  
  /** UDP packet header. */
  typedef struct udp_header {
      uint16_t source_port;
      uint16_t dest_port;
      uint16_t length;
      uint16_t checksum;
  } __packed udp_header_t;
  
  /** UDP socket structure. */
  typedef struct udp_socket {
      net_socket_t net;
  } udp_socket_t;
  
  DEFINE_CLASS_CAST(udp_socket, net_socket, net);
  
  /** Maximum UDP packet size (without IP header). */
  #define UDP_MAX_PACKET_SIZE     65535
  
  extern status_t udp_socket_create(sa_family_t family, socket_t **_socket);
  