Add interfaces

This commit is contained in:
Melon 2021-04-24 11:18:45 +01:00
parent c8993d9b71
commit 267ba7a5aa
7 changed files with 49 additions and 0 deletions

11
src/intf/config_file.h Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
#include <stdbool.h>
typedef struct KeyValuePair {
char *key;
char *value;
bool loop;
} keyvaluepair_t;
keyvaluepair_t config_read(FILE *fp);
void config_write(FILE *fp, char *key, char *value);

4
src/intf/magic_code.h Normal file
View File

@ -0,0 +1,4 @@
#pragma once
int MAGIC_CODE_A = 0xbb97dae1;
int MAGIC_CODE_B = 0xa935e462;

View File

@ -0,0 +1,5 @@
#pragma once
#define SV_DAEMON_SOCK_PATH "/tmp/melonvpndaemon.sock"
#define SV_RPEERS_SOCK_PATH "/tmp/melonvpnrefreshpeers.sock"
#define SV_CLIENT_SOCK_PATH "/tmp/melonvpn.sock"

4
src/intf/open_gui.h Normal file
View File

@ -0,0 +1,4 @@
#pragma once
#include <stdbool.h>
int open_gui(int argc, char **argv, bool is_debug);

7
src/intf/states.h Normal file
View File

@ -0,0 +1,7 @@
#pragma once
typedef enum {
CONNECTED,
DISCONNECTED,
RESTARTING
} States;

8
src/intf/statusicon.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libappindicator/app-indicator.h>
#include "states.h"
void status_icon_create(GtkWidget *window, char *off, char *on);
void status_icon_set_state(AppIndicatorStatus state);

10
src/intf/unix_sockets.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include <sys/socket.h>
#include <sys/un.h>
#define BUF_SIZE 100
#define BACKLOG 5
int unix_socket_client_start(char *sock_path);
int unix_socket_server_start(char *sock_path);