Implement interface statuses in src/if.c
Implement interface statuses in src/if.c to represent interfaces that are down, up, or in an erroneous condition
This commit is contained in:
parent
6148977adf
commit
8e118a3b56
2 changed files with 28 additions and 0 deletions
|
@ -19,6 +19,12 @@ enum patty_ax25_if_flags {
|
|||
PATTY_AX25_IF_SEGMENTER = (1 << 7)
|
||||
};
|
||||
|
||||
enum patty_ax25_if_status {
|
||||
PATTY_AX25_IF_DOWN,
|
||||
PATTY_AX25_IF_UP,
|
||||
PATTY_AX25_IF_ERROR
|
||||
};
|
||||
|
||||
typedef struct _patty_ax25_if_stats {
|
||||
size_t rx_frames,
|
||||
tx_frames,
|
||||
|
@ -73,6 +79,8 @@ typedef struct _patty_ax25_if {
|
|||
size_t mru,
|
||||
mtu;
|
||||
|
||||
enum patty_ax25_if_status status;
|
||||
|
||||
patty_ax25_addr addr;
|
||||
patty_list *aliases;
|
||||
patty_dict *promisc_fds;
|
||||
|
@ -86,6 +94,12 @@ patty_ax25_if *patty_ax25_if_new(patty_ax25_if_driver *driver,
|
|||
|
||||
void patty_ax25_if_destroy(patty_ax25_if *iface);
|
||||
|
||||
void patty_ax25_if_up(patty_ax25_if *iface);
|
||||
|
||||
void patty_ax25_if_down(patty_ax25_if *iface);
|
||||
|
||||
void patty_ax25_if_error(patty_ax25_if *iface);
|
||||
|
||||
int patty_ax25_if_addr_set(patty_ax25_if *iface,
|
||||
patty_ax25_addr *addr);
|
||||
|
||||
|
|
14
src/if.c
14
src/if.c
|
@ -49,6 +49,8 @@ patty_ax25_if *patty_ax25_if_new(patty_ax25_if_driver *driver,
|
|||
goto error_dict_new_promisc_fds;
|
||||
}
|
||||
|
||||
iface->status = PATTY_AX25_IF_DOWN;
|
||||
|
||||
return iface;
|
||||
|
||||
error_dict_new_promisc_fds:
|
||||
|
@ -88,6 +90,18 @@ void patty_ax25_if_destroy(patty_ax25_if *iface) {
|
|||
free(iface);
|
||||
}
|
||||
|
||||
void patty_ax25_if_up(patty_ax25_if *iface) {
|
||||
iface->status = PATTY_AX25_IF_UP;
|
||||
}
|
||||
|
||||
void patty_ax25_if_down(patty_ax25_if *iface) {
|
||||
iface->status = PATTY_AX25_IF_DOWN;
|
||||
}
|
||||
|
||||
void patty_ax25_if_error(patty_ax25_if *iface) {
|
||||
iface->status = PATTY_AX25_IF_ERROR;
|
||||
}
|
||||
|
||||
int patty_ax25_if_addr_each(patty_ax25_if *iface,
|
||||
int (*callback)(patty_ax25_addr *, void *),
|
||||
void *ctx) {
|
||||
|
|
Loading…
Add table
Reference in a new issue