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 
25 #ifndef NET_GNRC_NETTEST_H
26 #define NET_GNRC_NETTEST_H
27 
28 #include <stdint.h>
29 #include <stdlib.h>
30 
31 #include "kernel_types.h"
32 #include "net/gnrc/netapi.h"
33 #include "net/netopt.h"
34 #include "net/gnrc/nettype.h"
35 #include "net/gnrc/pkt.h"
36 #include "thread.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
45 #ifndef GNRC_NETTEST_TIMEOUT
46 #define GNRC_NETTEST_TIMEOUT (1000)
47 #endif
48 
52 #ifndef GNRC_NETTEST_STACK_SIZE
53 #define GNRC_NETTEST_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
54 #endif
55 
59 #ifndef GNRC_NETTEST_PRIO
60 #define GNRC_NETTEST_PRIO (THREAD_PRIORITY_MAIN)
61 #endif
62 
66 #ifndef GNRC_NETTEST_MSG_QUEUE_SIZE
67 #define GNRC_NETTEST_MSG_QUEUE_SIZE (8U)
68 #endif
69 
70 
83 typedef int (*gnrc_nettest_opt_cb_t)(uint16_t context, void *data, uint16_t data_len);
84 
88 typedef struct {
92 
96 typedef enum {
103 
113 
123 
149 gnrc_nettest_res_t gnrc_nettest_send(kernel_pid_t pid, gnrc_pktsnip_t *in,
150  unsigned int exp_pkts,
151  const kernel_pid_t *exp_senders,
152  const gnrc_pktsnip_t **exp_out,
153  gnrc_nettype_t exp_type, uint32_t exp_demux_ctx);
154 
179 gnrc_nettest_res_t gnrc_nettest_send_iface(kernel_pid_t pid, gnrc_pktsnip_t *in,
180  unsigned int exp_pkts,
181  const kernel_pid_t *exp_senders,
182  const gnrc_pktsnip_t **exp_out);
183 
207 gnrc_nettest_res_t gnrc_nettest_receive(kernel_pid_t pid, gnrc_pktsnip_t *in,
208  unsigned int exp_pkts,
209  const kernel_pid_t *exp_senders,
210  const gnrc_pktsnip_t **exp_out,
211  gnrc_nettype_t exp_type, uint32_t exp_demux_ctx);
212 
230 gnrc_nettest_res_t gnrc_nettest_get(kernel_pid_t pid, netopt_t opt,
231  uint16_t context, void *data, size_t data_len,
232  void *exp_data, int exp_res);
233 
249 gnrc_nettest_res_t gnrc_nettest_set(kernel_pid_t pid, netopt_t opt,
250  uint16_t context, void *data, size_t data_len,
251  int exp_res);
252 
260 int gnrc_nettest_init(void);
261 
265 void gnrc_nettest_reset(void);
266 
267 #ifdef __cplusplus
268 }
269 #endif
270 
271 #endif /* NET_GNRC_NETTEST_H */
272 
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:100
Option callback list element.
Definition: nettest.h:88
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:101
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.
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
test failed
Definition: nettest.h:98
netopt_t
Global list of configuration options available throughout the network stack, e.g. ...
Definition: netopt.h:59
test timed out
Definition: nettest.h:99
gnrc_nettest_res_t
Result type for tests.
Definition: nettest.h:96
test was successful
Definition: nettest.h:97
int(* gnrc_nettest_opt_cb_t)(uint16_t context, void *data, uint16_t data_len)
Type for get/set callbacks.
Definition: nettest.h:83
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.
Definition: pkt.h:107
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.