James Kuszmaul | 4a42b18 | 2021-01-17 11:32:46 -0800 | [diff] [blame^] | 1 | #pragma once |
| 2 | #include "common.h" |
| 3 | #include <rawrtc.h> |
| 4 | #include <rawrtcc.h> |
| 5 | #include <rawrtcdc.h> |
| 6 | #include <re.h> |
| 7 | |
| 8 | /* |
| 9 | * Convert string to uint16. |
| 10 | */ |
| 11 | bool str_to_uint16(uint16_t* const numberp, char* const str); |
| 12 | |
| 13 | /* |
| 14 | * Convert string to uint64. |
| 15 | */ |
| 16 | bool str_to_uint64(uint64_t* const numberp, char* const str); |
| 17 | |
| 18 | /* |
| 19 | * Convert string to uint32. |
| 20 | */ |
| 21 | bool str_to_uint32(uint32_t* const numberp, char* const str); |
| 22 | |
| 23 | /* |
| 24 | * Get a dictionary entry and store it in `*valuep`. |
| 25 | */ |
| 26 | enum rawrtc_code dict_get_entry( |
| 27 | void* const valuep, |
| 28 | struct odict* const parent, |
| 29 | char* const key, |
| 30 | enum odict_type const type, |
| 31 | bool required); |
| 32 | |
| 33 | /* |
| 34 | * Get a uint32 entry and store it in `*valuep`. |
| 35 | */ |
| 36 | enum rawrtc_code dict_get_uint32( |
| 37 | uint32_t* const valuep, struct odict* const parent, char* const key, bool required); |
| 38 | |
| 39 | /* |
| 40 | * Get a uint16 entry and store it in `*valuep`. |
| 41 | */ |
| 42 | enum rawrtc_code dict_get_uint16( |
| 43 | uint16_t* const valuep, struct odict* const parent, char* const key, bool required); |
| 44 | |
| 45 | /* |
| 46 | * Get JSON from stdin and parse it to a dictionary. |
| 47 | */ |
| 48 | enum rawrtc_code get_json_stdin(struct odict** const dictp // de-referenced |
| 49 | ); |
| 50 | |
| 51 | /* |
| 52 | * Get the ICE role from a string. |
| 53 | */ |
| 54 | enum rawrtc_code get_ice_role( |
| 55 | enum rawrtc_ice_role* const rolep, // de-referenced |
| 56 | char const* const str); |
| 57 | |
| 58 | /* |
| 59 | * Get the congestion control algorithm from a string. |
| 60 | */ |
| 61 | enum rawrtc_code get_congestion_control_algorithm( |
| 62 | enum rawrtc_sctp_transport_congestion_ctrl* const algorithmp, // de-referenced |
| 63 | char const* const str); |
| 64 | |
| 65 | /* |
| 66 | * Create a data channel helper instance. |
| 67 | */ |
| 68 | void data_channel_helper_create( |
| 69 | struct data_channel_helper** const channel_helperp, // de-referenced |
| 70 | struct client* const client, |
| 71 | char* const label); |
| 72 | |
| 73 | /* |
| 74 | * Create a data channel helper instance from parameters. |
| 75 | */ |
| 76 | void data_channel_helper_create_from_channel( |
| 77 | struct data_channel_helper** const channel_helperp, // de-referenced |
| 78 | struct rawrtc_data_channel* channel, |
| 79 | struct client* const client, |
| 80 | void* const arg // nullable |
| 81 | ); |
| 82 | |
| 83 | /* |
| 84 | * Add the ICE candidate to the remote ICE transport if the ICE |
| 85 | * candidate type is enabled. |
| 86 | */ |
| 87 | void add_to_other_if_ice_candidate_type_enabled( |
| 88 | struct client* const client, |
| 89 | struct rawrtc_ice_candidate* const candidate, |
| 90 | struct rawrtc_ice_transport* const transport); |