Mstdlib-1.24.0
Addon for bandwidth shaping

Typedefs

typedef enum M_io_bwshaping_mode M_io_bwshaping_mode_t
 
typedef enum M_io_bwshaping_direction M_io_bwshaping_direction_t
 

Enumerations

enum  M_io_bwshaping_mode {
  M_IO_BWSHAPING_MODE_BURST = 1 ,
  M_IO_BWSHAPING_MODE_TRICKLE = 2
}
 
enum  M_io_bwshaping_direction {
  M_IO_BWSHAPING_DIRECTION_IN = 1 ,
  M_IO_BWSHAPING_DIRECTION_OUT = 2
}
 

Functions

M_io_error_t M_io_add_bwshaping (M_io_t *io, size_t *layer_id)
 
M_bool M_io_bwshaping_set_throttle (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction, M_uint64 Bps)
 
M_bool M_io_bwshaping_set_throttle_mode (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction, M_io_bwshaping_mode_t mode)
 
M_bool M_io_bwshaping_set_throttle_period (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction, M_uint64 period_s, M_uint64 sample_frequency_ms)
 
M_bool M_io_bwshaping_set_latency (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction, M_uint64 latency_ms)
 
M_uint64 M_io_bwshaping_get_Bps (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction)
 
M_uint64 M_io_bwshaping_get_totalbytes (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction)
 
M_uint64 M_io_bwshaping_get_totalms (M_io_t *io, size_t layer_id)
 

Detailed Description

Bandwidth Shaping Addon

Allows tracking and altering data flow though an io object.

Common uses:

Typedef Documentation

◆ M_io_bwshaping_mode_t

◆ M_io_bwshaping_direction_t

Enumeration Type Documentation

◆ M_io_bwshaping_mode

Method of shaping.

Enumerator
M_IO_BWSHAPING_MODE_BURST 

Allow bursting of data for each throttle period

M_IO_BWSHAPING_MODE_TRICKLE 

Enforce data to be more evenly distributed across the throttle period

◆ M_io_bwshaping_direction

Shaping direction.

Enumerator
M_IO_BWSHAPING_DIRECTION_IN 
M_IO_BWSHAPING_DIRECTION_OUT 

Function Documentation

◆ M_io_add_bwshaping()

M_io_error_t M_io_add_bwshaping ( M_io_t io,
size_t *  layer_id 
)

Add a BWShaping layer.

Adding a layer without any settings will track bandwidth utilization

Parameters
[in]ioio object.
[out]layer_idLayer id this is added at.
Returns
Result.

◆ M_io_bwshaping_set_throttle()

M_bool M_io_bwshaping_set_throttle ( M_io_t io,
size_t  layer_id,
M_io_bwshaping_direction_t  direction,
M_uint64  Bps 
)

Throttle data by bytes per seconds.

Parameters
[in]ioio object.
[in]layer_idLayer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping.
[in]directionDirection this applies to.
[in]BpsBytes per seconds that should be throttled. Bps = 0 is infinite.
Returns
Result.

◆ M_io_bwshaping_set_throttle_mode()

M_bool M_io_bwshaping_set_throttle_mode ( M_io_t io,
size_t  layer_id,
M_io_bwshaping_direction_t  direction,
M_io_bwshaping_mode_t  mode 
)

Set how the data throttling should function.

Parameters
[in]ioio object.
[in]layer_idLayer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping.
[in]directionDirection this applies to.
[in]modeThrottle mode.
Returns
Result.

◆ M_io_bwshaping_set_throttle_period()

M_bool M_io_bwshaping_set_throttle_period ( M_io_t io,
size_t  layer_id,
M_io_bwshaping_direction_t  direction,
M_uint64  period_s,
M_uint64  sample_frequency_ms 
)

Set throttle period.

The period must be longer than the sample frequency. Meaning period * 1000 > sample frequency.

Parameters
[in]ioio object.
[in]layer_idLayer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping.
[in]directionDirection this applies to.
[in]period_sPeriod in seconds. Must be at least 1.
[in]sample_frequency_msFrequency in milliseconds. Must be at least 15.
Returns
Result.

◆ M_io_bwshaping_set_latency()

M_bool M_io_bwshaping_set_latency ( M_io_t io,
size_t  layer_id,
M_io_bwshaping_direction_t  direction,
M_uint64  latency_ms 
)

Set latency.

Parameters
[in]ioio object.
[in]layer_idLayer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping.
[in]directionDirection this applies to.
[in]latency_msLatency in milliseconds. 0 is no latency.
Returns
Result.

◆ M_io_bwshaping_get_Bps()

M_uint64 M_io_bwshaping_get_Bps ( M_io_t io,
size_t  layer_id,
M_io_bwshaping_direction_t  direction 
)

Get current Bps in period for direction

Parameters
[in]ioio object.
[in]layer_idLayer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping.
[in]directionDirection this applies to.
Returns
Bps.

◆ M_io_bwshaping_get_totalbytes()

M_uint64 M_io_bwshaping_get_totalbytes ( M_io_t io,
size_t  layer_id,
M_io_bwshaping_direction_t  direction 
)

Get total number of bytes transferred for direction since beginning

Parameters
[in]ioio object.
[in]layer_idLayer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping.
[in]directionDirection this applies to.
Returns
Count of bytes.

◆ M_io_bwshaping_get_totalms()

M_uint64 M_io_bwshaping_get_totalms ( M_io_t io,
size_t  layer_id 
)

Get total time of connection in ms

Parameters
[in]ioio object.
[in]layer_idLayer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping.
Returns
Milliseconds.