44 lines
987 B
C
44 lines
987 B
C
#ifndef ILDUSC_NWSTATUS_H
|
|
#define ILDUSC_NWSTATUS_H
|
|
|
|
#include <sys/types.h>
|
|
#include <arpa/inet.h>
|
|
|
|
typedef struct {
|
|
char *name;
|
|
int index;
|
|
unsigned int flags;
|
|
int has_link;
|
|
} interface_t;
|
|
|
|
typedef struct {
|
|
uint8_t family;
|
|
uint8_t scope;
|
|
union {
|
|
struct in_addr v4;
|
|
struct in6_addr v6;
|
|
} a;
|
|
interface_t *interface;
|
|
int current;
|
|
} address_t;
|
|
|
|
void interface_set_name(int index, char *name);
|
|
void interface_set_link(int index, int has_link);
|
|
void interface_set_flags(int index, unsigned int flags);
|
|
int interface_get_link(int index);
|
|
char *interface_get_name(int index);
|
|
void del_interface(int index);
|
|
|
|
void add_address(int index, uint8_t scope,
|
|
uint8_t family, void *addr);
|
|
void del_address(int index, uint8_t family, void *addr);
|
|
|
|
address_t *get_best_v4_address(void);
|
|
address_t *get_best_v6_address(void);
|
|
|
|
void address_toggle_current(address_t *address);
|
|
|
|
void netstatus_init(void);
|
|
void print_status(void);
|
|
#endif /* ILDUSC_NWSTATUS_H */
|