92 lines
2.8 KiB
C
92 lines
2.8 KiB
C
/*
|
|
* ni-route.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_ROUTE_H__
|
|
#define __NI_ROUTE_H__
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
typedef struct _NIRouteClass NIRouteClass;
|
|
typedef struct _NIRoute NIRoute;
|
|
typedef struct _NIRoutePrivate NIRoutePrivate;
|
|
|
|
/*
|
|
* Type declaration.
|
|
*/
|
|
#define NI_TYPE_ROUTE (ni_route_get_type ())
|
|
#define NI_ROUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NI_TYPE_ROUTE, NIRoute))
|
|
#define NI_ROUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), NI_TYPE_ROUTE, NIRouteClass))
|
|
#define NI_IS_ROUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NI_TYPE_ROUTE))
|
|
#define NI_IS_ROUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NI_TYPE_ROUTE))
|
|
#define NI_ROUTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), NI_TYPE_ROUTE, NIRouteClass))
|
|
|
|
GType ni_route_get_type (void);
|
|
|
|
struct _NIRouteClass {
|
|
GObjectClass parent_class;
|
|
|
|
};
|
|
|
|
struct _NIRoute {
|
|
GObject parent_instance;
|
|
|
|
NIRoutePrivate *priv;
|
|
};
|
|
|
|
typedef struct _NIRouteNH {
|
|
gboolean has_gw;
|
|
struct_addr gw;
|
|
guint out_index;
|
|
guint weight;
|
|
guint flags;
|
|
} NIRouteNH;
|
|
|
|
/*
|
|
* Method definitions.
|
|
*/
|
|
|
|
NIRoute *ni_route_new (NIClient *ni_client, int family, int type, uint32_t table, struct_addr *dest, int prefix, unsigned char protocol, unsigned char tos, unsigned char scope, struct_addr *prefsrc, int priority, int num_nexthops, NIRouteNH *nexthops);
|
|
|
|
NIClient *ni_route_get_client (NIRoute *ni_route);
|
|
guint ni_route_get_family (NIRoute *ni_route);
|
|
guint ni_route_get_route_type (NIRoute *ni_route);
|
|
const struct_addr *ni_route_get_dest (NIRoute *ni_route);
|
|
guint ni_route_get_prefix (NIRoute *ni_route);
|
|
uint32_t ni_route_get_table (NIRoute *ni_route);
|
|
guint ni_route_get_num_nexthops (NIRoute *ni_route);
|
|
const NIRouteNH *ni_route_get_nexthops (NIRoute *ni_route);
|
|
gboolean ni_route_has_prefsrc (NIRoute *ni_route);
|
|
const struct_addr *ni_route_get_prefsrc (NIRoute *ni_route);
|
|
guint ni_route_get_priority (NIRoute *ni_route);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __NI_ROUTE_H__ */
|