Close down everything if dhcpcd connection lost.
[dhcpcd-ui] / src / libdhcpcd / dhcpcd.h
index 8c788e801e8d84f9a807952680c2c328c3c26200..68f9a88eb1360d7cca647fd284dfb77b6613ee25 100644 (file)
@@ -39,6 +39,9 @@ extern "C" {
 #ifndef DHCPCD_SOCKET
 #define DHCPCD_SOCKET          "/var/run/dhcpcd.sock"
 #endif
 #ifndef DHCPCD_SOCKET
 #define DHCPCD_SOCKET          "/var/run/dhcpcd.sock"
 #endif
+#ifndef DHCPCD_UNPRIV_SOCKET
+#define DHCPCD_UNPRIV_SOCKET   "/var/run/dhcpcd.unpriv.sock"
+#endif
 
 #ifndef WPA_CTRL_DIR
 #define WPA_CTRL_DIR           "/var/run/wpa_supplicant"
 
 #ifndef WPA_CTRL_DIR
 #define WPA_CTRL_DIR           "/var/run/wpa_supplicant"
@@ -136,8 +139,10 @@ typedef struct dhcpcd_wpa {
 typedef struct dhcpcd_connection {
        struct dhcpcd_connection *next;
        bool open;
 typedef struct dhcpcd_connection {
        struct dhcpcd_connection *next;
        bool open;
+       bool privileged;
        int command_fd;
        int listen_fd;
        int command_fd;
        int listen_fd;
+       const char *progname;
 
        DHCPCD_IF *interfaces;
        DHCPCD_WPA *wpa;
 
        DHCPCD_IF *interfaces;
        DHCPCD_WPA *wpa;
@@ -174,10 +179,12 @@ typedef void *DHCPCD_CONNECTION;
 
 DHCPCD_CONNECTION * dhcpcd_new(void);
 const char * dhcpcd_version(DHCPCD_CONNECTION *);
 
 DHCPCD_CONNECTION * dhcpcd_new(void);
 const char * dhcpcd_version(DHCPCD_CONNECTION *);
+void dhcpcd_set_progname(DHCPCD_CONNECTION *, const char *);
+const char * dhcpcd_get_progname(const DHCPCD_CONNECTION *);
 const char * dhcpcd_status(DHCPCD_CONNECTION *);
 const char * dhcpcd_cffile(DHCPCD_CONNECTION *);
 bool dhcpcd_realloc(DHCPCD_CONNECTION *, size_t);
 const char * dhcpcd_status(DHCPCD_CONNECTION *);
 const char * dhcpcd_cffile(DHCPCD_CONNECTION *);
 bool dhcpcd_realloc(DHCPCD_CONNECTION *, size_t);
-int dhcpcd_open(DHCPCD_CONNECTION *);
+int dhcpcd_open(DHCPCD_CONNECTION *, bool priv);
 void dhcpcd_close(DHCPCD_CONNECTION *);
 void dhcpcd_free(DHCPCD_CONNECTION *);
 void dhcpcd_set_if_callback(DHCPCD_CONNECTION *,
 void dhcpcd_close(DHCPCD_CONNECTION *);
 void dhcpcd_free(DHCPCD_CONNECTION *);
 void dhcpcd_set_if_callback(DHCPCD_CONNECTION *,
@@ -185,6 +192,7 @@ void dhcpcd_set_if_callback(DHCPCD_CONNECTION *,
 void dhcpcd_set_status_callback(DHCPCD_CONNECTION *,
     void (*)(DHCPCD_CONNECTION *, const char *, void *), void *);
 int dhcpcd_get_fd(DHCPCD_CONNECTION *);
 void dhcpcd_set_status_callback(DHCPCD_CONNECTION *,
     void (*)(DHCPCD_CONNECTION *, const char *, void *), void *);
 int dhcpcd_get_fd(DHCPCD_CONNECTION *);
+bool dhcpcd_privileged(DHCPCD_CONNECTION *);
 void dhcpcd_dispatch(DHCPCD_CONNECTION *);
 DHCPCD_IF * dhcpcd_interfaces(DHCPCD_CONNECTION *);
 DHCPCD_IF * dhcpcd_get_if(DHCPCD_CONNECTION *, const char *, const char *);
 void dhcpcd_dispatch(DHCPCD_CONNECTION *);
 DHCPCD_IF * dhcpcd_interfaces(DHCPCD_CONNECTION *);
 DHCPCD_IF * dhcpcd_get_if(DHCPCD_CONNECTION *, const char *, const char *);
@@ -250,6 +258,7 @@ const char * dhcpcd_config_get(DHCPCD_OPTION *, const char *);
 const char * dhcpcd_config_get_static(DHCPCD_OPTION *, const char *);
 bool dhcpcd_config_set(DHCPCD_OPTION **, const char *, const char *);
 bool dhcpcd_config_set_static(DHCPCD_OPTION **, const char *, const char *);
 const char * dhcpcd_config_get_static(DHCPCD_OPTION *, const char *);
 bool dhcpcd_config_set(DHCPCD_OPTION **, const char *, const char *);
 bool dhcpcd_config_set_static(DHCPCD_OPTION **, const char *, const char *);
+bool dhcpcd_config_writeable(DHCPCD_CONNECTION *con);
 bool dhcpcd_config_write(DHCPCD_CONNECTION *,
     const char *, const char *, const DHCPCD_OPTION *);
 
 bool dhcpcd_config_write(DHCPCD_CONNECTION *,
     const char *, const char *, const DHCPCD_OPTION *);