Shell commands to test a CongURE implementation.  
More...
Shell commands to test a CongURE implementation. 
This module requires an application defined congure_impl.h which defines the congure_snd_t extension of the CongURE implementation as congure_test_snd_t and provides a function declaration congure_test_snd_setup() setup said type. E.g.
 
struct congure_reno_snd congure_reno_snd_t
Forward declaration of state object for CongURE Reno.
congure_snd_t congure_test_snd_t
Application-defined type for the CongURE state object under test.
int congure_test_snd_setup(void congure_test_snd_t *c, unsigned id)
Setup the application-defined CongURE state object under test.
 All constants and initial values can then be set within the application specific definition of congure_test_snd_setup(). 
|  | 
| file | test.h | 
|  | Definitions for the CongURE test framework. 
 | 
|  | 
◆ CONFIG_CONGURE_TEST_LOST_MSG_POOL_SIZE
      
        
          | #define CONFIG_CONGURE_TEST_LOST_MSG_POOL_SIZE   (4U) | 
      
 
Pool size for the message list elements for a lost message report. 
- See also
- congure_snd_driver_t::report_msg_lost
This defines the maximum number of 3-tuples you can use with congure_test_call_report() when argv[1] = "msg_lost". 
Definition at line 83 of file test.h.
 
 
◆ congure_test_snd_t
Application-defined type for the CongURE state object under test. 
- Note
- Needs to be set within an application-provided congure_impl.hto the state object of the CongURE implementation you want to test.
Definition at line 53 of file test.h.
 
 
◆ congure_test_add_msg()
      
        
          | int congure_test_add_msg | ( | int | argc, | 
        
          |  |  | char ** | argv ) | 
      
 
Adds a message from the message pool to the list for cong_report msgs_lost and cong_report msgs_timeout. 
- Parameters
- 
  
    | [in] | argc | Number of argv. Needs to be at least 4 |  | [in] | argv | Three arguments are expected. Each call of the command represents an element of the msgslist parameter of congure_snd_driver_t::report_msgs_lost() and congure_snd_msg_t::report_msgs_timeout():
argv[1](msg_send_time) is expected to be an integer for thesend_timemember of congure_snd_msg_t,argv[2](msg_size) is expected to be an integer for thesizemember of congure_snd_msg_t, andargv[3](msg_resends) is expected to be a an integer integer for theresendsmember of congure_snd_msg_t. |  
 
This function will generate the following JSON objects in STDOUT:
-  On success
- {"error":"At least 3 arguments `msg_send_time`, `msg_size`, -  `msg_resends` expected"}  
- argc < 4.
- {"error":"`<arg_name>` expected to be integer"}  
- argv[i] = "<arg_name>"is expected to be an integer but is not parseable
- {"error":"List element pool depleted"}  
- cong_msgs_resetin between.
- Return values
- 
  
  
 
 
◆ congure_test_call_init()
      
        
          | int congure_test_call_init | ( | int | argc, | 
        
          |  |  | char ** | argv ) | 
      
 
Calls init() method for CongURE state object. 
- See also
- congure_snd_driver_t::init()
- Parameters
- 
  
    | [in] | argc | Number of argv. Needs to be at least 2. |  | [in] | argv | Command line arguments. argv[0]needs to be the command name andargv[1]needs to be a hexadecimal integer of format 0xXXXX, representing a pointer to the object used as thectxparameter forinit(). |  
 
This function will generate the following JSON objects in STDOUT on error:
- {"error":"State object not set up"}  
- drivermember of the state object is- NULL).
- {"error":"`ctx` argument expected"}  
- argc< 2.
- {"error":"`ctx` expected to be hex"}  
- argv[1]is not parseable as a hexadecimal integer.
Always generates the following JSON object in STDOUT: 
- Return values
- 
  
  
 
 
◆ congure_test_call_inter_msg_interval()
      
        
          | int congure_test_call_inter_msg_interval | ( | int | argc, | 
        
          |  |  | char ** | argv ) | 
      
 
Calls inter_msg_interval() method for CongURE state object. 
- See also
- congure_snd_driver_t::inter_msg_interval()
- Parameters
- 
  
    | [in] | argc | Number of argv. Needs to be at least 1. |  | [in] | argv | Command line arguments. No extra arguments are required except for the command name in argv[0]. |  
 
This function will generate the following JSON objects in STDOUT:
- Return values
- 
  
  
 
 
◆ congure_test_call_report()
      
        
          | int congure_test_call_report | ( | int | argc, | 
        
          |  |  | char ** | argv ) | 
      
 
Calls one of the report_*() methods for CongURE state object. 
- See also
- congure_snd_driver_t::report_msg_sent() 
- 
congure_snd_driver_t::report_msg_discarded() 
- 
congure_snd_driver_t::report_msg_timeout() 
- 
congure_snd_driver_t::report_msg_lost() 
- 
congure_snd_driver_t::report_msg_acked() 
- 
congure_snd_driver_t::report_ecn_ce()
- Parameters
- 
  
    | [in] | argc | Number of argv. Needs to be at least 2. |  | [in] | argv | Command line arguments. argv[0]needs to be the command name andargv[1]needs to one of the following sub-commands that may require at least one extra arguments: |  
 
This function will generate the following JSON objects in STDOUT:
-  On success
- {"error":"State object not set up"}  
- drivermember of the state object is- NULL).
- {"error":"No report command provided"}  
- argc< 2.
- {"error":"Unknown command `<command>`"}  
- argv[1] = "<command>"is not a known sub-command.
- {"error":"`<arg_name>` argument expected"}  
- argv[i] = "<arg_name>"is expected but- argc <= i.
- {"error":"`<arg_name>` expected to be integer"}  
- argv[i] = "<arg_name>"is expected to be an integer but is not parseable
- {"error":"`<arg_name>` expected not 16 bit wide"}  
- argv[i] = "<arg_name>"is expected to be an 16-bit unsigned integer but is is greater than or equal to $2^{16}$
- {"error":"At least `<arg_num>` arguments <arglist> expecdted"} 
- argcis smaller than expected.- <arg_num>provides the number of arguments beyond the sub-command (i.e.- argcneeds at least to be- <arg_num> + 2), with the names of the arguments expected provided in- <arg_list>as a comma-seperated list of- <arg_name>
- {"error":"Message not initialized"}  
- argv[0]in- {msg_acked, msgs_lost, msgs_timout}was not called, but no messages where added using congure_test_add_msg().
- Return values
- 
  
  
 
 
◆ congure_test_call_setup()
      
        
          | int congure_test_call_setup | ( | int | argc, | 
        
          |  |  | char ** | argv ) | 
      
 
Setup the CongURE state object. 
Calls application-defined congure_test_snd_setup()
- Parameters
- 
  
    | [in] | argc | Number of argv. Needs to be at least 1. |  | [in] | argv | Command line arguments. The command name is expected in argv[0]. Ifargc> 1, a integer is expected inargv[1]for theidparameter of congure_test_snd_setup(). |  
 
This function will generate the following JSON objects in STDOUT:
- {"success": "0x12345678"}  
- 0x12345678being replaced with the memory address of the state object.
- {"error":"`id` expected to be integer"}  
- argv[1]is not parsable to an unsigned integer.
- {"error":"`id` is invalid"}  
- argv[1]is a valid unsigned integer but is an unknown value to the application.
- Return values
- 
  
    | 0 | on success. |  | 1 | on error. Only can happen if argv[1]is provided and an invalid or unexpected value. |  
 
 
 
◆ congure_test_clear_state()
      
        
          | int congure_test_clear_state | ( | int | argc, | 
        
          |  |  | char ** | argv ) | 
      
 
Clears the CongURE state object. 
Every byte in the state object is set to 0.
- Parameters
- 
  
    | [in] | argc | Number of argv. Needs to be at least 1. |  | [in] | argv | Command line arguments. No extra arguments are required except for the command name in argv[0]. |  
 
Always generates the following JSON object in STDOUT: 
- Returns
- Always 0. 
 
 
◆ congure_test_get_state()
Get the application-defined CongURE state object. 
- Note
- Needs to be defined by the application
- Returns
- The CongURE state object. 
 
 
◆ congure_test_msgs_reset()
      
        
          | int congure_test_msgs_reset | ( | int | argc, | 
        
          |  |  | char ** | argv ) | 
      
 
Resets the message pool and messages list for cong_report msgs_lost and cong_report msgs_timeout. 
- Parameters
- 
  
    | [in] | argc | Number of argv. Needs to be at least 1. |  | [in] | argv | Command line arguments. No extra arguments are required except for the command name in argv[0]. |  
 
Always generates the following JSON object in STDOUT: 
- Returns
- Always 0. 
 
 
◆ congure_test_snd_setup()
Setup the application-defined CongURE state object under test. 
- Note
- Needs to be defined by the application and declare it within an application-provided congure_impl.h
- Parameters
- 
  
    | [in,out] | c | The CongURE state object under test. May not be NULL. |  | [in] | id | And application-specific ID that may identify different setup parameters, e.g. a set of different constants to use when setting up c. If not applicable to your application just ignoreid. |  
 
- Return values
- 
  
    | 0 | on success |  | -1 | when idis not ignored and is an unknown value to the application. |