Soletta™ Framework
|
API that should be used to manage device connections. More...
Data Structures | |
struct | sol_netctl_agent |
agent callback functions More... | |
struct | sol_netctl_agent_input |
agent input struct More... | |
struct | sol_netctl_ethernet |
struct to represent a network ethernet. More... | |
struct | sol_netctl_network_params |
network params More... | |
struct | sol_netctl_provider |
struct to represent a network provider. More... | |
struct | sol_netctl_proxy |
struct to represent a network proxy. More... | |
Macros | |
#define | SOL_NETCTL_AGENT_IDENTITY "Identity" |
the agent input identity type string More... | |
#define | SOL_NETCTL_AGENT_NAME "Name" |
the agent input name type string More... | |
#define | SOL_NETCTL_AGENT_PASSPHRASE "Passphrase" |
the agent input passphrase type string More... | |
#define | SOL_NETCTL_AGENT_PASSWORD "Password" |
the agent input password type string More... | |
#define | SOL_NETCTL_AGENT_USERNAME "Username" |
the agent input username type string More... | |
#define | SOL_NETCTL_AGENT_WPS "WPS" |
the agent input WPS type string More... | |
#define | SOL_NETCTL_SERVICE_TYPE_BLUETOOTH "bluetooth" |
bluetooth service type string More... | |
#define | SOL_NETCTL_SERVICE_TYPE_CELLULAR "cellular" |
bluetooth service type string More... | |
#define | SOL_NETCTL_SERVICE_TYPE_ETHERNET "ethernet" |
ethernet service type string More... | |
#define | SOL_NETCTL_SERVICE_TYPE_GADGET "gadget" |
gadget service type string More... | |
#define | SOL_NETCTL_SERVICE_TYPE_GPS "gps" |
gps service type string More... | |
#define | SOL_NETCTL_SERVICE_TYPE_P2P "p2p" |
p2p service type string More... | |
#define | SOL_NETCTL_SERVICE_TYPE_VPN "vpn" |
vpn service type string More... | |
#define | SOL_NETCTL_SERVICE_TYPE_WIFI "wifi" |
wifi service type string More... | |
Typedefs | |
typedef struct sol_netctl_agent | sol_netctl_agent |
agent callback functions More... | |
typedef struct sol_netctl_agent_input | sol_netctl_agent_input |
agent input struct More... | |
typedef void(* | sol_netctl_error_monitor_cb )(void *data, const struct sol_netctl_service *service, unsigned int error) |
error monitor callback used to inform a call result More... | |
typedef struct sol_netctl_ethernet | sol_netctl_ethernet |
struct to represent a network ethernet. More... | |
typedef void(* | sol_netctl_manager_monitor_cb )(void *data) |
Manager monitor callback used to inform a manager updated. More... | |
typedef struct sol_netctl_network_params | sol_netctl_network_params |
network params More... | |
typedef struct sol_netctl_provider | sol_netctl_provider |
struct to represent a network provider. More... | |
typedef struct sol_netctl_proxy | sol_netctl_proxy |
struct to represent a network proxy. More... | |
typedef struct sol_netctl_service | sol_netctl_service |
service struct More... | |
typedef void(* | sol_netctl_service_monitor_cb )(void *data, const struct sol_netctl_service *service) |
Service monitor callback used to inform a service changed. More... | |
Enumerations | |
enum | sol_netctl_proxy_method { SOL_NETCTL_PROXY_METHOD_DIRECT, SOL_NETCTL_PROXY_METHOD_AUTO, SOL_NETCTL_PROXY_METHOD_MANUAL } |
method of proxy generated for a network link. More... | |
enum | sol_netctl_service_state { SOL_NETCTL_SERVICE_STATE_UNKNOWN = 0, SOL_NETCTL_SERVICE_STATE_IDLE, SOL_NETCTL_SERVICE_STATE_ASSOCIATION, SOL_NETCTL_SERVICE_STATE_CONFIGURATION, SOL_NETCTL_SERVICE_STATE_READY, SOL_NETCTL_SERVICE_STATE_ONLINE, SOL_NETCTL_SERVICE_STATE_DISCONNECT, SOL_NETCTL_SERVICE_STATE_FAILURE, SOL_NETCTL_SERVICE_STATE_REMOVE } |
service state More... | |
enum | sol_netctl_state { SOL_NETCTL_STATE_UNKNOWN = 0, SOL_NETCTL_STATE_IDLE, SOL_NETCTL_STATE_READY, SOL_NETCTL_STATE_ONLINE, SOL_NETCTL_STATE_OFFLINE } |
the global connection state of system More... | |
Functions | |
int | sol_netctl_add_error_monitor (sol_netctl_error_monitor_cb cb, const void *data) |
Adds a monitor for the call error happens. More... | |
int | sol_netctl_add_manager_monitor (sol_netctl_manager_monitor_cb cb, const void *data) |
Adds a monitor for the updated netctl manager properties. More... | |
int | sol_netctl_add_service_monitor (sol_netctl_service_monitor_cb cb, const void *data) |
Adds a monitor for the updated netctl services. More... | |
int | sol_netctl_del_error_monitor (sol_netctl_error_monitor_cb cb, const void *data) |
Dels a monitor for the call error happens. More... | |
int | sol_netctl_del_manager_monitor (sol_netctl_manager_monitor_cb cb, const void *data) |
Dels a monitor for the updated netctl manager properties. More... | |
int | sol_netctl_del_service_monitor (sol_netctl_service_monitor_cb cb, const void *data) |
Dels a monitor for the updated netctl services. More... | |
static struct sol_netctl_service * | sol_netctl_find_service_by_name (const char *service_name) |
get so_netctl_service struct from serivce name. More... | |
bool | sol_netctl_get_radios_offline (void) |
Gets the global connection state of offline. More... | |
const struct sol_ptr_vector * | sol_netctl_get_services (void) |
Gets the netctl services. More... | |
enum sol_netctl_state | sol_netctl_get_state (void) |
Gets the global connection state of system. More... | |
int | sol_netctl_register_agent (const struct sol_netctl_agent *agent, const void *data) |
register a agent for network connection More... | |
int | sol_netctl_request_input (struct sol_netctl_service *service, const struct sol_ptr_vector *inputs) |
request the login input to connection More... | |
int | sol_netctl_request_retry (struct sol_netctl_service *service, bool retry) |
request retry the connection or not when error type is reported More... | |
int | sol_netctl_scan (void) |
request scan the surrounding devices More... | |
int | sol_netctl_service_connect (struct sol_netctl_service *service) |
Connect the service. More... | |
int | sol_netctl_service_disconnect (struct sol_netctl_service *service) |
Disconnect the service. More... | |
const struct sol_ptr_vector * | sol_netctl_service_get_domains (const struct sol_netctl_service *service) |
Gets the service domains. More... | |
const char * | sol_netctl_service_get_error (const struct sol_netctl_service *service) |
Gets the service error. More... | |
const struct sol_netctl_ethernet * | sol_netctl_service_get_ethernet (const struct sol_netctl_service *service) |
Gets the service ethernet. More... | |
const char * | sol_netctl_service_get_name (const struct sol_netctl_service *service) |
Gets the service name. More... | |
const struct sol_ptr_vector * | sol_netctl_service_get_nameservers (const struct sol_netctl_service *service) |
Gets the service nameservers. More... | |
int | sol_netctl_service_get_network_address (const struct sol_netctl_service *service, struct sol_network_link **link) |
Gets the service network address. More... | |
const struct sol_netctl_provider * | sol_netctl_service_get_provider (const struct sol_netctl_service *service) |
Gets the service provider. More... | |
const struct sol_netctl_proxy * | sol_netctl_service_get_proxy (const struct sol_netctl_service *service) |
Gets the service proxy. More... | |
const struct sol_ptr_vector * | sol_netctl_service_get_security (const struct sol_netctl_service *service) |
Gets the service security methods. More... | |
enum sol_netctl_service_state | sol_netctl_service_get_state (const struct sol_netctl_service *service) |
Gets the service state. More... | |
int32_t | sol_netctl_service_get_strength (const struct sol_netctl_service *service) |
Gets the service strength. More... | |
const struct sol_ptr_vector * | sol_netctl_service_get_timeservers (const struct sol_netctl_service *service) |
Gets the service timeservers. More... | |
const char * | sol_netctl_service_get_type (const struct sol_netctl_service *service) |
Gets the service type. More... | |
bool | sol_netctl_service_is_autoconnect (const struct sol_netctl_service *service) |
Checks whether the service is autoconnect or not. More... | |
bool | sol_netctl_service_is_favorite (const struct sol_netctl_service *service) |
Checks whether the service is favorite or not. More... | |
bool | sol_netctl_service_is_immutable (const struct sol_netctl_service *service) |
Checks whether the service is immutable or not. More... | |
bool | sol_netctl_service_is_roaming (const struct sol_netctl_service *service) |
Checks whether the service is roaming or not. More... | |
enum sol_netctl_service_state | sol_netctl_service_state_from_str (const char *state) |
Converts a string service state to sol_netctl_service_state. More... | |
const char * | sol_netctl_service_state_to_str (enum sol_netctl_service_state state) |
Converts sol_netctl_service_state to a string name. More... | |
int | sol_netctl_set_radios_offline (bool enabled) |
Sets the global connection state to offline. More... | |
int | sol_netctl_unregister_agent (void) |
unregister a agent for network connection More... | |
API that should be used to manage device connections.
#define SOL_NETCTL_AGENT_IDENTITY "Identity" |
the agent input identity type string
#define SOL_NETCTL_AGENT_NAME "Name" |
the agent input name type string
#define SOL_NETCTL_AGENT_PASSPHRASE "Passphrase" |
the agent input passphrase type string
#define SOL_NETCTL_AGENT_PASSWORD "Password" |
the agent input password type string
#define SOL_NETCTL_AGENT_USERNAME "Username" |
the agent input username type string
#define SOL_NETCTL_AGENT_WPS "WPS" |
the agent input WPS type string
#define SOL_NETCTL_SERVICE_TYPE_BLUETOOTH "bluetooth" |
bluetooth service type string
#define SOL_NETCTL_SERVICE_TYPE_CELLULAR "cellular" |
bluetooth service type string
#define SOL_NETCTL_SERVICE_TYPE_ETHERNET "ethernet" |
ethernet service type string
#define SOL_NETCTL_SERVICE_TYPE_GADGET "gadget" |
gadget service type string
#define SOL_NETCTL_SERVICE_TYPE_GPS "gps" |
gps service type string
#define SOL_NETCTL_SERVICE_TYPE_P2P "p2p" |
p2p service type string
#define SOL_NETCTL_SERVICE_TYPE_VPN "vpn" |
vpn service type string
#define SOL_NETCTL_SERVICE_TYPE_WIFI "wifi" |
wifi service type string
typedef struct sol_netctl_agent sol_netctl_agent |
agent callback functions
This struct contains the callback functions of agent.
typedef struct sol_netctl_agent_input sol_netctl_agent_input |
agent input struct
This struct contains the information of agent input.
typedef void(* sol_netctl_error_monitor_cb)(void *data, const struct sol_netctl_service *service, unsigned int error) |
error monitor callback used to inform a call result
data | the user data |
service | the activity service |
error | the call result |
typedef struct sol_netctl_ethernet sol_netctl_ethernet |
struct to represent a network ethernet.
This struct contains the necessary information to present a network ethernet for user.
typedef void(* sol_netctl_manager_monitor_cb)(void *data) |
Manager monitor callback used to inform a manager updated.
data | the user data |
typedef struct sol_netctl_network_params sol_netctl_network_params |
network params
This struct contains the information of a network. it has the addr of network link addr, the network of netmask and its gateway of network.
typedef struct sol_netctl_provider sol_netctl_provider |
struct to represent a network provider.
This struct contains the necessary information to present a network provider for user.
typedef struct sol_netctl_proxy sol_netctl_proxy |
struct to represent a network proxy.
This struct contains the necessary information to present a network proxy for user.
service struct
typedef void(* sol_netctl_service_monitor_cb)(void *data, const struct sol_netctl_service *service) |
Service monitor callback used to inform a service changed.
data | the user data |
service | the monitor service |
service state
One of these must be chosen to set the state of service, with sol_netctl_service_get_state()
enum sol_netctl_state |
the global connection state of system
One of these must be chosen for the global connection state, with sol_netctl_get_state()
Enumerator | |
---|---|
SOL_NETCTL_STATE_UNKNOWN | |
SOL_NETCTL_STATE_IDLE | |
SOL_NETCTL_STATE_READY | |
SOL_NETCTL_STATE_ONLINE | |
SOL_NETCTL_STATE_OFFLINE |
int sol_netctl_add_error_monitor | ( | sol_netctl_error_monitor_cb | cb, |
const void * | data | ||
) |
Adds a monitor for the call error happens.
To monitor the call error happens, a single monitor can be done for error happens, and then the call result can be get. sol_netctl_add_error_monitor will call trigger all required activations. This callback must be added BEFORE sol_netctl_service_connect and sol_netctl_service_disconnect.
cb | monitor Callback to be called when the call result are updated |
data | Add a user data per callback |
Referenced by startup().
int sol_netctl_add_manager_monitor | ( | sol_netctl_manager_monitor_cb | cb, |
const void * | data | ||
) |
Adds a monitor for the updated netctl manager properties.
To monitor (State, Offline...), a single monitor can be done for "something changed", and then the new value can be get. sol_netctl_add_manager_monitor will trigger all required activations. This callback must be added BEFORE sol_netctl_get_state and sol_netctl_get_radios_offline.
cb | monitor Callback to be called when the manager are updated |
data | Add a user data per callback |
Referenced by startup().
int sol_netctl_add_service_monitor | ( | sol_netctl_service_monitor_cb | cb, |
const void * | data | ||
) |
Adds a monitor for the updated netctl services.
To monitor the property of services, it gives information about the services. The callback is used to provide the information. sol_netctl_add_service_monitor will trigger all required activations. This callback must be added BEFORE the all functions are called to ensure connection manager has been initialized.
cb | monitor Callback to be called when the services are updated |
data | Add a user data per callback |
Referenced by startup().
int sol_netctl_del_error_monitor | ( | sol_netctl_error_monitor_cb | cb, |
const void * | data | ||
) |
Dels a monitor for the call error happens.
Removes the monitor for updated the call error happens. sol_netctl_del_error_monitor will trigger all required activations.
cb | monitor Callback to be called when the call result are updated |
data | Add a user data per callback |
Referenced by shutdown().
int sol_netctl_del_manager_monitor | ( | sol_netctl_manager_monitor_cb | cb, |
const void * | data | ||
) |
Dels a monitor for the updated netctl manager properties.
Removes the monitor for updated netctl manager properties. sol_netctl_del_manager_monitor will trigger all required activations.
cb | monitor Callback to be called when the manager are updated |
data | Add a user data per callback |
Referenced by shutdown().
int sol_netctl_del_service_monitor | ( | sol_netctl_service_monitor_cb | cb, |
const void * | data | ||
) |
Dels a monitor for the updated netctl services.
Removes the monitor for updated netctl services. sol_netctl_del_service_monitor will trigger all required activations. This callback must be added AFTER the all functions are called to ensure connection manager has been shutdown.
cb | monitor Callback to be called when the services are updated |
data | Add a user data per callback |
Referenced by shutdown().
|
static |
get so_netctl_service struct from serivce name.
This function return sol_netctl_service struct by a string service name.
service_name | Pointer to service name |
References sol_netctl_get_services(), sol_netctl_service_get_name(), and SOL_PTR_VECTOR_FOREACH_IDX.
bool sol_netctl_get_radios_offline | ( | void | ) |
Gets the global connection state of offline.
This function gets the global connection state of offline, after the state is to give by manager monitor. This callback of sol_netctl_add_manager_monitor must be added BEFORE sol_netctl_get_radios_offline() is called to ensure no messages are lost.
true
if the offline is enabled, otherwise false
. Referenced by manager_cb().
const struct sol_ptr_vector* sol_netctl_get_services | ( | void | ) |
Gets the netctl services.
The netctl services vector can be given via sol_netctl_get_services. The vector is the last-known and more may be added/removed dynamically, then the pattern is to add a service monitor BEFORE calling the function.
Referenced by sol_netctl_find_service_by_name().
enum sol_netctl_state sol_netctl_get_state | ( | void | ) |
Gets the global connection state of system.
This function gets the global connection state for system, after the state is to give by manager monitor. This callback of sol_netctl_add_manager_monitor must be added BEFORE sol_netctl_get_state() is called to ensure no messages are lost.
Referenced by manager_cb().
int sol_netctl_register_agent | ( | const struct sol_netctl_agent * | agent, |
const void * | data | ||
) |
register a agent for network connection
A single agent is registered for an application that registering a new agent.
agent | the agent Callback struct to be called when the related information is updated. |
data | Add a user data per callback. |
Referenced by startup().
int sol_netctl_request_input | ( | struct sol_netctl_service * | service, |
const struct sol_ptr_vector * | inputs | ||
) |
request the login input to connection
Request the login input for network connection. When the login information is needed in the process of network connection, the funcation can be used to input the login information for network connection. The login input information is informed via the agent callback. The agent must be registered before using sol_netctl_request_input.
service | The service struct which the network connection is desired. |
inputs | the ptr vector of input types and inputs from the user. |
Referenced by request_input().
int sol_netctl_request_retry | ( | struct sol_netctl_service * | service, |
bool | retry | ||
) |
request retry the connection or not when error type is reported
Request retry the network connection or not when error type is reported. When the network connection failure, the user can select retry the connection or not retry it. The function can be used to select it. If retry connection is selected, the failure network connection will be tried to connect. If not retry connection is selected, the failure network connection will not be tried to connect. The connection failure information is informed via the agent callback. The agent must be registered before using sol_netctl_request_retry.
service | The service struct which the network connection is desired. |
retry | True is retry the failure selected network connection, false is not retry the failure selected network connection. |
Referenced by report_error().
int sol_netctl_scan | ( | void | ) |
request scan the surrounding devices
Request scan for the surrounding devices. This must be inovked AFTER sol_netctl_add_service_monitor.
Referenced by startup().
int sol_netctl_service_connect | ( | struct sol_netctl_service * | service | ) |
Connect the service.
This function connects the service, after the service is to give by service monitor. Since the netctl function is asynchronous, the return is not connection error, but just some dispatching/immediate error. The actual state change will be notified via sol_netctl_add_service_monitor() callbacks. The service connect error info will be notified by error monitor. This callbacks of sol_netctl_add_service_monitor and sol_netctl_add_error_monitor must be added BEFORE the sol_netctl_service_connect() is called to ensure no messages are lost.
service | The service struct which the connection is desired |
Referenced by service_cb().
int sol_netctl_service_disconnect | ( | struct sol_netctl_service * | service | ) |
Disconnect the service.
This function disconnects the service. Since the netctl function is asynchronous, the return is not disconnection error, but just some dispatching/immediate error. The actual state change will be notified via sol_netctl_add_service_monitor() callbacks.The service disconnect error info will be notified by error monitor. This callbacks of sol_netctl_add_service_monitor and sol_netctl_add_error_monitor must be added BEFORE the sol_netctl_service_disconnect() is called to ensure no messages are lost.
service | The service struct which the disconnection is desired |
Referenced by service_cb().
const struct sol_ptr_vector* sol_netctl_service_get_domains | ( | const struct sol_netctl_service * | service | ) |
Gets the service domains.
This function gets the service domains for the netctl service, after the service is to give by service monitor.
service | The service struct which the service domains is desired |
const char* sol_netctl_service_get_error | ( | const struct sol_netctl_service * | service | ) |
Gets the service error.
This function gets the error for the netctl service, after the service is to give by service monitor.
service | The service struct which the name is desired |
const struct sol_netctl_ethernet* sol_netctl_service_get_ethernet | ( | const struct sol_netctl_service * | service | ) |
Gets the service ethernet.
This function gets the service ethernet for the netctl service, after the service is to give by service monitor.
service | The service struct which the service ethernet is desired |
const char* sol_netctl_service_get_name | ( | const struct sol_netctl_service * | service | ) |
Gets the service name.
This function gets the name for the netctl service, after the service is to give by service monitor.
service | The service struct which the name is desired |
Referenced by error_cb(), service_cb(), and sol_netctl_find_service_by_name().
const struct sol_ptr_vector* sol_netctl_service_get_nameservers | ( | const struct sol_netctl_service * | service | ) |
Gets the service nameservers.
This function gets the service nameservers for the netctl service, after the service is to give by service monitor.
service | The service struct which the service nameservers is desired |
int sol_netctl_service_get_network_address | ( | const struct sol_netctl_service * | service, |
struct sol_network_link ** | link | ||
) |
Gets the service network address.
This function gets the network address for the netctl service, after the service is to give by service monitor.
service | The service struct which the network address is desired |
link | The retrieved content |
const struct sol_netctl_provider* sol_netctl_service_get_provider | ( | const struct sol_netctl_service * | service | ) |
Gets the service provider.
This function gets the service provider for the netctl service, after the service is to give by service monitor.
service | The service struct which the service provider is desired |
const struct sol_netctl_proxy* sol_netctl_service_get_proxy | ( | const struct sol_netctl_service * | service | ) |
Gets the service proxy.
This function gets the service proxy for the netctl service, after the service is to give by service monitor.
service | The service struct which the service proxy is desired |
const struct sol_ptr_vector* sol_netctl_service_get_security | ( | const struct sol_netctl_service * | service | ) |
Gets the service security methods.
This function gets the list of security methods or key management settings. Possible values are "none", "wep", "psk", "ieee8021x" and "wps".
service | The service struct which the security is desired |
enum sol_netctl_service_state sol_netctl_service_get_state | ( | const struct sol_netctl_service * | service | ) |
Gets the service state.
This function gets the state for the netctl service, after the service is to give by service monitor.
service | The service struct which the state is desired |
Referenced by service_cb().
int32_t sol_netctl_service_get_strength | ( | const struct sol_netctl_service * | service | ) |
Gets the service strength.
This function gets the service strength for the netctl service, after the service is to give by service monitor.
service | The service struct which the service strength is desired |
Referenced by service_cb().
const struct sol_ptr_vector* sol_netctl_service_get_timeservers | ( | const struct sol_netctl_service * | service | ) |
Gets the service timeservers.
This function gets the service timeservers for the netctl service, after the service is to give by service monitor.
service | The service struct which the service timeservers is desired |
const char* sol_netctl_service_get_type | ( | const struct sol_netctl_service * | service | ) |
Gets the service type.
This function gets the type for the netctl service, after the service is to give by service monitor.
service | The service struct which the type is desired |
Referenced by service_cb().
bool sol_netctl_service_is_autoconnect | ( | const struct sol_netctl_service * | service | ) |
Checks whether the service is autoconnect or not.
This function checks if the service is autoconnect or not for the netctl service, after the service is to give by service monitor.
service | The service struct which the service autoconnect is desired |
true
if the service is autoconnect, otherwise false
. bool sol_netctl_service_is_favorite | ( | const struct sol_netctl_service * | service | ) |
Checks whether the service is favorite or not.
This function checks if the service is favorite or not for the netctl service, after the service is to give by service monitor.
service | The service struct which the service favorite is desired |
true
if the service is favorite, otherwise false
. bool sol_netctl_service_is_immutable | ( | const struct sol_netctl_service * | service | ) |
Checks whether the service is immutable or not.
This function checks if the service is immutable or not for the netctl service, after the service is to give by service monitor.
service | The service struct which the service immutable is desired |
true
if the service is immutable, otherwise false
. bool sol_netctl_service_is_roaming | ( | const struct sol_netctl_service * | service | ) |
Checks whether the service is roaming or not.
This function checks if the service is autoconnect or not for the netctl service, after the service is to give by service monitor.
service | The service struct which the service roaming is desired |
true
if the service is roaming, otherwise false
. enum sol_netctl_service_state sol_netctl_service_state_from_str | ( | const char * | state | ) |
Converts a string service state to sol_netctl_service_state.
This function converts a string service state to enumeration sol_netctl_service_state.
state | Valid values are "unknown", "idle", "association", "configuration", "ready", "online", "disconnect", "failure", "remove". |
const char* sol_netctl_service_state_to_str | ( | enum sol_netctl_service_state | state | ) |
Converts sol_netctl_service_state to a string name.
This function converts sol_netctl_service_state enumeration to a string service state.
state | sol_netctl_service_state. |
int sol_netctl_set_radios_offline | ( | bool | enabled | ) |
Sets the global connection state to offline.
This function sets the global connection state to offline, enter offline Mode too.
enabled | The value is set for offline on/off |
int sol_netctl_unregister_agent | ( | void | ) |
unregister a agent for network connection
Referenced by shutdown().