nettest.h¶
Definitions for the GNRC communication interface test framework.
-
GNRC_NETTEST_TIMEOUT¶ Timeout for tests in microseconds.
1
(1000)
-
GNRC_NETTEST_STACK_SIZE¶ Default stack size to use for the nettest thread.
1
(THREAD_STACKSIZE_DEFAULT)
-
GNRC_NETTEST_PRIO¶ Default priority for the nettest thread.
1
(THREAD_PRIORITY_MAIN)
-
GNRC_NETTEST_MSG_QUEUE_SIZE¶ Default message queue size to use for the nettest thread.
1
(8U)
-
enum
gnrc_nettest_res_t¶ - GNRC_NETTEST_SUCCESS
= 0 - test was successful
- GNRC_NETTEST_FAIL
- test failed
- GNRC_NETTEST_TIMED_OUT
- test timed out
- GNRC_NETTEST_WRONG_MSG
- wrong message type received
- GNRC_NETTEST_WRONG_SENDER
- wrong message type received
- GNRC_NETTEST_SUCCESS
-
int(*
gnrc_nettest_opt_cb_t()¶ Type for get/set callbacks.
Parameters
context: (Optional) context for the option. Compare netapi.h::gnrc_netapi_opt_t::context.data: Data to set or buffer to read into. Compare netapi.h::gnrc_netapi_opt_t::data.data_len: Size of the data / the buffer. Compare netapi.h::gnrc_netapi_opt_t::data_lenReturn values
- The value for the
netapi.h::GNRC_NETAPI_MSG_TYPE_ACKmessage.
- The value for the
-
void
gnrc_nettest_register_get(netopt.h::netopt_topt,nettest.h::gnrc_nettest_opt_cb_tcb)¶ Registers a getter for an option.
Overrides previous registrations.
Parameters
opt: The option to register the getter for. cb: An option getter. NULL to delete.
-
void
gnrc_nettest_register_set(netopt.h::netopt_topt,nettest.h::gnrc_nettest_opt_cb_tcb)¶ Registers a setter for an option.
Overrides previous registrations.
Parameters
opt: The option to register the setter for. cb: An option setter. NULL to delete.
-
nettest.h::gnrc_nettest_res_tgnrc_nettest_send(kernel_types.h::kernel_pid_tpid,include/net/gnrc/pkt.h::gnrc_pktsnip_t* in, unsigned int exp_pkts, constkernel_types.h::kernel_pid_t* exp_senders, constinclude/net/gnrc/pkt.h::gnrc_pktsnip_t** exp_out,nettype.h::gnrc_nettype_texp_type, uint32_t exp_demux_ctx)¶ Test
netapi.h::GNRC_NETAPI_MSG_TYPE_SNDcommand topid.This registered the nettest thread to (
exp_type,exp_demux_ctx) and checks ifexp_pktsofexp_outwere received fromexp_senders. If no message was received afternettest.h::GNRC_NETTEST_TIMEOUTmicroseconds, while there are still packets expected, the function will return GNRC_NETTEST_TIMED_OUT.In case of success it releases all packets send by the tested module.
Parameters
pid: The thread you want to test the netapi.h::GNRC_NETAPI_MSG_TYPE_SNDcommand for.in: The packet you want to send through pid.exp_pkts: The number of packets expected to be received. exp_senders: The PID the resulting packet should be coming from. Must be of dimension exp_pkts.exp_out: The expected packet from exp_sender. Must be of dimensionexp_pkts.exp_type: The expected receiver type for the netapi.h::GNRC_NETAPI_MSG_TYPE_SNDcommand.exp_demux_ctx: The expected receiver demux type for the netapi.h::GNRC_NETAPI_MSG_TYPE_SNDcommand.See also
Return values
-
nettest.h::gnrc_nettest_res_tgnrc_nettest_send_iface(kernel_types.h::kernel_pid_tpid,include/net/gnrc/pkt.h::gnrc_pktsnip_t* in, unsigned int exp_pkts, constkernel_types.h::kernel_pid_t* exp_senders, constinclude/net/gnrc/pkt.h::gnrc_pktsnip_t** exp_out)¶ Test
netapi.h::GNRC_NETAPI_MSG_TYPE_SNDcommand topidwith the receiving thread being an interface.This registered the nettest thread as an interface and checks ifx
exp_pktsofexp_outwere received fromexp_senders. If no message was received afternettest.h::GNRC_NETTEST_TIMEOUTmicroseconds, while there are still packets expected, the function will return GNRC_NETTEST_TIMED_OUT.In case of success it releases all packets received from the tested module.
Parameters
pid: The thread you want to test the netapi.h::GNRC_NETAPI_MSG_TYPE_SNDcommand for.in: The packet you want to send through pid.exp_pkts: The number of packets expected to be received. exp_senders: The PID the resulting packet should be coming from. Must be of dimension exp_pkts. May be NULL ifexp_pkts== 0.exp_out: The expected packet from exp_sender. Must be of dimensionexp_pkts. May be NULL ifexp_pkts== 0.See also
Return values
-
nettest.h::gnrc_nettest_res_tgnrc_nettest_receive(kernel_types.h::kernel_pid_tpid,include/net/gnrc/pkt.h::gnrc_pktsnip_t* in, unsigned int exp_pkts, constkernel_types.h::kernel_pid_t* exp_senders, constinclude/net/gnrc/pkt.h::gnrc_pktsnip_t** exp_out,nettype.h::gnrc_nettype_texp_type, uint32_t exp_demux_ctx)¶ Test
netapi.h::GNRC_NETAPI_MSG_TYPE_RCVcommand topid.This registered the nettest thread to (
exp_type,exp_demux_ctx) and checks ifexp_pktsofexp_outwere received fromexp_senders. If no message was received afternettest.h::GNRC_NETTEST_TIMEOUTmicroseconds, while there are still packets expected, the function will return GNRC_NETTEST_TIMED_OUT.Parameters
pid: The thread you want to test the netapi.h::GNRC_NETAPI_MSG_TYPE_RCVcommand for.in: The packet you want to send through pid.exp_pkts: The number of packets expected to be received. exp_senders: The PID the resulting packet should be coming from. Must be of dimension exp_pkts.exp_out: The expected packet from exp_sender. Must be of dimensionexp_pkts.exp_type: The expected receiver type for the netapi.h::GNRC_NETAPI_MSG_TYPE_RCVcommand.exp_demux_ctx: The expected receiver demux type for the netapi.h::GNRC_NETAPI_MSG_TYPE_RCVcommand.See also
Return values
-
nettest.h::gnrc_nettest_res_tgnrc_nettest_get(kernel_types.h::kernel_pid_tpid,netopt.h::netopt_topt, uint16_t context, void * data,msp430_types.h::size_tdata_len, void * exp_data, int exp_res)¶ Test
netapi.h::GNRC_NETAPI_MSG_TYPE_GETcommand topid.Parameters
pid: The thread you want to test the netapi.h::GNRC_NETAPI_MSG_TYPE_GETcommand for.opt: The option you want to test. context: The context for the option. data: The data pointer for the netapi.h::GNRC_NETAPI_MSG_TYPE_GETcommand.data_len: The maximum length for data.exp_data: The expected value for the returned data. May be NULL if exp_res< 0exp_res: The expected return value for the netapi.h::GNRC_NETAPI_MSG_TYPE_GETcommand.See also
Return values
-
nettest.h::gnrc_nettest_res_tgnrc_nettest_set(kernel_types.h::kernel_pid_tpid,netopt.h::netopt_topt, uint16_t context, void * data,msp430_types.h::size_tdata_len, int exp_res)¶ Test
netapi.h::GNRC_NETAPI_MSG_TYPE_SETcommand topid.Parameters
pid: The thread you want to test the netapi.h::GNRC_NETAPI_MSG_TYPE_SETcommand for.opt: The option you want to test. context: The context for the option. data: The data pointer for the netapi.h::GNRC_NETAPI_MSG_TYPE_SETcommand.data_len: The maximum length for data.exp_res: The expected return value for the netapi.h::GNRC_NETAPI_MSG_TYPE_SETcommand.See also
Return values
-
int
gnrc_nettest_init(void)¶ Initializes the NETAPI test framework module.
Return values
- The PID to the nettest thread, on success.
- a negative errno on error.
- -EOVERFLOW, if there are too many threads running already
-
void
gnrc_nettest_reset(void)¶ Resets gnrc_nettest_opt_cbs_t list.
-
struct
gnrc_nettest_opt_cbs_t¶ Option callback list element.
-
nettest.h::gnrc_nettest_opt_cb_tget¶ getter for an option
-
nettest.h::gnrc_nettest_opt_cb_tset¶ setter for an option
-