Blame view

RIOT/sys/net/gnrc/sock/include/sock_types.h 2.12 KB
a752c7ab   elopes   add first test an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
  /*
   * Copyright (C) 2016 Martine Lenders <mlenders@inf.fu-berlin.de>
   *
   * This file is subject to the terms and conditions of the GNU Lesser
   * General Public License v2.1. See the file LICENSE in the top level
   * directory for more details.
   */
  
  /**
   * @defgroup    net_gnrc_sock   GNRC-specific implementation of the sock API
   * @ingroup     net_gnrc
   * @brief       Provides an implementation of the @ref net_sock by the
   *              @ref net_gnrc
   *
   * @{
   *
   * @file
   * @brief   GNRC-specific types and function definitions
   *
   * @author  Martine Lenders <mlenders@inf.fu-berlin.de>
   */
  #ifndef SOCK_TYPES_H
  #define SOCK_TYPES_H
  
  #include <stdbool.h>
  #include <stdint.h>
  
  #include "mbox.h"
  #include "net/af.h"
  #include "net/gnrc.h"
  #include "net/gnrc/netreg.h"
  #include "net/sock/ip.h"
  #include "net/sock/udp.h"
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  #ifndef SOCK_MBOX_SIZE
  #define SOCK_MBOX_SIZE      (8)         /**< Size for gnrc_sock_reg_t::mbox_queue */
  #endif
  
  /**
   * @brief   sock @ref net_gnrc_netreg info
   * @internal
   */
  typedef struct gnrc_sock_reg {
  #ifdef MODULE_GNRC_SOCK_CHECK_REUSE
      struct gnrc_sock_reg *next;         /**< list-like for internal storage */
  #endif
      gnrc_netreg_entry_t entry;          /**< @ref net_gnrc_netreg entry for mbox */
      mbox_t mbox;                        /**< @ref core_mbox target for the sock */
      msg_t mbox_queue[SOCK_MBOX_SIZE];   /**< queue for gnrc_sock_reg_t::mbox */
  } gnrc_sock_reg_t;
  
  /**
   * @brief   Raw IP sock type
   * @internal
   */
  struct sock_ip {
      gnrc_sock_reg_t reg;                /**< netreg info */
      sock_ip_ep_t local;                 /**< local end-point */
      sock_ip_ep_t remote;                /**< remote end-point */
      uint16_t flags;                     /**< option flags */
  };
  
  /**
   * @brief   UDP sock type
   * @internal
   */
  struct sock_udp {
      gnrc_sock_reg_t reg;                /**< netreg info */
      sock_udp_ep_t local;                /**< local end-point */
      sock_udp_ep_t remote;               /**< remote end-point */
      uint16_t flags;                     /**< option flags */
  };
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* SOCK_TYPES_H */
  /** @} */