Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
sol-network.h File Reference

These are routines that Soletta provides for handling network link interfaces, making it possible to observe events, to inquire available links and to set their states. More...

#include <stdbool.h>
#include <sol-common-buildopts.h>
#include <sol-vector.h>
#include <sol-str-slice.h>
#include <sol-buffer.h>
#include <sol-util.h>

Go to the source code of this file.

Data Structures

struct  sol_network_link
 Structure to represent a network link. More...
 
struct  sol_network_link_addr
 Structure to represent a network address, both IPv6 and IPv4 are valid. More...
 

Macros

#define SOL_BLUETOOTH_ADDR_STRLEN   18
 String size of a Bluetooth address. More...
 
#define SOL_NETWORK_INET_ADDR_STR_LEN   48
 String size of an IPv4/v6 address. More...
 
#define SOL_NETWORK_LINK_API_VERSION   (1)
 
#define SOL_NETWORK_LINK_CHECK_VERSION(link_,...)
 Macro used to check if a struct struct sol_network_link has the expected API version. More...
 

Typedefs

typedef struct
sol_network_hostname_pending 
sol_network_hostname_pending
 A handle returned by sol_network_get_hostname_address_info() More...
 
typedef struct sol_network_link sol_network_link
 Structure to represent a network link. More...
 
typedef struct
sol_network_link_addr 
sol_network_link_addr
 Structure to represent a network address, both IPv6 and IPv4 are valid. More...
 

Enumerations

enum  sol_network_bt_addr_type { SOL_NETWORK_BT_ADDR_BASIC_RATE, SOL_NETWORK_BT_ADDR_LE_PUBLIC, SOL_NETWORK_BT_ADDR_LE_RANDOM }
 Type of a Bluetooth address. More...
 
enum  sol_network_event { SOL_NETWORK_LINK_ADDED, SOL_NETWORK_LINK_REMOVED, SOL_NETWORK_LINK_CHANGED }
 Type of events generated for a network link. More...
 
enum  sol_network_family {
  SOL_NETWORK_FAMILY_UNSPEC, SOL_NETWORK_FAMILY_INET, SOL_NETWORK_FAMILY_INET6, SOL_NETWORK_FAMILY_BLUETOOTH,
  SOL_NETWORK_FAMILY_BLUETOOTH_RFCOMM, SOL_NETWORK_FAMILY_BLUETOOTH_L2CAP
}
 Type of a network address. More...
 
enum  sol_network_link_flags {
  SOL_NETWORK_LINK_UP = (1 << 0), SOL_NETWORK_LINK_BROADCAST = (1 << 1), SOL_NETWORK_LINK_LOOPBACK = (1 << 2), SOL_NETWORK_LINK_MULTICAST = (1 << 3),
  SOL_NETWORK_LINK_RUNNING = (1 << 4)
}
 Bitwise OR-ed flags to represent the status of a sol_network_link. More...
 

Functions

const struct sol_vectorsol_network_get_available_links (void)
 Retrieve the available network links on a system. More...
 
struct
sol_network_hostname_pending
sol_network_get_hostname_address_info (const struct sol_str_slice hostname, enum sol_network_family family, void(*host_info_cb)(void *data, const struct sol_str_slice hostname, const struct sol_vector *addrs_list), const void *data)
 Gets a hostname address info. More...
 
int sol_network_hostname_pending_cancel (struct sol_network_hostname_pending *handle)
 Cancels a request to get the hostname info. More...
 
static bool sol_network_link_addr_eq (const struct sol_network_link_addr *a, const struct sol_network_link_addr *b)
 Checks if two address are equal. More...
 
static bool sol_network_link_addr_eq_full (const struct sol_network_link_addr *a, const struct sol_network_link_addr *b, bool compare_ports)
 Checks if two address are equal - possibly including the port field. More...
 
const struct
sol_network_link_addr
sol_network_link_addr_from_str (struct sol_network_link_addr *addr, const char *buf)
 Converts a string address to sol_network_link_addr. More...
 
const char * sol_network_link_addr_to_str (const struct sol_network_link_addr *addr, struct sol_buffer *buf)
 Converts a sol_network_link_addr to a string. More...
 
int sol_network_link_down (uint16_t link_index)
 Sets a network link down. More...
 
char * sol_network_link_get_name (const struct sol_network_link *link)
 Gets the name of a network link. More...
 
int sol_network_link_up (uint16_t link_index)
 Sets a network link up. More...
 
int sol_network_subscribe_events (void(*cb)(void *data, const struct sol_network_link *link, enum sol_network_event event), const void *data)
 Subscribes to receive network link events. More...
 
int sol_network_unsubscribe_events (void(*cb)(void *data, const struct sol_network_link *link, enum sol_network_event event), const void *data)
 Stops receiving network link events. More...
 

Detailed Description

These are routines that Soletta provides for handling network link interfaces, making it possible to observe events, to inquire available links and to set their states.

Macro Definition Documentation

#define SOL_NETWORK_LINK_API_VERSION   (1)