2021-09-04 23:32:04 -05:00
|
|
|
/*
|
|
|
|
* 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>
|
|
|
|
|
2021-09-17 08:20:00 -05:00
|
|
|
#include "ni-ip.h"
|
|
|
|
|
2021-09-04 23:32:04 -05:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _NIClient {
|
|
|
|
GObject parent_instance;
|
|
|
|
|
|
|
|
NIClientPrivate *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _NIInterface NIInterface;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Method definitions.
|
|
|
|
*/
|
|
|
|
NIClient *ni_client_new (void);
|
|
|
|
NIClient *ni_client_new_with_path (const char *path);
|
|
|
|
gboolean ni_client_connect (NIClient *ni_client);
|
|
|
|
void ni_client_ask_ip_interface (NIClient *ni_client, NIInterface *ni_interface, int family);
|
|
|
|
void ni_client_ask_ips (NIClient *ni_client, NIInterface *ni_interface);
|
2021-09-17 08:20:00 -05:00
|
|
|
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);
|
|
|
|
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);
|
2021-09-17 08:20:00 -05:00
|
|
|
void ni_client_ask_up_down_interface (NIClient *ni_client, NIInterface *ni_interface, gboolean is_up);
|
2021-12-28 23:16:15 -06:00
|
|
|
void ni_client_ask_create_bridge (NIClient *ni_client, const gchar *name);
|
|
|
|
GList *ni_client_get_list_interfaces (NIClient *ni_client);
|
|
|
|
NIInterface *ni_client_get_interface_by_index (NIClient *ni_client, guint index);
|
|
|
|
|
|
|
|
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);
|
2021-09-04 23:32:04 -05:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __NI_CLIENT_H__ */
|