2020-01-02 12:53:53 -06:00
|
|
|
/*
|
|
|
|
* ip-address.c
|
|
|
|
* This file is part of Network-inador
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019, 2020 - Félix Arreola Rodríguez
|
|
|
|
*
|
|
|
|
* Network-inador 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.
|
|
|
|
*
|
|
|
|
* Network-inador 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 Network-inador; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __IP_ADDRESS_H__
|
|
|
|
#define __IP_ADDRESS_H__
|
|
|
|
|
|
|
|
#include <netlink/socket.h>
|
|
|
|
#include <netlink/msg.h>
|
|
|
|
|
2024-01-09 23:02:39 -06:00
|
|
|
#include "network-inador-private.h"
|
|
|
|
|
|
|
|
#include "interfaces.h"
|
|
|
|
#include "struct_addr_union.h"
|
|
|
|
|
|
|
|
#ifndef INFINITY_LIFE_TIME
|
|
|
|
#define INFINITY_LIFE_TIME 0xFFFFFFFFU
|
|
|
|
#endif
|
|
|
|
|
2025-01-02 17:43:10 -06:00
|
|
|
typedef struct _IPAddr {
|
2024-01-09 23:02:39 -06:00
|
|
|
sa_family_t family;
|
|
|
|
|
|
|
|
uint8_t prefix;
|
|
|
|
struct_addr local_addr;
|
|
|
|
struct_addr addr;
|
|
|
|
struct_addr brd_addr;
|
|
|
|
|
|
|
|
char label[256];
|
|
|
|
struct ifa_cacheinfo cacheinfo;
|
|
|
|
|
|
|
|
uint8_t is_p2p;
|
|
|
|
uint8_t has_brd;
|
|
|
|
uint8_t has_local;
|
|
|
|
|
|
|
|
uint32_t flags;
|
|
|
|
uint8_t scope;
|
|
|
|
|
|
|
|
Interface *iface;
|
|
|
|
} IPAddr;
|
2020-01-02 12:53:53 -06:00
|
|
|
|
|
|
|
int ip_address_receive_message_newaddr (struct nl_msg *msg, void *arg);
|
2020-07-18 21:54:39 -05:00
|
|
|
int ip_address_receive_message_deladdr (struct nl_msg *msg, void *arg);
|
2020-01-02 12:53:53 -06:00
|
|
|
void ip_address_init (NetworkInadorHandle *handle);
|
|
|
|
|
2025-01-08 23:46:30 -06:00
|
|
|
int ip_address_add_ip (NetworkInadorHandle *handle, int index, uint8_t ip_family, uint8_t ip_prefix, uint8_t ip_has_local, uint8_t ip_has_brd, uint8_t ip_scope, uint32_t ip_flags, struct ifa_cacheinfo *ip_cacheinfo, void *ip_addr, void *ip_local_addr, void *ip_brd_addr);
|
|
|
|
int ip_address_del_ip (NetworkInadorHandle *handle, int index, uint8_t ip_family, uint8_t ip_prefix, uint8_t ip_has_local, void *ip_addr, void *ip_local_addr);
|
2020-01-02 17:03:01 -06:00
|
|
|
|
2021-09-17 08:20:00 -05:00
|
|
|
IPAddr *_ip_address_search_addr (Interface *iface, sa_family_t family, void *addr, uint32_t prefix, void *local_addr);
|
|
|
|
|
2020-01-02 12:53:53 -06:00
|
|
|
#endif
|