The friendly Operating System for the Internet of Things
nettest.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef GNRC_NETTEST_H
22 #define GNRC_NETTEST_H
23 
24 #include <stdint.h>
25 #include <stdlib.h>
26 
27 #include "kernel_types.h"
28 #include "net/gnrc/netapi.h"
29 #include "net/netopt.h"
30 #include "net/gnrc/nettype.h"
31 #include "net/gnrc/pkt.h"
32 #include "thread.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
41 #ifndef GNRC_NETTEST_TIMEOUT
42 #define GNRC_NETTEST_TIMEOUT (1000)
43 #endif
44 
48 #ifndef GNRC_NETTEST_STACK_SIZE
49 #define GNRC_NETTEST_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
50 #endif
51 
55 #ifndef GNRC_NETTEST_PRIO
56 #define GNRC_NETTEST_PRIO (THREAD_PRIORITY_MAIN)
57 #endif
58 
62 #ifndef GNRC_NETTEST_MSG_QUEUE_SIZE
63 #define GNRC_NETTEST_MSG_QUEUE_SIZE (8U)
64 #endif
65 
66 
79 typedef int (*gnrc_nettest_opt_cb_t)(uint16_t context, void *data, uint16_t data_len);
80 
84 typedef struct {
88 
92 typedef enum {
99 
109 
119 
146  unsigned int exp_pkts,
147  const kernel_pid_t *exp_senders,
148  const gnrc_pktsnip_t **exp_out,
149  gnrc_nettype_t exp_type, uint32_t exp_demux_ctx);
150 
176  unsigned int exp_pkts,
177  const kernel_pid_t *exp_senders,
178  const gnrc_pktsnip_t **exp_out);
179 
204  unsigned int exp_pkts,
205  const kernel_pid_t *exp_senders,
206  const gnrc_pktsnip_t **exp_out,
207  gnrc_nettype_t exp_type, uint32_t exp_demux_ctx);
208 
227  uint16_t context, void *data, size_t data_len,
228  void *exp_data, int exp_res);
229 
246  uint16_t context, void *data, size_t data_len,
247  int exp_res);
248 
256 int gnrc_nettest_init(void);
257 
261 void gnrc_nettest_reset(void);
262 
263 #ifdef __cplusplus
264 }
265 #endif
266 
267 #endif /* GNRC_NETTEST_H */
268 
Types used by the kernel.
gnrc_nettest_res_t gnrc_nettest_set(kernel_pid_t pid, netopt_t opt, uint16_t context, void *data, size_t data_len, int exp_res)
Test GNRC_NETAPI_MSG_TYPE_SET command to pid.
wrong message type received
Definition: nettest.h:96
Option callback list element.
Definition: nettest.h:84
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
General definitions for network packets and their helper functions.
void gnrc_nettest_register_set(netopt_t opt, gnrc_nettest_opt_cb_t cb)
Registers a setter for an option.
wrong message type received
Definition: nettest.h:97
gnrc_nettest_res_t gnrc_nettest_receive(kernel_pid_t pid, gnrc_pktsnip_t *in, unsigned int exp_pkts, const kernel_pid_t *exp_senders, const gnrc_pktsnip_t **exp_out, gnrc_nettype_t exp_type, uint32_t exp_demux_ctx)
Test GNRC_NETAPI_MSG_TYPE_RCV command to pid.
Generic interface to communicate with GNRC modules.
void gnrc_nettest_reset(void)
Resets gnrc_nettest_opt_cbs_t list.
gnrc_nettest_res_t gnrc_nettest_send_iface(kernel_pid_t pid, gnrc_pktsnip_t *in, unsigned int exp_pkts, const kernel_pid_t *exp_senders, const gnrc_pktsnip_t **exp_out)
Test GNRC_NETAPI_MSG_TYPE_SND command to pid with the receiving thread being an interface.
int gnrc_nettest_init(void)
Initializes the NETAPI test framework module.
test failed
Definition: nettest.h:94
Threading API.
gnrc_nettest_opt_cb_t set
setter for an option
Definition: nettest.h:86
netopt_t
Global list of configuration options available throughout the network stack, e.g. ...
Definition: netopt.h:36
test timed out
Definition: nettest.h:95
gnrc_nettest_res_t
Result type for tests.
Definition: nettest.h:92
test was successful
Definition: nettest.h:93
int(* gnrc_nettest_opt_cb_t)(uint16_t context, void *data, uint16_t data_len)
Type for get/set callbacks.
Definition: nettest.h:79
Definition of global configuration options.
gnrc_nettest_res_t gnrc_nettest_get(kernel_pid_t pid, netopt_t opt, uint16_t context, void *data, size_t data_len, void *exp_data, int exp_res)
Test GNRC_NETAPI_MSG_TYPE_GET command to pid.
Type to represent parts (either headers or payload) of a packet, called snips.
gnrc_nettype_t
Definition of protocol types in the network stack.
Definition: nettype.h:42
stdlib.h wrapper for MSP430
gnrc_nettest_res_t gnrc_nettest_send(kernel_pid_t pid, gnrc_pktsnip_t *in, unsigned int exp_pkts, const kernel_pid_t *exp_senders, const gnrc_pktsnip_t **exp_out, gnrc_nettype_t exp_type, uint32_t exp_demux_ctx)
Test GNRC_NETAPI_MSG_TYPE_SND command to pid.
void gnrc_nettest_register_get(netopt_t opt, gnrc_nettest_opt_cb_t cb)
Registers a getter for an option.
Protocol type definitions.