Skip to content

Commit

Permalink
core: introduce interface for setting preferred network (#442)
Browse files Browse the repository at this point in the history
Description: This is to allow OS/platform reachability signals to be consumed by the Envoy library engine.

Co-authored-by: Jose Nino <[email protected]>
Signed-off-by: Mike Schore <[email protected]>
Signed-off-by: JP Simard <[email protected]>
  • Loading branch information
2 people authored and jpsim committed Nov 29, 2022
1 parent 904f486 commit 544b463
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mobile/library/common/main_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ envoy_engine_t init_engine() {
return 1;
}

envoy_status_t set_preferred_network(envoy_network_t) { return ENVOY_SUCCESS; }

/**
* External entrypoint for library.
*/
Expand Down
8 changes: 8 additions & 0 deletions mobile/library/common/main_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ envoy_status_t reset_stream(envoy_stream_t stream);
*/
envoy_engine_t init_engine();

/**
* Update the network interface to the preferred network for opening new streams.
* Note that this state is shared by all engines.
* @param network_interface, the interface to be preferred for new sockets.
* @return envoy_status_t, the resulting status of the operation.
*/
envoy_status_t set_preferred_network(envoy_network_t network_interface);

/**
* External entry point for library.
* @param config, the configuration blob to run envoy with.
Expand Down
8 changes: 8 additions & 0 deletions mobile/library/common/types/c_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ typedef enum { ENVOY_SUCCESS, ENVOY_FAILURE } envoy_status_t;
*/
typedef enum { ENVOY_UNDEFINED_ERROR, ENVOY_STREAM_RESET } envoy_error_code_t;

/**
* Networks classified by last physical link.
* ENVOY_GENERIC is default and includes cases where network characteristics are unknown.
* ENVOY_WLAN includes WiFi and other local area wireless networks.
* ENVOY_WWAN includes all mobile phone networks.
*/
typedef enum { ENVOY_GENERIC, ENVOY_WLAN, ENVOY_WWAN } envoy_network_t;

#ifdef __cplusplus
extern "C" { // release function
#endif
Expand Down

0 comments on commit 544b463

Please sign in to comment.