- public bool ap_mode_security_valid (SecurityType type, DeviceWifiCapabilities wifi_caps)
Given a set of device capabilities, and a desired security type to
check against, determines whether the combination of device capabilities and desired security type are valid for AP/Hotspot
connections.
- public string bin2hexstr (string bytes, int len, int final_len)
Converts a byte-array bytes
into a hexadecimal string.
- public bool check_virtual_device_compatibility (Type virtual_type, Type other_type)
Determines if a connection of type virtual_type
can (in
the general case) work with connections of type other_type
.
- public void deinit ()
No-op.
- public unowned string escape_ssid (uint8 ssid, uint32 len)
This function does a quick printable character conversion of the SSID,
simply replacing embedded NULLs and non-printable characters with the hexadecimal representation of that character.
- public bool file_is_pkcs12 (string filename)
Utility function to find out if the filename
is in
PKCS#12 format.
- public unowned string file_search_in_paths (string progname, string? try_first, string? paths, FileTest file_test_flags, UtilsFileSearchInPathsPredicate predicate) throws Error
Searches for a progname
file in a list of search
paths
.
- public HashTable<unowned string,unowned Value?> gvalue_hash_dup (HashTable<void*,void*> hash)
Utility function to duplicate a hash table of
Values.
- public int hex2byte (string hex)
Converts a hex string (2 characters) into its byte representation.
- public string hexstr2bin (string hex, size_t len)
Converts a hexadecimal string hex
into a byte-array.
- public ByteArray hwaddr_atoba (string asc, int type)
Parses asc
and converts it to binary form in a
ByteArray.
- public uint8 hwaddr_aton (string asc, int type, void* buffer)
Parses asc
and converts it to binary form in buffer
.
- public uint8 hwaddr_aton_len (string asc, void* buffer, size_t length)
Parses asc
and converts it to binary form in buffer
.
- public int hwaddr_len (int type)
Returns the length in octets of a hardware address of type type
.
- public string hwaddr_ntoa (void* addr, int type)
Converts addr
to textual form.
- public string hwaddr_ntoa_len (void* addr, size_t length)
Converts addr
to textual form.
- public int hwaddr_type (int len)
Returns the type (either ARPHRD_ETHER or ARPHRD_INFINIBAND
) of the raw address given its length.
- public bool hwaddr_valid (string asc)
Parses asc
to see if it is a valid hardware address of
some type.
- public bool iface_valid_name (string name)
This function is a 1:1 copy of the kernel's interface validation
function in net/core/dev.
- public bool init () throws Error
Initializes libnm-util; should be called when starting any program
that uses libnm-util.
- public SList<IP4Address> ip4_addresses_from_gvalue (Value value)
Utility function to convert a GenericArray
of Arrays of uint32s representing a list of NetworkManager IPv4 addresses
(which is a tuple of address, gateway, and prefix) into a SList of
IP4Address objects.
- public void ip4_addresses_to_gvalue (SList<IP4Address> list, Value value)
Utility function to convert a SList of
IP4Address objects into a GenericArray of
Arrays of uint32s representing a list of NetworkManager IPv4 addresses (which
is a tuple of address, gateway, and prefix).
- public uint32 ip4_get_default_prefix (uint32 ip)
When the Internet was originally set up, various ranges of IP
addresses were segmented into three network classes: A, B, and C.
- public uint32 ip4_netmask_to_prefix (uint32 netmask)
- public uint32 ip4_prefix_to_netmask (uint32 prefix)
- public SList<IP4Route> ip4_routes_from_gvalue (Value value)
Utility function to convert a GenericArray
of Arrays of uint32s representing a list of NetworkManager IPv4 routes (which
is a tuple of route, next hop, prefix, and metric) into a SList of
IP4Route objects.
- public void ip4_routes_to_gvalue (SList<IP4Route> list, Value value)
Utility function to convert a SList of
IP4Route objects into a GenericArray of
Arrays of uint32s representing a list of NetworkManager IPv4 routes (which is a tuple of route,
next hop, prefix, and metric).
- public SList<IP6Address> ip6_addresses_from_gvalue (Value value)
Utility function to convert a GenericArray
of ValueArrays of (#GArray of guchars) and uint32 representing a list of
NetworkManager IPv6 addresses (which is a tuple of address, prefix, and gateway), into a SList of
IP6Address objects.
- public void ip6_addresses_to_gvalue (SList<IP6Address> list, Value value)
Utility function to convert a SList of
IP6Address objects into a GenericArray of
ValueArrays representing a list of NetworkManager IPv6 addresses (which is a tuple of address, prefix, and
gateway).
- public SList<IP6Route> ip6_routes_from_gvalue (Value value)
Utility function GenericArray of
ValueArrays of (#GArray of uchars), uint32,
(#GArray of uchars), and uint32 representing a list of NetworkManager IPv6
routes (which is a tuple of destination, prefix, next hop, and metric) into a SList of
IP6Route objects.
- public void ip6_routes_to_gvalue (SList<IP6Route> list, Value value)
Utility function to convert a SList of
IP6Route objects into a GenericArray of
ValueArrays of (#GArray of uchars), uint32, (#GArray of
uchars), and uint32 representing a list of NetworkManager IPv6 routes (which
is a tuple of destination, prefix, next hop, and metric).
- public bool is_empty_ssid (uint8 ssid, int len)
Different manufacturers use different mechanisms for not broadcasting
the AP's SSID.
- public bool is_uuid (string str)
Checks if str
is a UUID
- public ByteArray rsa_key_encrypt (ByteArray data, string? in_password, out string out_password) throws Error
Encrypts the given RSA private key data with the given password (or
generates a password if no password was given) and converts the data to PEM format suitable for writing to a file.
- public ByteArray rsa_key_encrypt_aes (ByteArray data, string? in_password, out string out_password) throws Error
Encrypts the given RSA private key data with the given password (or
generates a password if no password was given) and converts the data to PEM format suitable for writing to a file.
- public bool same_ssid (ByteArray ssid1, ByteArray ssid2, bool ignore_trailing_null)
Earlier versions of the Linux kernel added a NULL byte to the end of
the SSID to enable easy printing of the SSID on the console or in a terminal, but this behavior was problematic (SSIDs are simply byte
arrays, not strings) and thus was changed.
- public bool security_valid (SecurityType type, DeviceWifiCapabilities wifi_caps, bool have_ap, bool adhoc, @80211ApFlags ap_flags, @80211ApSecurityFlags ap_wpa, @80211ApSecurityFlags ap_rsn)
Given a set of device capabilities, and a desired security type to
check against, determines whether the combination of device, desired security type, and AP capabilities intersect.
- public string ssid_to_utf8 (ByteArray ssid)
Wi-Fi SSIDs are byte arrays, they are _not_ strings.
- public string uuid_generate ()
- public string uuid_generate_from_string (string s)
For a given s
, this function will always return the same
UUID.
- public bool wep_key_valid (string key, WepKeyType wep_type)
Checks if key
is a valid WEP key
- public uint32 wifi_channel_to_freq (uint32 channel, string band)
Utility function to translate a Wi-Fi channel to its corresponding
frequency.
- public uint32 wifi_find_next_channel (uint32 channel, int direction, string band)
Utility function to find out next/previous Wi-Fi channel for a
channel.
- public uint32 wifi_freq_to_channel (uint32 freq)
Utility function to translate a Wi-Fi frequency to its corresponding
channel.
- public bool wifi_is_channel_valid (uint32 channel, string band)
Utility function to verify Wi-Fi channel validity.
- public bool wpa_psk_valid (string psk)
Checks if psk
is a valid WPA PSK