NetworkInador/client-gtk/ni-client.h

123 lines
4.7 KiB
C
Raw Normal View History

/*
* ni-client.h
* This file is part of NetworkInador
*
* Copyright (C) 2021 - Gatuno
*
* NetworkInador is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* NetworkInador is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NetworkInador; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/* inclusion guard */
#ifndef __NI_CLIENT_H__
#define __NI_CLIENT_H__
#include <glib-object.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "ni-ip.h"
G_BEGIN_DECLS
typedef struct _NIClientClass NIClientClass;
typedef struct _NIClient NIClient;
typedef struct _NIClientPrivate NIClientPrivate;
/*
* Type declaration.
*/
/*
* Type declaration.
*/
#define NI_TYPE_CLIENT (ni_client_get_type ())
#define NI_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NI_TYPE_CLIENT, NIClient))
#define NI_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), NI_TYPE_CLIENT, NIClientClass))
#define NI_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NI_TYPE_CLIENT))
#define NI_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NI_TYPE_CLIENT))
#define NI_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), NI_TYPE_CLIENT, NIClientClass))
GType ni_client_get_type (void);
struct _NIClientClass {
GObjectClass parent_class;
gboolean (* data_response) (NIClient *ni_client, gpointer data, guint size);
/*gboolean (* data_response_error) (NiClient *ni_client, gpointer data, guint size);*/
void (*new_interface) (NIClient *ni_client, gpointer ni_interface);
void (*delete_interface) (NIClient *ni_client, gpointer ni_interface);
2022-02-06 23:28:26 -06:00
void (*new_route) (NIClient *ni_client, gpointer ni_route);
void (*delete_route) (NIClient *ni_client, gpointer ni_route);
void (*new_route_table) (NIClient *ni_client, guint table_id, const gchar *table_name);
void (*delete_route_table) (NIClient *ni_client, guint table_id);
};
struct _NIClient {
GObject parent_instance;
NIClientPrivate *priv;
};
typedef struct _NIInterface NIInterface;
2022-12-24 18:39:46 -06:00
typedef struct _NIRoute NIRoute;
struct _NIClientRouteTable {
guint table;
char name[256];
};
/*
* Method definitions.
*/
NIClient *ni_client_new (void);
NIClient *ni_client_new_with_path (const char *path);
2022-02-06 23:28:26 -06:00
gboolean ni_client_connect (NIClient *ni_client);
2022-02-06 23:28:26 -06:00
void ni_client_ask_ip_interface (NIClient *ni_client, NIInterface *ni_interface, int family);
void ni_client_ask_ip_new (NIClient *ni_client, NIInterface *ni_interface, int family, int prefix, struct_addr *addr, uint32_t flags, unsigned char scope, int has_local, struct_addr *local_addr, int has_brd, struct_addr *brd_addr, uint32_t *cacheinfo);
void ni_client_ask_ip_delete (NIClient *ni_client, NIInterface *ni_interface, NIIP *ni_ip);
void ni_client_ask_change_iface_name (NIClient *ni_client, NIInterface *ni_interface, const gchar *new_name);
2021-12-10 09:56:18 -06:00
void ni_client_ask_change_iface_mtu (NIClient *ni_client, NIInterface *ni_interface, guint new_mtu);
void ni_client_ask_up_down_interface (NIClient *ni_client, NIInterface *ni_interface, gboolean is_up);
void ni_client_ask_create_bridge (NIClient *ni_client, const gchar *name);
2022-02-06 23:28:26 -06:00
GList *ni_client_get_list_interfaces (NIClient *ni_client);
NIInterface *ni_client_get_interface_by_index (NIClient *ni_client, guint index);
2022-02-06 23:28:26 -06:00
GList *ni_client_get_routes_v4 (NIClient *ni_client);
GList *ni_client_get_routes_v6 (NIClient *ni_client);
GList *ni_client_get_route_tables_names (NIClient *ni_client);
2022-02-06 23:28:26 -06:00
void ni_client_ask_route_new (NIClient *ni_client, int family, int prefix, struct_addr *dest, int type, uint32_t tabla, int protocol, int tos, int scope, int has_prefsrc, struct_addr *prefsrc, uint32_t priority, GList *gws);
2022-12-24 18:39:46 -06:00
void ni_client_ask_route_del (NIClient *ni_client, NIRoute *route);
void ni_client_ask_route_tables_names (NIClient *ni_client);
void ni_client_ask_interface_clear_master (NIClient *ni_client, NIInterface *ni_interface);
void ni_client_ask_interface_set_master (NIClient *ni_client, NIInterface *ni_interface, NIInterface *master);
2022-01-02 23:07:39 -06:00
void ni_client_ask_dhcp_stop_interface (NIClient *ni_client, NIInterface *ni_interface);
void ni_client_ask_dhcp_run_interface (NIClient *ni_client, NIInterface *ni_interface, int type);
void ni_client_ask_interface_dhcp_status (NIClient *ni_client, NIInterface *ni_interface);
G_END_DECLS
#endif /* __NI_CLIENT_H__ */