Added support to add ipv6 route using netlink.
[platform/core/connectivity/net-config.git] / include / util.h
index 299d8d3..04cc9d4 100755 (executable)
@@ -25,6 +25,7 @@ extern "C" {
 #endif
 
 #include <glib.h>
+#include <stdbool.h>
 
 #include "wifi.h"
 #include "plugin.h"
@@ -33,6 +34,28 @@ extern "C" {
 
 #define MAX_SIZE_ERROR_BUFFER 256
 
+#define ETHERNET_FEATURE "http://tizen.org/feature/network.ethernet"
+#define TETHERING_FEATURE "http://tizen.org/feature/network.tethering"
+#define WIFI_DIRECT_FEATURE "http://tizen.org/feature/network.wifi.direct"
+
+/** Macros to handle rtattributes */
+#define RTA_ALIGNTO    4
+#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
+#define RTA_LENGTH(len)        (RTA_ALIGN(sizeof(struct rtattr)) + (len))
+#define RTA_DATA(rta)   ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
+#define NLMSG_TAIL(nmsg) \
+       ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
+
+typedef enum {
+       NETCONFIG_SUPPORTED_FEATURE_ETHERNET = 0,
+       NETCONFIG_SUPPORTED_FEATURE_TETHERING,
+       NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT,
+       NETCONFIG_SUPPORTED_FEATURE_MAX,
+} netconfig_supported_feature_e;
+
+bool netconfig_check_feature_supported(netconfig_supported_feature_e feature);
+
+gboolean netconfig_check_passphrase(const gchar *service, const char *passphrase);
 GKeyFile *netconfig_keyfile_load(const char *pathname);
 void netconfig_keyfile_save(GKeyFile *keyfile, const char *pathname);
 
@@ -55,8 +78,10 @@ int __netconfig_get_interface_index(const char *interface_name);
 
 int netconfig_execute_cmd(const char *cmd);
 int netconfig_execute_file(const char *file_path, char *const args[], char *const env[]);
+int netconfig_execute_file_no_wait(const char *file_path,
+               char *const args[]);
 int netconfig_execute_clatd(const char *file_path, char *const args[]);
-int netconfig_add_route_ipv6(gchar *ip_addr, gchar *interface, gchar *gateway, unsigned char prefix_len);
+int netconfig_add_route_ipv6(gchar *interface, gchar *gateway);
 int netconfig_del_route_ipv6(gchar *ip_addr, gchar *interface, gchar *gateway, unsigned char prefix_len);
 int netconfig_add_route_ipv4(gchar *ip_addr, gchar *subnet, gchar *interface, gint address_family);
 int netconfig_del_route_ipv4(gchar *ip_addr, gchar *subnet, gchar *interface, gint address_family);